Quick Modding/Hacking Answers Thread

Jan 28, 2017 at 5:30 AM
Veteran Member
"Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-BLEIUP"
Join Date: Sep 21, 2014
Location:
Posts: 341
Age: 23
Pronouns: he/him
Cave story runs in a stretched 16:9 aspect ratio, I want it to run in 4:3 with borders
 
Jan 28, 2017 at 6:44 AM
me when bro says be holly and jolly for $20
"Life begins and ends with Nu."
Join Date: Jun 27, 2013
Location:
Posts: 2852
Age: 30
Pronouns: She/Her
Have you tried not playing the game in full screen?
 
Jan 28, 2017 at 2:09 PM
Veteran Member
"Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-BLEIUP"
Join Date: Sep 21, 2014
Location:
Posts: 341
Age: 23
Pronouns: he/him
This happens when I play the game in fullscreen
 
Jan 28, 2017 at 2:12 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
Jan 29, 2017 at 1:01 AM
Veteran Member
"Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-BLEIUP"
Join Date: Sep 21, 2014
Location:
Posts: 341
Age: 23
Pronouns: he/him
The aspect ratio isn't stretched when I play other games, it's only cave story
 
Jan 29, 2017 at 2:40 AM
Bonds that separate us
Forum Administrator
"Life begins and ends with Nu."
Join Date: Aug 20, 2006
Location:
Posts: 2859
Age: 34
Pronouns: he/him
Cave Story is old and wasn't designed to handle widescreens, everyone with one (including me) has to play windowed or put up with this afaik
 
Jan 29, 2017 at 4:27 AM
Soup Man
"In Soviet Russia, graves keep YOU!"
Join Date: Jul 15, 2014
Location: IN YOUR HEAD, SHIT FOR BRAINS
Posts: 670
Age: 8
Pronouns: she/her
Is there an "Explosion" entity? Like the explosion from the missile launcher? If there is, what number? I want Balrog to turn into an explosion via <ANP command after you beat him, but am too lazy to look through all the entities.
 
Jan 30, 2017 at 6:54 AM
Luls
"Bleep, Bloop, Bleep, Bloop"
Join Date: Oct 6, 2007
Location: I dunnos
Posts: 1584
Is there an "Explosion" entity? Like the explosion from the missile launcher? If there is, what number? I want Balrog to turn into an explosion via <ANP command after you beat him, but am too lazy to look through all the entities.
You could try using <CNP to change balrog into a smoke puff (ID 0004) and use <SOU to play an explosion sound? There isn't an ANP command to explode balrog as far as my memory goes.

MY TURN!

In Noxid's Assembly Compendium, there're some lines written like this:

Code:
#Weapon stuff [MISCWEP]

0x00401FA0 Weapon Ammo reduction code.
(this is for bullets)
0499C98 WeaponObj[0x00].Collision +0x00 [01:WallL 02:WallR 04:WallT 08:WallB 10: 20: 40: 80: ] x 0x80
00499C9C WeaponObj[0x00].ShotID +0x04 [6=GunLv3, 8=FireballLv2... Hell, see table.]
00499CA0 WeaponObj[0x00].Flags +0x08 [01:??? 02:??? 04:Ignore_Wall 08:Climb_Slope 10:??? 20:??? 40:??? 80:???]
00499CA4 WeaponObj[0x00].InUse +0x0C [0x80: in use]
00499CA8 WeaponObj[0x00].X +0x10
00499CAC WeaponObj[0x00].Y +0x14
00499CB0 WeaponObj[0x00].MoveX +0x18
00499CB4 WeaponObj[0x00].MoveY +0x1C
...
00499CEC WeaponObj[0x00].MaxDistance +0x54 [how long the "particle" lives]
00499CF0 WeaponObj[0x00].Damage +0x58
00499CF4 WeaponObj[0x00].NumImpacts +0x5C
...

Bullet IDs
1 - Snake L1
2 - Snake L2
3 - Snake L3
4 - Polar Star L1
5 - Polar Star L2
6 - Polar Star L3
7 - Fireball L1
...

So if I wanna access maybe the Polar Star's L1 bullet's MaxDistance
Code:
00499CEC WeaponObj[0x00].MaxDistance +0x54 [how long the "particle" lives]
How should I go about using the bullet ID to get to the address containing this value? What does this notation even mean? HAlp pls!
 
Jan 30, 2017 at 10:26 AM
Bonds that separate us
Forum Administrator
"Life begins and ends with Nu."
Join Date: Aug 20, 2006
Location:
Posts: 2859
Age: 34
Pronouns: he/him
You can edit weapon things like weapon damage and projectile life (distance) very easily in Booster's Lab these days using the hacking tool from the top menu. Some other parameters like projectile speed are still harder to change because they're calculated differently for each weapon.
 
Jan 30, 2017 at 10:54 AM
Luls
"Bleep, Bloop, Bleep, Bloop"
Join Date: Oct 6, 2007
Location: I dunnos
Posts: 1584
What I'm actually trying to find is the piece of assembly code that governs the "death" of a bullet (when the bullet reaches its max distance and *pops* out of existence, or collides with a wall) with the intention of writing a function that runs when that happens. I figured I could use one of those offsets such as "0499C98 WeaponObj[0x00].Collision" to monitor the state the bullet is currently in and trigger upon some change in that state, but I have no idea how to use them.

