User File #37255127217619424

Upload All User Files

#37255127217619424 - Crash Bandicoot Huge Adventure - lua v2.11b

CrashGBA - v2.11b BizHawk.lua
1012 downloads
Uploaded 2/24/2017 6:39 PM by Spikestuff (see all 287)
-- Crash Huge Adventure lua v2.11b 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, Dica

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),"orange")
	gui.text(0,292," Spin Time: 23/" .. memory.read_s16_le(0x0111F4),"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),"yellow")
	gui.text(0,292," Spin Time: 23/" .. memory.read_s16_le(0x010DDC),"yellow")
end

function water()
	gui.text(0,292," Spin Dur.: 24/" .. memory.read_s16_le(0x010DDC),"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),"yellow")
	gui.text(0,300," Spin: 23/" .. memory.read_s16_le(0x010DDC),"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),"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),"orange")
		elseif area == 2 and areab == 1 or area == 18 then
			gui.text(0,134,memory.read_s16_le(0x1404),"yellow")
		else
			gui.text(0,134,memory.read_s16_le(0x082C),"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