User File #60761155603271726

Upload All User Files

#60761155603271726 - Kirby Super Star Ultra - view info lua

KSSU_info.lua
381 downloads
Uploaded 1/19/2020 9:05 AM by WaddleDX (see all 6)
This script shows: - speed and position(include subpixel) - invincible time - boss damage
-- DeSmuME Memory Watching (on Kirby Super Star Ultra)

function draw_text(str, color)
	gui.text(x_offs, y_offs + h*ind, str, color)
	ind = ind + 1
end
	
function draw_nocol(str)
	draw_text(str, "white")
end

-- preset

-- draw text
function drawtxt()
	local p1_spd_add = memory.readdword(0x020ba428)
	local p2_spd_add = memory.readdword(0x020bac44)
	
	local p1_xspd = memory.readshortsigned(p1_spd_add)
	local p1_yspd = memory.readshortsigned(p1_spd_add + 2)
	local p2_xspd = memory.readshortsigned(p2_spd_add)
	local p2_yspd = memory.readshortsigned(p2_spd_add + 2)
	
	local p1_xpos = memory.readshortunsigned(0x020ba454)
	local p1_ypos = memory.readshortunsigned(0x020ba456)
	local p2_xpos = memory.readshortunsigned(0x020bb26e)
	local p2_ypos = memory.readshortunsigned(0x020bb272)
	
	local p1_xspx = memory.readbyte(0x020baa99)
	local p1_yspx = memory.readbyte(0x020baa9d)
	local p2_xspx = memory.readbyte(0x020bb26d)
	local p2_yspx = memory.readbyte(0x020bb271)
	
	local bosshp = memory.readshortsigned(0x0209ef90)
	local isInvincible = memory.readshortunsigned(0x020ba5cc)
	
	local cam_x = memory.readshortunsigned(0x0209e2e0)
	local cam_y = memory.readshortunsigned(0x0209e2e2)
	
	ind = 0
	x_offs = 2
	y_offs = 4
	h = 12
	
	local bg_ofsx = -4
	local bg_ofsy = -4
	local bg_w = 102
	local bg_h = 140
	
	gui.box(x_offs + bg_ofsx, y_offs + bg_ofsy, x_offs + bg_ofsx + bg_w, y_offs + bg_ofsy + bg_h, 0x00000099, "clear")
	
	draw_text("1P:", "red")
	draw_nocol(" Xspd = " .. p1_xspd)
	draw_nocol(" Yspd = " .. p1_yspd)
	draw_nocol(" Xpos = " .. p1_xpos .. ":" .. p1_xspx)
	draw_nocol(" Ypos = " .. p1_ypos .. ":" .. p1_yspx)
	
	ind = 6
	if memory.readbyte(0x020bab38) > 0 then
		draw_text("2P:", "green")
		draw_nocol(" Xspd = " .. p2_xspd)
		draw_nocol(" Yspd = " .. p2_yspd)
		draw_nocol(" Xpos = " .. p2_xpos .. ":" .. p2_xspx)
		draw_nocol(" Ypos = " .. p2_ypos .. ":" .. p2_yspx)
	end
	if bosshp >= 0 then
		gui.text(200, -14, string.format("%3d", bosshp))
	end
	
	-- draw Invincible time
	
	local timeVal = 1320
	local box_x = 224
	local box_y = 64
	local box_w = 24
	local box_h = 108
	local ol = 1
	local bar_h = box_h - ol * 2
	
	gui.text(box_x - 4, box_y + box_h + 4, "MUTEKI")
	if isInvincible > 0 then
		gui.box(box_x, box_y + (bar_h - bar_h * isInvincible / timeVal), box_x + box_w, box_y + box_h, 0x0000ffcc, "clear")
	end
	gui.box(box_x, box_y, box_x + box_w, box_y + box_h)
	gui.text(box_x + 4, box_y + box_h / 2 - 2, string.format("%3d", isInvincible))
end

gui.register(drawtxt)