I notice that there are some polar star variations that the Hackinator in Booster's Lab offers, where the polar star bullet changes at the end of its projectile life (to split into more bullets, or change into another bullet type), but upon examining the assembly code and comparing it to the original polar star assembly code, it's a complete re-write and not just a change in the function called upon bullet "death".

I'm pretty sure there must be a function that draws the little *pop* sprite that appears when the polar star bullet dies, and that I may be able to branch another function from it, but I can't seem to find it...
 
Jan 30, 2017 at 1:20 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
well there's a few parts to this, and you may find https://dl.dropboxusercontent.com/u/42853625/FunctionlistNox.txt helpful
there's a generic function at 402F50 for bullets colliding with walls and 4029B0 for colliding with starblocks but when it comes to bullet lifespan timeout each projectile handles that in its own code. So for example with the polar star
Code:
004047C8  |.  8B4D 08       MOV ECX,[EBP+8]
004047CB  |.  8B50 4C       MOV EDX,[EAX+4C]
004047CE  |.  3B51 54       CMP EDX,[ECX+54]
004047D1  |.  7E 29         JLE SHORT Doukutsu.004047FC
004047D3  |.  8B45 08       MOV EAX,[EBP+8]
004047D6  |.  C740 0C 00000>MOV DWORD PTR [EAX+C],0
004047DD  |.  6A 00         PUSH 0                                   ; /Arg4 = 00000000
004047DF  |.  6A 03         PUSH 3                                   ; |Arg3 = 00000003
004047E1  |.  8B4D 08       MOV ECX,[EBP+8]                          ; |
004047E4  |.  8B51 14       MOV EDX,[ECX+14]                         ; |
004047E7  |.  52            PUSH EDX                                 ; |Arg2
004047E8  |.  8B45 08       MOV EAX,[EBP+8]                          ; |
004047EB  |.  8B48 10       MOV ECX,[EAX+10]                         ; |
004047EE  |.  51            PUSH ECX                                 ; |Arg1
004047EF  |.  E8 9C640000   CALL Doukutsu.0040AC90                   ; \Doukutsu.0040AC90
004047F4  |.  83C4 10       ADD ESP,10
004047F7  |.  E9 FA020000   JMP Doukutsu.00404AF6
where 40AC90 is the function to create an effect object.
 
Jan 30, 2017 at 4:29 PM
Luls
"Bleep, Bloop, Bleep, Bloop"
Join Date: Oct 6, 2007
Location: I dunnos
Posts: 1584
Oooh alrighty, I'll do some playing around with that part of the code then.

Tys!
 
Feb 6, 2017 at 1:36 AM
Luls
"Bleep, Bloop, Bleep, Bloop"
Join Date: Oct 6, 2007
Location: I dunnos
Posts: 1584
Yos!

This is a question about NPC and frame-rect drawing and calling.

