User File #21888782487052199

Upload All User Files

#21888782487052199 - [lua]Crash Bandicoot Huge Adventure v2

lua.lua
1262 downloads
Uploaded 4/4/2015 5:59 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()
	memory.usememorydomain("IWRAM")
	-- Flying Cooldown
	local cooldwn = memory.readbyte(0x14E0)-1
	if cooldwn ~= -1 then
		gui.text(0,118,"Cooldown: " .. cooldwn)
	end
end

function ngin()
	memory.usememorydomain("IWRAM")
	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
	flying()
	memory.usememorydomain("EWRAM")
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