Cave Story Functions List

Aug 7, 2010 at 1:46 PM
Hoxtilicious
"Life begins and ends with Nu."
Join Date: Dec 30, 2005
Location: Germany
Posts: 3218
Age: 33
Pronouns: No homie
Aug 7, 2010 at 2:25 PM
Senior Member
"Wahoo! Upgrade!"
Join Date: Nov 8, 2009
Location: Test chamber №7
Posts: 59
Age: 37
Whoa... Nice...
Good job, even if this useless for me (or not?)
 
Aug 7, 2010 at 4:28 PM
Not anymore
"Run, rabbit run. Dig that hole, forget the sun."
Join Date: Jan 28, 2010
Location: Internet
Posts: 1369
Age: 34
Pronouns: he/him
This is pretty large. Very nice; seems like it'll be quite useful.
 
Aug 7, 2010 at 6:08 PM
Pirate Member
"Heavy swords for sale. Suitable for most RPG Protagonists. Apply now!"
Join Date: Dec 26, 2007
Location: Lithuania
Posts: 1946
That's pretty big. It will be helpful.
 
Aug 7, 2010 at 6:46 PM
Banned
"Bleep, Bloop, Bleep, Bloop"
Join Date: Mar 1, 2009
Location:
Posts: 1586
Age: 29
Hey, it's that thing I never finished.
 
Aug 7, 2010 at 10:48 PM
In my body, in my head
Forum Moderator
"Life begins and ends with Nu."
Join Date: Aug 28, 2009
Location: The Purple Zone
Posts: 5998
Pronouns: he/him
Now this is what I'm talking about..
would it be alright if I posted some more and then you can add them?
Cuz I'm going to do it anyway :0

401D10 - Inventory menu logic
4023D0 - Background code
403DC0 - Render bullets
40ACB0 - Render effect objects
40C5B0 - Draw object (like 40c3c0 but used for Backgrounds)
40C7A0 - Another drawing function like the two above, used for the damage #s
40CA80 - I think it has something to do with 'undrawing'... closely related to 40C7A0
40F380 - Render numbers for level, HP and ammo
410400 - Main Gameplay function {While (1) loop begins 4104C3}
410DE0 - Generate error message
4112E0 - loads a file (forgot what kind)
411390 - Load image resources for game (called at startup)
413AF0 - Render background layer tiles
413C60 - Render foreground layer tiles
414250 - Render <MNA
415250 - Render Player and gun
418C10 - Tests collision, treats entity as solid.
4196F0 - Called when player touches an XP chip
41A0B0 - Render Weapon Icons
425BF0 - Create damage / XP number objects
46F150 - Create explosion
46F810 - Render entities
481010 - Join two strings
I think that's all I've got in my little scribbler that I haven't actually shared with anyone yet. This is kinda fun so I'm just going to spend the next little while documenting some of the functions in 410400 that I didn't actually write down.

EDIT: Here's some more.
402830 - Render map background if [499C88] == 3
4029B0 - Most likely detects collision between bullets and star blocks
40E770 - Render the graphics for the <FAO/<FAI effect
419D10 - Render XP bar, weapon level & weapon ammo displays
41A1D0 - Render HP bar, HP numbers
41A430 - Render Nikumaru Counter timer
41AD20 - Regulates the volume on Org notes?
41ADC0 - Plays Org notes?
41B3F0 - Related to loading the Org file
41B510 - Plays the drum sound of an Org file
41BAD0 - Loads an ORG file
41C0B0 - Dummied out function, most likely ORG-related. Possibly to do with 'pi' functionality missing from CS but that's just a hunch.
41C2B0 - Probably the main 'engine' of the Org player as removing it leaves only SFX
41C630 - Related to loading the Org file
41C880 - Sets [4A4E10] = 1
420240 - Loads wav data for drums (normally dummied out)
421F10 - Render textboxes, item images, text.

Also, the things you have labelled as 'data' look to be mostly switch tables and indices to switch tables.. I don't think they really need their own distinction since they typically are associated with the function directly preceeding them.
 
Aug 8, 2010 at 2:25 PM
Hoxtilicious
"Life begins and ends with Nu."
Join Date: Dec 30, 2005
Location: Germany
Posts: 3218
Age: 33
Pronouns: No homie
Update!

Thanks Noxid.
These functions don't exist:

40ACB0 - Render effect objects
410400 - Main Gameplay function {While (1) loop begins 4104C3}
418C10 - Tests collision, treats entity as solid.

Also, what do you mean by that description:

4023D0 - Background code
40C5B0 - Draw object (like 40c3c0 but used for Backgrounds)
425BF0 - Create damage / XP number objects

Noxid said:
Also, the things you have labelled as 'data' look to be mostly switch tables and indices to switch tables.. I don't think they really need their own distinction since they typically are associated with the function directly preceeding them.

You need to be 100% sure, before I will edit something :o
Also, what are switch tables?
 