Here's a huge chunk of code that I'm gonna reference here for this question - the original code for entity 80 - the Gravekeeper:
Code:
CPU Disasm
Address   Hex dump          Command                                  Comments
00436AE0  /$  55            PUSH EBP
00436AE1  |.  8BEC          MOV EBP,ESP
00436AE3  |.  81EC E4000000 SUB ESP,0E4
00436AE9  |.  C745 90 00000 MOV DWORD PTR SS:[EBP-70],0
00436AF0  |.  C745 94 40000 MOV DWORD PTR SS:[EBP-6C],40
00436AF7  |.  C745 98 18000 MOV DWORD PTR SS:[EBP-68],18
00436AFE  |.  C745 9C 58000 MOV DWORD PTR SS:[EBP-64],58
00436B05  |.  C745 A0 18000 MOV DWORD PTR SS:[EBP-60],18
00436B0C  |.  C745 A4 40000 MOV DWORD PTR SS:[EBP-5C],40
00436B13  |.  C745 A8 30000 MOV DWORD PTR SS:[EBP-58],30
00436B1A  |.  C745 AC 58000 MOV DWORD PTR SS:[EBP-54],58
00436B21  |.  C745 B0 00000 MOV DWORD PTR SS:[EBP-50],0
00436B28  |.  C745 B4 40000 MOV DWORD PTR SS:[EBP-4C],40
00436B2F  |.  C745 B8 18000 MOV DWORD PTR SS:[EBP-48],18
00436B36  |.  C745 BC 58000 MOV DWORD PTR SS:[EBP-44],58
00436B3D  |.  C745 C0 30000 MOV DWORD PTR SS:[EBP-40],30
00436B44  |.  C745 C4 40000 MOV DWORD PTR SS:[EBP-3C],40
00436B4B  |.  C745 C8 48000 MOV DWORD PTR SS:[EBP-38],48
00436B52  |.  C745 CC 58000 MOV DWORD PTR SS:[EBP-34],58
00436B59  |.  C745 D0 48000 MOV DWORD PTR SS:[EBP-30],48
00436B60  |.  C745 D4 40000 MOV DWORD PTR SS:[EBP-2C],40
00436B67  |.  C745 D8 60000 MOV DWORD PTR SS:[EBP-28],60
00436B6E  |.  C745 DC 58000 MOV DWORD PTR SS:[EBP-24],58
00436B75  |.  C745 E0 60000 MOV DWORD PTR SS:[EBP-20],60
00436B7C  |.  C745 E4 40000 MOV DWORD PTR SS:[EBP-1C],40
00436B83  |.  C745 E8 78000 MOV DWORD PTR SS:[EBP-18],78
00436B8A  |.  C745 EC 58000 MOV DWORD PTR SS:[EBP-14],58
00436B91  |.  C745 F0 78000 MOV DWORD PTR SS:[EBP-10],78
00436B98  |.  C745 F4 40000 MOV DWORD PTR SS:[EBP-0C],40
00436B9F  |.  C745 F8 90000 MOV DWORD PTR SS:[EBP-8],90
00436BA6  |.  C745 FC 58000 MOV DWORD PTR SS:[EBP-4],58
00436BAD  |.  C785 20FFFFFF MOV DWORD PTR SS:[EBP-0E0],0
00436BB7  |.  C785 24FFFFFF MOV DWORD PTR SS:[EBP-0DC],58
00436BC1  |.  C785 28FFFFFF MOV DWORD PTR SS:[EBP-0D8],18
00436BCB  |.  C785 2CFFFFFF MOV DWORD PTR SS:[EBP-0D4],70
00436BD5  |.  C785 30FFFFFF MOV DWORD PTR SS:[EBP-0D0],18
00436BDF  |.  C785 34FFFFFF MOV DWORD PTR SS:[EBP-0CC],58
00436BE9  |.  C785 38FFFFFF MOV DWORD PTR SS:[EBP-0C8],30
00436BF3  |.  C785 3CFFFFFF MOV DWORD PTR SS:[EBP-0C4],70
00436BFD  |.  C785 40FFFFFF MOV DWORD PTR SS:[EBP-0C0],0
00436C07  |.  C785 44FFFFFF MOV DWORD PTR SS:[EBP-0BC],58
00436C11  |.  C785 48FFFFFF MOV DWORD PTR SS:[EBP-0B8],18
00436C1B  |.  C785 4CFFFFFF MOV DWORD PTR SS:[EBP-0B4],70
00436C25  |.  C785 50FFFFFF MOV DWORD PTR SS:[EBP-0B0],30
00436C2F  |.  C785 54FFFFFF MOV DWORD PTR SS:[EBP-0AC],58
00436C39  |.  C785 58FFFFFF MOV DWORD PTR SS:[EBP-0A8],48
00436C43  |.  C785 5CFFFFFF MOV DWORD PTR SS:[EBP-0A4],70
00436C4D  |.  C785 60FFFFFF MOV DWORD PTR SS:[EBP-0A0],48
00436C57  |.  C785 64FFFFFF MOV DWORD PTR SS:[EBP-9C],58
00436C61  |.  C785 68FFFFFF MOV DWORD PTR SS:[EBP-98],60
00436C6B  |.  C785 6CFFFFFF MOV DWORD PTR SS:[EBP-94],70
00436C75  |.  C785 70FFFFFF MOV DWORD PTR SS:[EBP-90],60
00436C7F  |.  C785 74FFFFFF MOV DWORD PTR SS:[EBP-8C],58
00436C89  |.  C785 78FFFFFF MOV DWORD PTR SS:[EBP-88],78
00436C93  |.  C785 7CFFFFFF MOV DWORD PTR SS:[EBP-84],70
00436C9D  |.  C745 80 78000 MOV DWORD PTR SS:[EBP-80],78
00436CA4  |.  C745 84 58000 MOV DWORD PTR SS:[EBP-7C],58
00436CAB  |.  C745 88 90000 MOV DWORD PTR SS:[EBP-78],90
00436CB2  |.  C745 8C 70000 MOV DWORD PTR SS:[EBP-74],70
00436CB9  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436CBC  |.  8B48 74       MOV ECX,DWORD PTR DS:[EAX+74]
00436CBF  |.  898D 1CFFFFFF MOV DWORD PTR SS:[EBP-0E4],ECX
00436CC5  |.  83BD 1CFFFFFF CMP DWORD PTR SS:[EBP-0E4],5
00436CCC  |.  0F87 D3020000 JA 00436FA5
00436CD2  |.  8B95 1CFFFFFF MOV EDX,DWORD PTR SS:[EBP-0E4]
00436CD8  \.  FF2495 D07043 JMP DWORD PTR DS:[EDX*4+4370D0]
00436CDF  />  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436CE2  |.  0FB748 50     MOVZX ECX,WORD PTR DS:[EAX+50]
00436CE6  |.  83E1 DF       AND ECX,FFFFFFDF
00436CE9  |.  8B55 08       MOV EDX,DWORD PTR SS:[EBP+8]
00436CEC  |.  66:894A 50    MOV WORD PTR DS:[EDX+50],CX
00436CF0  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436CF3  |.  C740 74 01000 MOV DWORD PTR DS:[EAX+74],1
00436CFA  |.  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00436CFD  |.  C781 A4000000 MOV DWORD PTR DS:[ECX+0A4],0
00436D07  |.  8B55 08       MOV EDX,DWORD PTR SS:[EBP+8]
00436D0A  |.  C742 7C 00080 MOV DWORD PTR DS:[EDX+7C],800
00436D11  |>  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436D14  |.  C740 68 00000 MOV DWORD PTR DS:[EAX+68],0
00436D1B  |.  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00436D1E  |.  8B51 08       MOV EDX,DWORD PTR DS:[ECX+8]
00436D21  |.  81EA 00000100 SUB EDX,10000
00436D27  |.  3B15 54E64900 CMP EDX,DWORD PTR DS:[49E654]
00436D2D  |.  7D 4F         JGE SHORT 00436D7E
00436D2F  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436D32  |.  8B48 08       MOV ECX,DWORD PTR DS:[EAX+8]
00436D35  |.  81C1 00000100 ADD ECX,10000
00436D3B  |.  3B0D 54E64900 CMP ECX,DWORD PTR DS:[49E654]
00436D41  |.  7E 3B         JLE SHORT 00436D7E
00436D43  |.  8B55 08       MOV EDX,DWORD PTR SS:[EBP+8]
00436D46  |.  8B42 0C       MOV EAX,DWORD PTR DS:[EDX+0C]
00436D49  |.  2D 00600000   SUB EAX,6000
00436D4E  |.  3B05 58E64900 CMP EAX,DWORD PTR DS:[49E658]
00436D54  |.  7D 28         JGE SHORT 00436D7E
00436D56  |.  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00436D59  |.  8B51 0C       MOV EDX,DWORD PTR DS:[ECX+0C]
00436D5C  |.  81C2 00400000 ADD EDX,4000
00436D62  |.  3B15 58E64900 CMP EDX,DWORD PTR DS:[49E658]
00436D68  |.  7E 14         JLE SHORT 00436D7E
00436D6A  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436D6D  |.  C740 64 00000 MOV DWORD PTR DS:[EAX+64],0
00436D74  |.  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00436D77  |.  C741 74 02000 MOV DWORD PTR DS:[ECX+74],2
00436D7E  |>  8B55 08       MOV EDX,DWORD PTR SS:[EBP+8]
00436D81  |.  0FB682 9C0000 MOVZX EAX,BYTE PTR DS:[EDX+9C]
00436D88  |.  85C0          TEST EAX,EAX
00436D8A  |.  74 2F         JZ SHORT 00436DBB
00436D8C  |.  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00436D8F  |.  C741 68 01000 MOV DWORD PTR DS:[ECX+68],1
00436D96  |.  8B55 08       MOV EDX,DWORD PTR SS:[EBP+8]
00436D99  |.  C742 64 00000 MOV DWORD PTR DS:[EDX+64],0
00436DA0  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436DA3  |.  C740 74 02000 MOV DWORD PTR DS:[EAX+74],2
00436DAA  |.  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00436DAD  |.  0FB751 50     MOVZX EDX,WORD PTR DS:[ECX+50]
00436DB1  |.  83E2 DF       AND EDX,FFFFFFDF
00436DB4  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436DB7  |.  66:8950 50    MOV WORD PTR DS:[EAX+50],DX
00436DBB  |>  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00436DBE  |.  8B15 54E64900 MOV EDX,DWORD PTR DS:[49E654]
00436DC4  |.  3B51 08       CMP EDX,DWORD PTR DS:[ECX+8]
00436DC7  |.  7D 0C         JGE SHORT 00436DD5
00436DC9  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436DCC  |.  C740 4C 00000 MOV DWORD PTR DS:[EAX+4C],0
00436DD3  |.  EB 0A         JMP SHORT 00436DDF
00436DD5  |>  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00436DD8  |.  C741 4C 02000 MOV DWORD PTR DS:[ECX+4C],2
00436DDF  \>  E9 C1010000   JMP 00436FA5
00436DE4  />  8B55 08       MOV EDX,DWORD PTR SS:[EBP+8]
00436DE7  |.  8B42 64       MOV EAX,DWORD PTR DS:[EDX+64]
00436DEA  |.  83C0 01       ADD EAX,1
00436DED  |.  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00436DF0  |.  8941 64       MOV DWORD PTR DS:[ECX+64],EAX
00436DF3  |.  8B55 08       MOV EDX,DWORD PTR SS:[EBP+8]
00436DF6  |.  837A 64 06    CMP DWORD PTR DS:[EDX+64],6
00436DFA  |.  7E 19         JLE SHORT 00436E15
00436DFC  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436DFF  |.  C740 64 00000 MOV DWORD PTR DS:[EAX+64],0
00436E06  |.  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00436E09  |.  8B51 68       MOV EDX,DWORD PTR DS:[ECX+68]
00436E0C  |.  83C2 01       ADD EDX,1
00436E0F  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436E12  |.  8950 68       MOV DWORD PTR DS:[EAX+68],EDX
00436E15  |>  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00436E18  |.  8379 68 03    CMP DWORD PTR DS:[ECX+68],3
00436E1C  |.  7E 0A         JLE SHORT 00436E28
00436E1E  |.  8B55 08       MOV EDX,DWORD PTR SS:[EBP+8]
00436E21  |.  C742 68 00000 MOV DWORD PTR DS:[EDX+68],0
00436E28  |>  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436E2B  |.  8B48 08       MOV ECX,DWORD PTR DS:[EAX+8]
00436E2E  |.  81E9 00200000 SUB ECX,2000
00436E34  |.  3B0D 54E64900 CMP ECX,DWORD PTR DS:[49E654]
00436E3A  |.  7D 6D         JGE SHORT 00436EA9
00436E3C  |.  8B55 08       MOV EDX,DWORD PTR SS:[EBP+8]
00436E3F  |.  8B42 08       MOV EAX,DWORD PTR DS:[EDX+8]
00436E42  |.  05 00200000   ADD EAX,2000
00436E47  |.  3B05 54E64900 CMP EAX,DWORD PTR DS:[49E654]
00436E4D  |.  7E 5A         JLE SHORT 00436EA9
00436E4F  |.  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00436E52  |.  C741 7C 00240 MOV DWORD PTR DS:[ECX+7C],2400
00436E59  |.  8B55 08       MOV EDX,DWORD PTR SS:[EBP+8]
00436E5C  |.  C742 78 00000 MOV DWORD PTR DS:[EDX+78],0
00436E63  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436E66  |.  C740 74 03000 MOV DWORD PTR DS:[EAX+74],3
00436E6D  |.  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00436E70  |.  0FB751 50     MOVZX EDX,WORD PTR DS:[ECX+50]
00436E74  |.  83CA 20       OR EDX,00000020
00436E77  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436E7A  |.  66:8950 50    MOV WORD PTR DS:[EAX+50],DX
00436E7E  |.  6A 01         PUSH 1                                   ; /Arg2 = 1
00436E80  |.  6A 22         PUSH 22                                  ; |Arg1 = 22
00436E82  |.  E8 B997FEFF   CALL 00420640                            ; \Doukutsu.00420640
00436E87  |.  83C4 08       ADD ESP,8
00436E8A  |.  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00436E8D  |.  8379 4C 00    CMP DWORD PTR DS:[ECX+4C],0
00436E91  |.  75 0C         JNE SHORT 00436E9F
00436E93  |.  8B55 08       MOV EDX,DWORD PTR SS:[EBP+8]
00436E96  |.  C742 10 00FCF MOV DWORD PTR DS:[EDX+10],-400
00436E9D  |.  EB 0A         JMP SHORT 00436EA9
00436E9F  |>  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436EA2  |.  C740 10 00040 MOV DWORD PTR DS:[EAX+10],400
00436EA9  |>  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00436EAC  |.  8B15 54E64900 MOV EDX,DWORD PTR DS:[49E654]
00436EB2  |.  3B51 08       CMP EDX,DWORD PTR DS:[ECX+8]
00436EB5  |.  7D 16         JGE SHORT 00436ECD
00436EB7  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436EBA  |.  C740 4C 00000 MOV DWORD PTR DS:[EAX+4C],0
00436EC1  |.  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00436EC4  |.  C741 10 00FFF MOV DWORD PTR DS:[ECX+10],-100
00436ECB  |.  EB 14         JMP SHORT 00436EE1
00436ECD  |>  8B55 08       MOV EDX,DWORD PTR SS:[EBP+8]
00436ED0  |.  C742 4C 02000 MOV DWORD PTR DS:[EDX+4C],2
00436ED7  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436EDA  |.  C740 10 00010 MOV DWORD PTR DS:[EAX+10],100
00436EE1  \>  E9 BF000000   JMP 00436FA5
00436EE6  />  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00436EE9  |.  C741 10 00000 MOV DWORD PTR DS:[ECX+10],0
00436EF0  |.  8B55 08       MOV EDX,DWORD PTR SS:[EBP+8]
00436EF3  |.  8B42 78       MOV EAX,DWORD PTR DS:[EDX+78]
00436EF6  |.  83C0 01       ADD EAX,1
00436EF9  |.  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00436EFC  |.  8941 78       MOV DWORD PTR DS:[ECX+78],EAX
00436EFF  |.  8B55 08       MOV EDX,DWORD PTR SS:[EBP+8]
00436F02  |.  837A 78 28    CMP DWORD PTR DS:[EDX+78],28
00436F06  |.  7E 20         JLE SHORT 00436F28
00436F08  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436F0B  |.  C740 78 00000 MOV DWORD PTR DS:[EAX+78],0
00436F12  |.  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00436F15  |.  C741 74 04000 MOV DWORD PTR DS:[ECX+74],4
00436F1C  |.  6A 01         PUSH 1                                   ; /Arg2 = 1
00436F1E  |.  6A 6A         PUSH 6A                                  ; |Arg1 = 6A
00436F20  |.  E8 1B97FEFF   CALL 00420640                            ; \Doukutsu.00420640
00436F25  |.  83C4 08       ADD ESP,8
00436F28  |>  8B55 08       MOV EDX,DWORD PTR SS:[EBP+8]
00436F2B  |.  C742 68 04000 MOV DWORD PTR DS:[EDX+68],4
00436F32  \.  EB 71         JMP SHORT 00436FA5
00436F34  />  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436F37  |.  C780 A4000000 MOV DWORD PTR DS:[EAX+0A4],0A
00436F41  |.  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00436F44  |.  8B51 78       MOV EDX,DWORD PTR DS:[ECX+78]
00436F47  |.  83C2 01       ADD EDX,1
00436F4A  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436F4D  |.  8950 78       MOV DWORD PTR DS:[EAX+78],EDX
00436F50  |.  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00436F53  |.  8379 78 02    CMP DWORD PTR DS:[ECX+78],2
00436F57  |.  7E 14         JLE SHORT 00436F6D
00436F59  |.  8B55 08       MOV EDX,DWORD PTR SS:[EBP+8]
00436F5C  |.  C742 78 00000 MOV DWORD PTR DS:[EDX+78],0
00436F63  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436F66  |.  C740 74 05000 MOV DWORD PTR DS:[EAX+74],5
00436F6D  |>  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00436F70  |.  C741 68 05000 MOV DWORD PTR DS:[ECX+68],5
00436F77  \.  EB 2C         JMP SHORT 00436FA5
00436F79  />  8B55 08       MOV EDX,DWORD PTR SS:[EBP+8]
00436F7C  |.  C742 68 06000 MOV DWORD PTR DS:[EDX+68],6
00436F83  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436F86  |.  8B48 78       MOV ECX,DWORD PTR DS:[EAX+78]
00436F89  |.  83C1 01       ADD ECX,1
00436F8C  |.  8B55 08       MOV EDX,DWORD PTR SS:[EBP+8]
00436F8F  |.  894A 78       MOV DWORD PTR DS:[EDX+78],ECX
00436F92  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436F95  |.  8378 78 3C    CMP DWORD PTR DS:[EAX+78],3C
00436F99  |.  7E 0A         JLE SHORT 00436FA5
00436F9B  |.  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00436F9E  |.  C741 74 00000 MOV DWORD PTR DS:[ECX+74],0
00436FA5  |>  8B55 08       MOV EDX,DWORD PTR SS:[EBP+8]
00436FA8  |.  837A 10 00    CMP DWORD PTR DS:[EDX+10],0
00436FAC  |.  7D 15         JGE SHORT 00436FC3
00436FAE  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436FB1  |.  8B48 04       MOV ECX,DWORD PTR DS:[EAX+4]
00436FB4  |.  83E1 01       AND ECX,00000001
00436FB7  |.  74 0A         JZ SHORT 00436FC3
00436FB9  |.  8B55 08       MOV EDX,DWORD PTR SS:[EBP+8]
00436FBC  |.  C742 10 00000 MOV DWORD PTR DS:[EDX+10],0
00436FC3  |>  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436FC6  |.  8378 10 00    CMP DWORD PTR DS:[EAX+10],0
00436FCA  |.  7E 15         JLE SHORT 00436FE1
00436FCC  |.  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00436FCF  |.  8B51 04       MOV EDX,DWORD PTR DS:[ECX+4]
00436FD2  |.  83E2 04       AND EDX,00000004
00436FD5  |.  74 0A         JZ SHORT 00436FE1
00436FD7  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436FDA  |.  C740 10 00000 MOV DWORD PTR DS:[EAX+10],0
00436FE1  |>  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00436FE4  |.  8B51 14       MOV EDX,DWORD PTR DS:[ECX+14]
00436FE7  |.  83C2 20       ADD EDX,20
00436FEA  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00436FED  |.  8950 14       MOV DWORD PTR DS:[EAX+14],EDX
00436FF0  |.  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00436FF3  |.  8179 10 00040 CMP DWORD PTR DS:[ECX+10],400
00436FFA  |.  7E 0A         JLE SHORT 00437006
00436FFC  |.  8B55 08       MOV EDX,DWORD PTR SS:[EBP+8]
00436FFF  |.  C742 10 00040 MOV DWORD PTR DS:[EDX+10],400
00437006  |>  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00437009  |.  8178 10 00FCF CMP DWORD PTR DS:[EAX+10],-400
00437010  |.  7D 0A         JGE SHORT 0043701C
00437012  |.  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00437015  |.  C741 10 00FCF MOV DWORD PTR DS:[ECX+10],-400
0043701C  |>  8B55 08       MOV EDX,DWORD PTR SS:[EBP+8]
0043701F  |.  817A 14 FF050 CMP DWORD PTR DS:[EDX+14],5FF
00437026  |.  7E 0A         JLE SHORT 00437032
00437028  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
0043702B  |.  C740 10 FF050 MOV DWORD PTR DS:[EAX+10],5FF
00437032  |>  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00437035  |.  8179 14 01FAF CMP DWORD PTR DS:[ECX+14],-5FF
0043703C  |.  7D 0A         JGE SHORT 00437048
0043703E  |.  8B55 08       MOV EDX,DWORD PTR SS:[EBP+8]
00437041  |.  C742 10 01FAF MOV DWORD PTR DS:[EDX+10],-5FF
00437048  |>  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
0043704B  |.  8B48 08       MOV ECX,DWORD PTR DS:[EAX+8]
0043704E  |.  8B55 08       MOV EDX,DWORD PTR SS:[EBP+8]
00437051  |.  034A 10       ADD ECX,DWORD PTR DS:[EDX+10]
00437054  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00437057  |.  8948 08       MOV DWORD PTR DS:[EAX+8],ECX
0043705A  |.  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
0043705D  |.  8B51 0C       MOV EDX,DWORD PTR DS:[ECX+0C]
00437060  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00437063  |.  0350 14       ADD EDX,DWORD PTR DS:[EAX+14]
00437066  |.  8B4D 08       MOV ECX,DWORD PTR SS:[EBP+8]
00437069  |.  8951 0C       MOV DWORD PTR DS:[ECX+0C],EDX
0043706C  |.  8B55 08       MOV EDX,DWORD PTR SS:[EBP+8]
0043706F  |.  837A 4C 00    CMP DWORD PTR DS:[EDX+4C],0
00437073  |.  75 2B         JNE SHORT 004370A0
00437075  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00437078  |.  8B48 68       MOV ECX,DWORD PTR DS:[EAX+68]
0043707B  |.  C1E1 04       SHL ECX,4
0043707E  |.  8D540D 90     LEA EDX,[ECX+EBP-70]
00437082  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
00437085  |.  83C0 54       ADD EAX,54
00437088  |.  8B0A          MOV ECX,DWORD PTR DS:[EDX]
0043708A  |.  8908          MOV DWORD PTR DS:[EAX],ECX
0043708C  |.  8B4A 04       MOV ECX,DWORD PTR DS:[EDX+4]
0043708F  |.  8948 04       MOV DWORD PTR DS:[EAX+4],ECX
00437092  |.  8B4A 08       MOV ECX,DWORD PTR DS:[EDX+8]
00437095  |.  8948 08       MOV DWORD PTR DS:[EAX+8],ECX
00437098  |.  8B52 0C       MOV EDX,DWORD PTR DS:[EDX+0C]
0043709B  |.  8950 0C       MOV DWORD PTR DS:[EAX+0C],EDX
0043709E  |.  EB 2C         JMP SHORT 004370CC
004370A0  |>  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
004370A3  |.  8B48 68       MOV ECX,DWORD PTR DS:[EAX+68]
004370A6  |.  C1E1 04       SHL ECX,4
004370A9  |.  8D940D 20FFFF LEA EDX,[ECX+EBP-0E0]
004370B0  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
004370B3  |.  83C0 54       ADD EAX,54
004370B6  |.  8B0A          MOV ECX,DWORD PTR DS:[EDX]
004370B8  |.  8908          MOV DWORD PTR DS:[EAX],ECX
004370BA  |.  8B4A 04       MOV ECX,DWORD PTR DS:[EDX+4]
004370BD  |.  8948 04       MOV DWORD PTR DS:[EAX+4],ECX
004370C0  |.  8B4A 08       MOV ECX,DWORD PTR DS:[EDX+8]
004370C3  |.  8948 08       MOV DWORD PTR DS:[EAX+8],ECX
004370C6  |.  8B52 0C       MOV EDX,DWORD PTR DS:[EDX+0C]
004370C9  |.  8950 0C       MOV DWORD PTR DS:[EAX+0C],EDX
004370CC  |>  8BE5          MOV ESP,EBP
004370CE  |.  5D            POP EBP
004370CF  \.  C3            RETN
004370D0   .  DF6C4300      DD 00436CDF                              ; Entry point
004370D4   .  116D4300      DD 00436D11
004370D8   .  E46D4300      DD 00436DE4                              ; Entry point
004370DC   .  E66E4300      DD 00436EE6                              ; Entry point
004370E0   .  346F4300      DD 00436F34                              ; Entry point
004370E4   .  796F4300      DD 00436F79                              ; Entry point

