• Welcome to Smashboards, the world's largest Super Smash Brothers community! Over 250,000 Smash Bros. fans from around the world have come to discuss these great games in over 19 million posts!

    You are currently viewing our boards as a visitor. Click here to sign up right now and start on your path in the Smash community!

Adding Spawn Points (GameCube Stage)

ShinyBlue48

Smash Rookie
Joined
Jan 19, 2017
Messages
2
Hey everyone,

First off, there is some amazing work being done here. I have had a lot of fun trying out different stages and getting my hands dirty in some PowerPC assembly code.

I tried using Achilles' GameCube Stage (from this post: https://smashboards.com/threads/stage-hacking-new-research-documentation.384255/page-9#post-19930650), but I want to add more spawn points.

At first I considered editing the stage to have more, but it seems the spawn points are referenced at the top of the file, and there isn't room to add any more. I found this post by Achilles (https://smashboards.com/threads/stage-hacking-new-research-documentation.384255/page-6#post-18553831) saying that there is a way to use ASM code to change where the spawn point is by character.

So, what I'm looking for is either:
1. The GameCube stage with 4 spawn points
2. The ASM code Achilles made that allows for more spawn points
3. A way to edit the stage file so that there are more spawn points (without having to offset the entire file AND manually update every pointer)

Do any of these exist? I have considered trying to create an ASM code to do this but not sure where exactly to start and it seems like a solved problem...
Any help would be appreciated!
 

Achilles1515

Smash Master
Joined
Jun 18, 2007
Messages
3,211
Location
Cincinnati / Columbus OH
GrTLgExtended.1at

Here is the most up to date GameCube stage from to-be-released 20XX 4.06. The only thing that was updated from the stage in 4.05 is enabling a cast shadow on the white controller port face (changing the Material Struct flag from 0x0000000C to 0x0400000C at location 0x1a5c8 in an original GrTLg stage).

Capture.PNG


The file linked above has been extended to allow space for additional spawns. I did not put in the actual spawn data, but more just made a template for you to fill in.

You are correct that the spawns are referenced at the beginning of the file, but they are defined elsewhere.

(a regular GrTLg.dat file...)
Capture2.PNG


Highlighted are the stage info bone references (7 total). Each entry consists of two halfwords:
Code:
0x00    half    Bone Entry Index
0x02    half    Bone Entry Type ID

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

Some Bone Entry Type IDs:

0x00 = P1 spawn point
0x01 = P2 spawn point
0x02 = P3 spawn point
0x03 = P4 spawn point
0x04 = P1 respawn point
0x05 = P2 respawn point
0x06 = P3 respawn point
0x07 = P4 respawn point

0x7F = Item 0 spawn point
0x80 = Item 1 spawn point
0x81 = Item 2 spawn point
0x82 = Item 3 spawn point
0x83 = Item 4 spawn point
0x84 = Item 5 spawn point
0x85 = Item 6 spawn point
0x86 = Item 7 spawn point
0x87 = Item 8 spawn point
0x88 = Item 9 spawn point
0x89 = Item 10 spawn point
0x8A = Item 11 spawn point
0x8B = Item 12 spawn point
0x8C = Item 13 spawn point
0x8D = Item 14 spawn point
0x8E = Item 15 spawn point
0x8F = Item 16 spawn point
0x90 = Item 17 spawn point
0x91 = Item 18 spawn point

0x92 = Item 19 spawn point?
0x93 = Item 20 spawn point?

0x94 = Blastzone/cam offset addition
0x95 = Camera limit, left-top
0x96 = Camera limit, right-bottom
0x97 = Blastzone, left-top
0x98 = Blastzone, right-bottom
Notice the last two entries:
Code:
00060000 --> Bone Index 6 = P1 Spawn Point
00070004 --> Bone Index 7 = P1 Respawn Point
Having a single spawn and respawn point, means all players use them. Obviously this is a problem for spawn points, but it's fine for respawn points.
You need 3 more entries for P2,P3,P4 spawn points. (More space was added here than necessary in the extended file, in order to keep things 32-byte aligned in the file that need to be such as image data). Adding 3 more entries also means you will need to update the stage info bone reference total, which is at 0x78 in the picture above (0000007 + 3 = 0000000a).

0x70 in the picture above points to where Bone index 0 data can be found (0x38c60 + 0x20 [header]). Bone structures are 0x40 in size. The bone structure at index 0 here, is a parent bone to the rest (notice how it has a "child bone struct" pointer value but not a "next bone struct" pointer, and then the next 7 all have "next bone struct" pointers). So in the extended file, you'll see that there is added space here for three more bone structs.

Since we are adding three bone structs to the list, we need to make sure they get chained together with the "next bone struct" pointers. P1 spawn point bone struct highlighted below, cursor on the pointer.

Capture3.PNG


Adding pointers is fine, but the address of the location of the pointer needs to be added to the relocation table in order for the game to actually know it is a pointer. DAT offset 0x4 is a pointer to the start of the relocation table. Offset 0xc is the number of entries in the relocation table (number of pointers). I increased the entry count from 0x3a6 to 0x3a9 in the extended file. Here is the location in the relocation table where you'll need to place the file offsets of your new pointers (remember that if your pointer is at 0x38e6cin the DAT file, you'll need to subtract 0x20 from this for the value to put in the relocation table).



Although I don't think this is necessary, I would keep the respawn point as the last item in the bone list.
 
Last edited:

ShinyBlue48

Smash Rookie
Joined
Jan 19, 2017
Messages
2
Wow, that is absolutely incredible, thank you so much! I've been able to successfully add in the spawn points, you made this quite straightforward to do. I must have missed a lot of the info you went over in all the threads linked by the main "melee, hacks, and you" post.

In particular, I hadn't found info about the relocation table. I take it that would be the resource for trying to extend these stage files?

Thanks again for all of your work, effort, and explanation. I really appreciate it!
 
Top Bottom