Aug 8, 2010 at 9:41 PM
In my body, in my head
Forum Moderator
"Life begins and ends with Nu."
Join Date: Aug 28, 2009
Location: The Purple Zone
Posts: 5998
Pronouns: he/him
As for the functions you say don't exist:

40ACB0 - That was a typo, it's really 40ABC0.
410400 - That's definitely a function! There's just no padding 'CC' bytes between it and the switch table of the previous function because it just happened to line up nicely that way. Here's proof:
p107559-0-410400.png
418C10 - Another typo, it should be 418C20

Clarification:
4023D0 - It basically contains the logic for each of the background types - it contains the thing that makes the scrolling ones scroll, and the static ones static, and... well you get the point. It also contains the calls to draw them to the screen.
40C5B0 - It's basically the *exact* same as 40C3C0 but the difference is where 3C0 uses a masked blit that makes black transparent 5B0 just does a straight blit so black will show up. Probably slightly faster and since backgrounds are the bottom layer that's why it's used for those.
425BF0 - Well, if you dummy out this function, then the numbers that appear when you take damage ('-127' for instance) or collect Xp triangles no longer appear. I think that these things might be their own type of object althought that is just a hunch; all I know for sure is this makes them appear.

A switch jump is a tool used in assembly to jump to different segments of code based on the value of a certain variable; the table is the list of possible offsets that can be jumped to. In the picture above you can see the switch table for 40FB90 located at 4103EC; the jump is at 41013E, here's a picture of it.
p107559-1-41013e.png

And this is what the setup of an indexed switch table looks like;
p107559-2-4038d0.png

Indexes to switch tables look almost the same but instead of a sequence of 4-byte things it's a sequence of 1-byte things that tell which 4-byte address to jump to... it's kind of hard to explain but I hope that makes sense.

And as far as I know, switch tables are the *only* kind of 'data' that's located in the code segment of the .exe
 
Aug 16, 2010 at 1:09 AM
In my body, in my head
Forum Moderator
"Life begins and ends with Nu."
Join Date: Aug 28, 2009
Location: The Purple Zone
Posts: 5998
Pronouns: he/him
Here are some more related to the tile collision engine.

417E40 - Run Tile Collision Check(Player)

All of the following functions have two Parameters: PUSH Tile Y location, PUSH Tile X location
4139A0 - Get Tile Type #
416E30 - PlayerTileCollision Type 1, Type 0C {Solid}
4171D0 - PlayerTileCollision Type 3, Type 0E {RoofSlopeL1}
4172E0 - PlayerTileCollision Type 4, Type 0F {RoofSlopeL2}
4173F0 - PlayerTileCollision Type 5, Type 10 {RoofSlopeR1}
417500 - PlayerTileCollision Type 6, Type 11 {RoofSlopeR2}
417610 - PlayerTileCollision Type 7, Type 12 {FloorSlopeL1}
417720 - PlayerTileCollision Type 8, Type 13 {FloorSlopeL2}
417830 - PlayerTileCollision Type 9, Type 14 {FloorSlopeR1}
417940 - PlayerTileCollision Type A, Type 15 {FloorSlopeR2}
417A50 - PlayerTileCollision Type 0, Type 0B, Type 0C, Type 0E, Type 0F, Type 10, Type 11, Type 12, Type 13, Type 14, Type 15, Type 1A, Type 1B, Type 1C, Type 1D {Water}
417AE0 - PlayerTileCollision Type 2 {Spike}
417B70 - PlayerTileCollision Type 0D {Spike (water)}
417C00 - PlayerTileCollision Type 16, Type 1A {Wind, Left}
417C90 - PlayerTileCollision Type 17, Type 1B {Wind, Up}
417D20 - PlayerTileCollision Type 18, Type 1C {Wind, Right}
417DB0 - PlayerTileCollision Type 19, Type 1D {Wind, Down}
Type 1E - No Check Run
Array of Tile Types: (Player)
First pair represents tile # 0, 2nd is tile # 1, etc... (rows of 16)
-- -- 00 1E 1E 01 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E
1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E
1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E
1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E
1E 01 02 01 1E 1E 01 1E 1E 1E 1E 1E 1E 1E 1E 1E
03 04 05 06 07 08 09 0A 1E 1E 1E 1E 1E 1E 1E 1E
0B 0C 0D 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E
0E 0F 10 11 12 13 14 15 1E 1E 1E 1E 1E 1E 1E 1E
16 17 18 19 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E
1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E
1A 1B 1C 1D
Tiles #00 and #01 completely bypass the check (No Action taken)

Bonus Function - 416D80 - Play Environmental Sounds (Propeller sound and Stream Sound)
Oh, also, you should know that all the functions are aligned on the 0x10's, so if it doesn't end in a zero, it probably isn't a function (Unless it occurs after the program entry point, in which case it could be one of those funny library functions)
EDIT: If I wasn't the only one doing this, we might actually be able to, you know, fill the list up >_>
 
Back
Top