+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Catrap / Pitman (Gameboy) Level Data
Pages: [1]
Author Topic: Catrap / Pitman (Gameboy) Level Data  (Read 1 times)
RadioShadow
Guest
« on: October 12, 2011, 05:35:15 pm »

After recently playing Catrap (Pitman), I was curious to see if anyone had made a level editor.  As far as I'm aware, there isn't one, so I might make one myself.

Well I got most of the data anyway.  The level data itself is stored in 33 bytes (thankfully not compressed).  3 bits (I think that's the term to use) represents 8 tiles.  I figured out how the game calculates the values, I just don't understand how the values are adding up.  I'm hoping it's something simple that I've overlooked.  Any ideas?

My notes are below.  This is for the US version.

-------------------------------------

Code:
C111 = Level Data (Where it gets loaded into RAM)

51BE = Round 1 (33 Bytes of Data)
51DF = Round 2
5200 = Round 3
5221 = Round 4
5242 = Round 5

C6A3 = Edit 1 (33 Bytes of Data)
C6C4 = Edit 2
C6E5 = Edit 3
C706 = Edit 4
C727 = Edit 5

Level 1 Data (ROM - Level Size 11 x 8)
B6 DB 6D B6 DB 6D B6 DB 6D B6 DB 6D B6 DB 6D B6
DA 00 00 00 2D 1C 20 C0 56 DB 6D A2 DB 6D B6 DB
6D                                             
                                       
Level 1 Data (RAM)
05 05 05 05 05 05 05 05 05 05 05 05 05 00 00 00
05 05 05 05 05 05 05 05 05 05 05 05 05 00 00 00
05 05 05 05 05 05 05 05 05 05 05 05 05 00 00 00
05 05 05 05 05 05 05 05 05 05 05 05 05 00 00 00
05 05 00 00 00 00 00 00 00 00 00 05 05 00 00 00
05 05 00 10 00 02 00 03 00 00 02 05 05 00 00 00
05 05 05 05 05 05 05 05 00 05 05 05 05 00 00 00
05 05 05 05 05 05 05 05 05 05 05 05 05 00 00 00
05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05
05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05

Notes:
Level Size - 13 x 9 = 130
Level Size [Edit Mode] 11 x 8 = 88

The data is sort of like a compression. 
3 bytes covers 8 tiles.
3 bits covers 4 tiles.         

ID:
0 = Nothing (NT)
2 = Stairs (ST)
4 = Monster (MO)
6 = Rock (RC)
8 = Sand (SD)
A = Wall (WL)
C = Ghost (GH)
E = Player (PL)

Note: There are three different monster images, Mummy, Frankeinstain and Ghost.
      They all use the same value (4) and act the same.  Depending on the level,
      the game loads the required graphics for that monster.   

Tile1 = ID
Tile2 = Tile1 + (ID * 2)
Tile3 = Tile2 + ((ID * 2) * 2)
Tile4 = Tile3 + (ID / 2)

Examples:
PL = E00

ST + ST = 200 + (2 * 2 = 04) = 240
PL + PL = E00 + (E * 2 = 1C) = FC0
ST + WL = 200 + (A * 2 = 14) = 340
WL + WL = A00 + (A * 2 = 14) = B40

WL + WL + WL = A00 + (A * 2 = 14) = B40 + (A * 2 = 14 * 2 = 28) = B68
GH + SD + PL = C00 + (8 * 2 = 10) = D00 + (E * 2 = 1C * 2 = 38) = D38

GH + SD + PL + PL = C00 + (8 * 2 = 10) = D00 + (E * 2 = 1C * 2 = 38) = D38 + (E / 2 = 7) = D3F
RC + ST + GH + MO = 600 + (2 * 2 = 04) = 640 + (C * 2 = 18 * 2 = 30) = 670 + (4 / 2 = 2) = 672

---------------------

E80 = PL + MO
EC0 = PL + RC
FC0 = PL + PL

FD0 = PL + PL + MO
B68 = WL + WL + WL

D3F = GH + SD + PL + PL
Jigglysaint
Guest
« Reply #1 on: October 15, 2011, 10:24:34 pm »

Actually the compression is pretty simple.  You are right that 3 bytes does equal 8 tiles, but as it works, 3 bits is for one tile, and it's the tile Id.  From 000 to 111, you get exactly 8 tile ID's.  To make it easier to encode, start from the rightmost byte.  Let's say that you wanted to make 8 tiles full of ladders, which is tile ID 01.  Start at the right, and start with 00000001(which is 01).  To make the next tile to the left the same ID, find in the bits where the next group of 3 start, keeping in mind that the game reads bits from right to left.  That would make it 00001001, which is 09.  To make the NEXT tile the same Id, find the next 3 bits.  That makes it 01001001, which is 49.  The next byte to the left keeps the same pattern, minding of course that since the entire thing is read as a series of 24 bits, not 3 separate bytes, the next byte will assume the sequence of bits is carried over.  That means to make the next set of tiles all ladders, you need 10010010, which you notice that if you continued to the right you would get the same value as the third byte.  The last byte continues the same pattern.  basically you end up with 00100100 10010010 01001001.  So to get the tile ID's you want, you start from the right, assign each 3 byte sequence a value from 000 to 111(00 to 07) and just repeat keeping in mind you are assigning bits, not bytes.
RadioShadow
Guest
« Reply #2 on: October 17, 2011, 12:47:28 pm »

That makes more sense!  That means I've got to look into binary converting for Visual Basic 6.0. 

Code:
ID (Hex - Binary):
00 = 000 = Nothing
01 = 001 = Stairs
02 = 010 = Monster
03 = 011 = Rock
04 = 100 = Sand
05 = 101 = Wall
06 = 110 = Ghost
07 = 111 = Player

Example:
P   M   M   R   S   G   G   P
111 010 010 011 001 110 110 111

11101001 00110011 10110111
E9       33       B7
rmco2003
Guest
« Reply #3 on: October 17, 2011, 01:31:07 pm »

How come you're using VB6? .NET's much easier to use for making hacking tools, and the IDE's free
Pages: [1]  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC