User File #35034290461828603

Upload All User Files

#35034290461828603 - Crash object lua WIP

Crash Bandicoot - The Huge Adventure (USA).lua
692 downloads
Uploaded 11/16/2016 6:16 PM by TASeditor (see all 188)
TODO: lots of stuff I can't figure out.

function Objects()
	
	memory.usememorydomain("EWRAM")
	
	-- $C pointer to last objext? 
	
	obj = memory.read_u32_le(0xC) - 0x02000000
	next_obj = memory.read_u32_le(obj+0xC) - 0x02000000
	--console.log(tostring(string.format("%X",next_obj)))
	obj = next_obj
	
	local xcam = memory.read_u32_le(0x6E8C)
	local ycam = memory.read_u32_le(0x6E90)
	
	
	i=0		
	while i < 6 do -- when does the objects list end?
	
		--console.log(tostring(string.format("%X",obj)))
		
		local alloc_mem = memory.read_u32_le(obj)
		local prev_obj = memory.read_u32_le(obj+8) - 0x02000000
		local next_obj = memory.read_u32_le(obj+0xC) - 0x02000000
		
		local xpos = memory.read_u32_le(obj+0x10)
		local ypos = memory.read_u32_le(obj+0x14)
		
		
		
		gui.drawText(xpos/256-xcam, ypos/256-ycam, "O")
		
		--addr = addr + 4 
		--
		obj = next_obj
		--obj = memory.read_u32_le(addr) - 0x02000000
		
		i = i + 1
	end
	
--console.log("aestet")
end

while true do
	
	Objects()
	

		
	--Player stuff: should be for most other objects the same
	--pntrnext?	 130CC 4h
	--pntrprev?	 130D0 4h
	
	--xpos 		 130D4 4u
	--ypos 		 130D8 4u
	
	
	--state		 130F8 1b
	--anim 		 13104 1u
	--anim timer 13108 1u
	
	--xstartspd	 1311C 2s
	--x acceler	 13120 2s
	--x max spd  13124 2s
	
	--x speed	 13134 2s
	
	--xpos old	 13140 4u
	--ypos old	 27648 4u
	
	
	emu.frameadvance();
end