I understand that the first chunk of lines "MOV DWORD PTR SS:[EBP-__], __" define the frame rects that the NPC is gonna use. However, after this chunk where these frame-rects have been defined, I don't see where the code calls these frames to be drawn on the screen. In the subsequent lines of code, there are only commands that govern the behaviour of the NPC, but no drawing of frames >_>

How does the code know which frame to draw for which action (walking, attacking, etc)?
 
Feb 9, 2017 at 1:34 AM
Junior Member
"Fresh from the Bakery"
Join Date: Nov 17, 2016
Location:
Posts: 16
Hello peeps. So I'm doing some CS modding and having trouble with moving to other stages. As soon as I exit to another stage (level, area, map, whatever.) it plays my intro dialogue again. The map I'm using is a modified First Cave coming from a modified Storehouse (where you meet Itoh). The First Cave script is blank, so it shouldn't be triggering the event. Here's my code for the Storehouse

#0200
<KEY<MSGA wind blows through the room...<NOD
Something doesn't feel right...<NOD<CLO<FAI0004<END
#0205
<KEY<MSGIt's blocked by rubble. Too bad.<NOD<CLO<END
#0206
<KEY<SOU0011<ANP0206:0000:0001<FAO0001
<TRA0012:0092:0056:0041
 
Feb 9, 2017 at 2:23 AM
Bonds that separate us
Forum Administrator
"Life begins and ends with Nu."
Join Date: Aug 20, 2006
Location:
Posts: 2859
Age: 34
Pronouns: he/him
If the script is blank and there's no event for it to run then the game will keep searching until it finds something that works. In order to <TRA every map needs an event to connect to.
 
