Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Some LUA tryouts by DrBaldhead. Tested on FCEUX. TMNT Tournament Fighters US version.
- -- Displays:
- -- Players positions
- -- The ball position
- -- Calculated distance between the characters
- -- P2 fatigue timer
- local P1XAddr = 0x0440
- local P1YAddr = 0x0410
- local P2XAddr = 0x0441
- local P2YAddr = 0x0411
- -- These ball coordinates are not final. When the ball isn't present in the arena, these coords are equal to P2 position.
- -- Also they are used by the ball dispenser while it flies across the screen. So it's not certain that these are the main addrs for the data.
- local BallXAddr = 0x0002
- local BallYAddr = 0x0001
- -- The game tries to calculate this value as a kind of a distance between the players.
- -- Generally it equals the diff between players X positions minus 24 pixels and never drops below zero.
- -- Right now I don't actually use it.
- local EnemyDistAddr = 0x0638
- -- Each player has a kind of a fatigue counter. When this counter changes by a certain amount,
- -- the character falls down and stands stunned for a while.
- -- Some attacks seem to drop the counter. All successful hits change the counter. Some attacks never trigger the fatigue stun.
- -- Those that do must be successfully landed not less often than each 79 frames
- -- Some attacks affect the counter more than the others. For example Don's roundhouse kick can sometimes cause an instant stun.
- -- (but usually counts as a dash kick which stuns on the second successful hit)
- -- Raph's far punch and far kick can stun in two hits (he's actually the top in terms of melee power).
- -- Character power can affect this mechanics. Using game genie to raise it beyond the maximum can make all melee hits trigger fatigue stun instantly.
- -- This Addr is not final. Also I'm not sure whether it's 8-bit or 16-bit value. It looks much more reasonable when watched
- -- as a byte at 0x00B1, but the byte at 0x00B0 is also changing. Or maybe it's actually two different timers?
- local P2FatiqueAddr = 0x00B0
- local P1X = 0
- local P1Y = 0
- local P2X = 0
- local P2Y = 0
- local P2Fatique = 0
- local P2FatiqueStored = 0xFFFF
- local P2FatiqueTimer = 0
- local BX = 0
- local BY = 0
- local EnemyGapLeft = 0
- local EnemyGapRight = 0
- P2Fatique = memory.readword(P2FatiqueAddr)
- P2FatiqueStored = P2Fatique
- while true do
- -- Memory scanning
- P1X = memory.readbyte(P1XAddr)
- P1Y = memory.readbyte(P1YAddr)
- P2X = memory.readbyte(P2XAddr)
- P2Y = memory.readbyte(P2YAddr)
- BX = memory.readbyte(BallXAddr)
- BY = memory.readbyte(BallYAddr)
- EDIST = memory.readbyte(EnemyDistAddr)
- P2Fatique = memory.readword(P2FatiqueAddr)
- -- Draw horizontal
- gui.line(P1X, 1, P1X, 239)
- gui.line(P2X, 1, P2X, 239, "cyan")
- -- Draw vertical
- gui.line(1, P1Y, 255, P1Y)
- gui.line(1, P2Y, 255, P2Y, "cyan")
- -- Draw the distance
- if P2X > P1X then
- EnemyGapLeft = P1X + 12
- EnemyGapRight = P2X - 12
- else
- EnemyGapLeft = P2X + 12
- EnemyGapRight = P1X - 12
- end
- if EnemyGapRight > EnemyGapLeft then
- gui.line(EnemyGapLeft, 130, EnemyGapLeft, 150)
- gui.line(EnemyGapRight, 130, EnemyGapRight, 150)
- gui.line(EnemyGapLeft,140, EnemyGapRight,140)
- end
- -- Draw the ball
- if (BY ~= P2Y) and (BX ~= P2X) and (BX > 3) and (BX < 250) and (BY > 3) and (BY < 237) then
- gui.line(BX, BY-3, BX, BY+3, "green")
- gui.line(BX-3, BY, BX+3, BY, "green")
- end
- -- Fatique analysis P2
- if P2Fatique == P2FatiqueStored then
- if P2FatiqueTimer > 0 then
- P2FatiqueTimer = P2FatiqueTimer-1
- end
- else
- P2FatiqueTimer = 79
- P2FatiqueStored = P2Fatique
- end
- -- Draw P2 fatique
- if P2FatiqueTimer > 0 then
- gui.drawbox(136, 41, (P2FatiqueTimer + 136), 43, "white", "white")
- gui.text(136, 45, "Fatique!", "white", "black")
- end
- -- Go on then
- emu.frameadvance()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement