User File #7607996750340582

Upload All User Files

#7607996750340582 - Modified Jetpack Script

jetpackx.lua
1203 downloads
Uploaded 6/30/2013 2:38 PM by slamo (see all 61)
dofile("textrender.lua");

lagged = 0;
totalframes = 0;
lastxpos = 0;
lastypos = 0;
lastfcnt = 0;
deltaxpos = 0;
deltaypos = 0;

linear_transform = function(x, a, b)
	return (math.floor(a / 65536) * (x % 65536) * 65536 + (a % 65536) * x + b) % 4294967296;
end

rng_state_to_index = function(state)
	local A = 0x2925141D;
	local B = 0xD6DAEBE3;
	local C = 1;
	local D = 2;
	local i;
	local j = 0;
	for i=0,31 do
		if (state % D) ~= 0 then
			state = linear_transform(state, A, B);
			j = j + C;
		end
		B = linear_transform(A, B, B);
		A = linear_transform(A, A, 0);
		C = C * 2;
		D = D * 2;
	end
	return j;
end


while true do
	a, b = jpcrr.wait_event();
	if a == "lock" then
		xpos = jpcrr.read_word(0x25CA3);
		ypos = jpcrr.read_word(0x25CA1);
		fuel = jpcrr.read_word(0x27040);
		rng = jpcrr.read_dword(0x25872);
		fcnt = jpcrr.frame_number();
		jpcrr.hud.top_gap(3, 16);
		jpcrr.hud.right_gap(3, 32);
		text = string.format("Pos: (%3u,%3u)/(%+3d,%+3d) Fuel: %5u rng: [%08x]%d", xpos, ypos, deltaxpos,
			deltaypos, fuel, rng, rng_state_to_index(rng)-2357709760);
		render_text(3, 0, 0, text, false, 0, 255, 0);
		render_text(3,((xpos/16)-15),((ypos/16)+2),"[]", false, 0, 255, 0);
		render_text(3,((xpos/16)-15),((ypos/16)-11),"[]", false, 0, 255, 0);
		if fcnt ~= lastfcnt then
			deltaxpos = xpos - lastxpos;
			deltaypos = ypos - lastypos;
			lastxpos = xpos;
			lastypos = ypos;
			lastfcnt = fcnt;
		end
		for i=1,25 do
			rng = linear_transform(rng, 0x15a4e35, 1);
			ran = math.floor(rng / 65536) % 32768;
			render_text(3, 640, i * 16, string.format("%04X", ran), false, 255,
				255, 0);
		end
		jpcrr.release_vga();
	end
end


--Candidate: 00025872[14cf5194]
--Candidate: 00025873[1014cf51]
--Candidate: 00025A46[18501dee]
--Candidate: 00025DC0[56f9df66]
--Candidate: 00025DC1[b056f9df]
--Candidate: 00025DC2[0db056f9]
--Candidate: 00026E37[f0227d01]