Feb 9, 2017 at 4:26 PM
Been here way too long...
"What're YOU lookin' at?"
Join Date: Oct 17, 2011
Location: probably somewhere else
Posts: 1104
Age: 27
Pronouns: none
Code:
004370A0  |>  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
004370A3  |.  8B48 68       MOV ECX,DWORD PTR DS:[EAX+68]
004370A6  |.  C1E1 04       SHL ECX,4
004370A9  |.  8D940D 20FFFF LEA EDX,[ECX+EBP-0E0]
004370B0  |.  8B45 08       MOV EAX,DWORD PTR SS:[EBP+8]
004370B3  |.  83C0 54       ADD EAX,54
004370B6  |.  8B0A          MOV ECX,DWORD PTR DS:[EDX]
004370B8  |.  8908          MOV DWORD PTR DS:[EAX],ECX
004370BA  |.  8B4A 04       MOV ECX,DWORD PTR DS:[EDX+4]
004370BD  |.  8948 04       MOV DWORD PTR DS:[EAX+4],ECX
004370C0  |.  8B4A 08       MOV ECX,DWORD PTR DS:[EDX+8]
004370C3  |.  8948 08       MOV DWORD PTR DS:[EAX+8],ECX
004370C6  |.  8B52 0C       MOV EDX,DWORD PTR DS:[EDX+0C]
004370C9  |.  8950 0C       MOV DWORD PTR DS:[EAX+0C],EDX
004370CC  |>  8BE5          MOV ESP,EBP
004370CE  |.  5D            POP EBP
004370CF  \.  C3            RETN

