User File #21887470776514321

Upload All User Files

#21887470776514321 - [lua]Crash Bandicoot Huge Adventure

lua.lua
3 comments, 1101 downloads
Uploaded 4/4/2015 4:34 PM by Dica (see all 7)
-- Crash Huge Adventure lua v2.1 BizHawk
-- This is Community Work Please Help
-- Join in add updates of your own and add your name

-- Values Found by: Spikestuff
-- Script Code by: Spikestuff, Ilari

function flying()
	-- Flying Cooldown
	local cooldwn = memory.readbyte(0x14E0)-1
	if cooldwn ~= -1 then
		gui.text(0,118,"Cooldown: " .. cooldwn)
	end
end

function ngin()
	local bombhealth = memory.read_s8(0x4130)
	local turthealth = memory.read_u8(0x40B0)
	local lefthealth = memory.read_u16_le(0x41B0)
	local righthealth = memory.read_u16_le(0x4230)

	if not (bombhealth == 255 or bombhealth == -1) then
		gui.text(30,70,"Bomb: " .. (bombhealth+1)/2) 
	end
	if not (lefthealth == 0 and righthealth == 0) then
		gui.text(0,86,"Rockets: " .. (lefthealth/2) .. "/" .. (righthealth/2))
	end
	if not (turthealth == 255 or turthealth == -1) then
		gui.text(10,102,"Turret: " .. (turthealth+1)/2)
	end
end

function bonus()
	gui.text(0,70,"Pixel X: " .. memory.read_u32_le(0x010E2D))
	gui.text(0,86,"Pixel Y: " .. memory.read_u32_le(0x010E31))
	gui.text(0,102,"Speed X: " .. memory.read_s16_le(0x010E8C))
	gui.text(0,118,"Speed Y: " .. memory.read_s16_le(0x010E90))
	gui.text(0,276,"Slide Time: 22/" .. memory.read_s16_le(0x0111F4),"black","orange")
	gui.text(0,292," Spin Time: 23/" .. memory.read_s16_le(0x0111F4),"black","orange")
end

function normal_lvl(area)
	gui.text(0,70,"Pixel X: " .. memory.read_u32_le(0x010A14))
	gui.text(0,86,"Pixel Y: " .. memory.read_u32_le(0x010A18))
	gui.text(0,102,"Speed X: " .. memory.read_s16_le(0x010A74))
	gui.text(0,118,"Speed Y: " .. memory.read_s16_le(0x010A78))
end

function ground()
	gui.text(0,276,"Slide Time: 22/" .. memory.read_s16_le(0x010DDC),"black","yellow")
	gui.text(0,292," Spin Time: 23/" .. memory.read_s16_le(0x010DDC),"black","yellow")
end

function water()
	gui.text(0,292," Spin Dur.: 24/" .. memory.read_s16_le(0x010DDC),"black","lime")
end

function neocortex()
	gui.drawBox(0,142,240,160,"null","black")
	gui.text(330,286,"Pixel X: " .. memory.read_u32_le(0x010A14))
	gui.text(330,300,"Pixel Y: " .. memory.read_u32_le(0x010A18))
	gui.text(180,286,"Speed X: " .. memory.read_s16_le(0x010A74))
	gui.text(180,300,"Speed Y: " .. memory.read_s16_le(0x010A78))
	gui.text(0,286,"Slide: 22/" .. memory.read_s16_le(0x010DDC),"black","yellow")
	gui.text(0,300," Spin: 23/" .. memory.read_s16_le(0x010DDC),"black","yellow")
end

function dingodile()
	local dshi = memory.readbyte(0x003EFC)
	gui.text(0,150,"Shield: " .. ((dshi == 1) and "ON" or "OFF"))
end

function warp_room()
	-- Mask Level Checking
	gui.text(175,30,"Mask Level: " .. memory.readbyte(0x00009C),"black","yellow")
end

while true do
	memory.usememorydomain("IWRAM")
	local area = memory.readbyte(0x1644)
	local areab = memory.readbyte(0x0830)

	if not (area == 11 or area == 13 or area == 14 or area == 15 or area == 16 or area == 17) then
		if area == 5 or area == 9 then
			gui.text(0,134,memory.read_s16_le(0x3F34),"black","orange")
		elseif area == 2 and areab == 1 or area == 18 then
			gui.text(0,134,memory.read_s16_le(0x1404),"black","yellow")
		else
			gui.text(0,134,memory.read_s16_le(0x082C),"black","yellow")
		end
	end


	memory.usememorydomain("EWRAM")
	local lvl = memory.readbyte(0x0000E8)

	if area == 16 then
		warp_room()
	elseif area == 9 then
		ngin()
	elseif lvl == 20 and area == 8 then
		dingodile()
	elseif area == 6 then
		bonus()
	elseif area == 5 or area == 9 then
		flying()
	elseif area == 10 then
		neocortex()
	else
		normal_lvl()
		if area == 1 or area == 8 then
			water()
		else
			ground()
		end
	end
	emu.frameadvance()
end
Spikestuff
on 4/4/2015 4:37 PM
I'm looking through this and it seems most things are not functioning the way it is supposed to be compared to 2.01.
Also please don't call it "2.1" as it's not that major of an update from the previous, call it 2.02 and mention what you modified because currently most things aren't functioning correctly to what it originally was.
To what it looks like everything was moved around and separated from each part and extra text added which just calls each part which isn't needed and in fact increases the file size.
Dica
on 4/4/2015 5:06 PM
Quoting Spikestuff
I'm looking through this and it seems most things are not functioning the way it is supposed to be compared to 2.01.
I only tested the ground/water levels (with bonus) and the warp room. Is there a problem with the bosses ?
Quoting Spikestuff
Also please don't call it "2.1" as it's not that major of an update from the previous, call it 2.02 and mention what you modified because currently most things aren't functioning correctly to what it originally was.
I didn't modify the header beceause this script should be considered as a "proposition", take what you want from it. About the changelog I'm currently writing it, I should post it on the forum in a few hours with other stuff (I can post it here if you want)
Quoting Spikestuff
To what it looks like everything was moved around and separated from each part and extra text added which just calls each part which isn't needed and in fact increases the file size.
About the functions I just like it that way. And the file size well... is that a problem ? I mean 1Kb our HDD can handle that, no ? :p
Spikestuff
on 4/4/2015 5:25 PM
Quoting Dica
I only tested the ground/water levels (with bonus) and the warp room. Is there a problem with the bosses ?
N.Gin Issue Flying Issue
Here's what the N.Gin one should look like: Linky, Link
Quoting Dica
I didn't modify the header because this script should be considered as a "proposition", take what you want from it. About the change-log I'm currently writing it, I should post it on the forum in a few hours with other stuff (I can post it here if you want)
This one is my fault, I checked the lua once again and it says "2.1" when I wrote it even though I was announcing it as "2.01", that was a typo on my hand in the lua.
Don't worry about posting the change log here, best for the forums.
Quoting Dica
About the functions I just like it that way. And the file size well... is that a problem ? I mean 1Kb our HDD can handle that, no ? :p
Oh, okay so this is a custom version of the lua script. Kinda read the description wrong on that one by the seems of things as I assumed it meant an update not an alternate version.
Since it is alternate version that means that Changing the X & Y Positions to 4byte was deliberate since the original is 2bytes.
Since you stated it is a custom version (being your style) I understand by the filesize being larger. The point of the main project is to keep is compact as possible but still showing each element of what is going within the lua.