this little part.
mov ecx, [eax+68] takes the current frame.
shl ecx,4 logical shift to the left by 4 bits (multiplies by 2^4=16 iirc)
then it references to that weird table of framerects and what's below is basically setting the rects to the entity itself (does [EBP-0E0] sound familiar? it was the highest ebp value up there in the framerects setting)

there are better ways to create frames and set graphics to entities though
 
Last edited:
Feb 9, 2017 at 11:59 PM
Senior Member
CSE Discord Admin
"Fly, Fly, Fly!"
Join Date: Jan 13, 2016
Location:
Posts: 132
While looking over Freeware Cave Story's control code, I noticed some strange keys.
  • F5 disables controllers if they were enabled in DoConfig, allowing the keyboard controls to be used
  • The '+' key acts as a second Up key when the arrow keys are mapped to letters in DoConfig. This seems odd at first glance, but it actually makes sense on Japanese keyboards, where '+' and 'L' (the normal Up key) are next to each other. You can actually still see that in DoConfig
  • The shift key is recognised as an input, but I don't think the game ever uses it
Would anyone have any explanations for that last oddity? I can't for the life of me figure out what shift is for, and reverse-engineering the EXE to figure it out hasn't given me any results so far.
 
Feb 10, 2017 at 1:17 AM
Junior Member
"Fresh from the Bakery"
Join Date: Nov 17, 2016
Location:
Posts: 16
If the script is blank and there's no event for it to run then the game will keep searching until it finds something that works. In order to <TRA every map needs an event to connect to.
What event should I run in the First Cave room? Is there any "blank" event it can use? Or can I just use something else, like stopping the music and run a new track.
 
Feb 10, 2017 at 2:50 AM
Based Member
"Life begins and ends with Nu."
Join Date: Dec 31, 2011
Location: United States
Posts: 2326
Age: 28
Pronouns: he/him
What event should I run in the First Cave room? Is there any "blank" event it can use? Or can I just use something else, like stopping the music and run a new track.
It appears that you have "0092" as the event number to run in the room you transition to next, so you'd want to make sure you have an event #0092 in first cave that gets run. Under that, you could put a simple <END command to make it totally blank. Or, to make it naturally fade in, display the map name, and ensure the proper music is playing like in Cave Story and most mods, you'd want to put this: <MNA<CMU0008<FAI0002<END
This should be there by default unless you totally wiped out all code from the first cave's script, which it almost sounds like you did.

EDIT: 1500th post! "Bleep, Bloop, Bleep, Bloop"
 
Back
Top