mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 13:35:12 +00:00
Created character struct for mario/luigi asset differences
Removed multiple two-player hacks in the process
This commit is contained in:
parent
f230d4fe63
commit
aaa7e65b65
9 changed files with 64 additions and 15 deletions
|
@ -3846,6 +3846,7 @@
|
|||
<ClCompile Include="..\src\game\behaviors\wind.inc.c" />
|
||||
<ClCompile Include="..\src\game\behaviors\yoshi.inc.c" />
|
||||
<ClCompile Include="..\src\game\camera.c" />
|
||||
<ClCompile Include="..\src\game\characters.c" />
|
||||
<ClCompile Include="..\src\game\chat.c" />
|
||||
<ClCompile Include="..\src\game\debug.c" />
|
||||
<ClCompile Include="..\src\game\debug_course.c" />
|
||||
|
@ -4326,6 +4327,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\behavior_table.h" />
|
||||
<ClInclude Include="..\src\game\characters.h" />
|
||||
<ClInclude Include="..\src\game\chat.h" />
|
||||
<ClInclude Include="..\src\game\rng_position.h" />
|
||||
<ClInclude Include="..\src\menu\custom_menu.h" />
|
||||
|
|
|
@ -15084,6 +15084,9 @@
|
|||
<ClCompile Include="..\src\pc\network\version.c">
|
||||
<Filter>Source Files\src\pc\network</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\game\characters.c">
|
||||
<Filter>Source Files\src\game</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\actors\common0.h">
|
||||
|
@ -16045,5 +16048,8 @@
|
|||
<ClInclude Include="..\src\pc\network\version.h">
|
||||
<Filter>Header Files\src\pc\network</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\game\characters.h">
|
||||
<Filter>Header Files\src\game</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <ultra64.h>
|
||||
#include "macros.h"
|
||||
|
||||
#include "src/game/characters.h"
|
||||
|
||||
// Certain functions are marked as having return values, but do not
|
||||
// actually return a value. This causes undefined behavior, which we'd rather
|
||||
|
@ -377,6 +377,7 @@ struct MarioState
|
|||
/*????*/ int splineState;
|
||||
|
||||
/*????*/ Vec3f nonInstantWarpPos;
|
||||
/*????*/ struct Character* character;
|
||||
};
|
||||
|
||||
#define PLAY_MODE_NORMAL 0
|
||||
|
|
16
src/game/characters.c
Normal file
16
src/game/characters.c
Normal file
|
@ -0,0 +1,16 @@
|
|||
#include "characters.h"
|
||||
#include "hud.h"
|
||||
#include "model_ids.h"
|
||||
|
||||
struct Character gCharacters[CT_MAX] = {
|
||||
[CT_MARIO] = {
|
||||
.hudHead = ',',
|
||||
.cameraHudHead = GLYPH_CAM_MARIO_HEAD,
|
||||
.modelId = MODEL_MARIO,
|
||||
},
|
||||
[CT_LUIGI] = {
|
||||
.hudHead = '.',
|
||||
.cameraHudHead = GLYPH_CAM_LUIGI_HEAD,
|
||||
.modelId = MODEL_LUIGI,
|
||||
},
|
||||
};
|
22
src/game/characters.h
Normal file
22
src/game/characters.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef CHARACTERS_H
|
||||
#define CHARACTERS_H
|
||||
#include "PR/ultratypes.h"
|
||||
// NOTE: do not include any additional headers
|
||||
|
||||
enum CharacterType {
|
||||
CT_MARIO,
|
||||
CT_LUIGI,
|
||||
|
||||
// must be last
|
||||
CT_MAX
|
||||
};
|
||||
|
||||
struct Character {
|
||||
char hudHead;
|
||||
u32 cameraHudHead;
|
||||
u32 modelId;
|
||||
};
|
||||
|
||||
extern struct Character gCharacters[];
|
||||
|
||||
#endif // CHARACTERS_H
|
|
@ -292,11 +292,10 @@ void render_hud_power_meter(void) {
|
|||
* Renders the amount of lives Mario has.
|
||||
*/
|
||||
void render_hud_mario_lives(void) {
|
||||
// two-player hack
|
||||
#ifdef VERSION_JP
|
||||
char* displayHead = ",";
|
||||
#else
|
||||
char* displayHead = (gNetworkType == NT_SERVER) ? "," : ".";
|
||||
char* displayHead = (gMarioStates[0].character) ? &gMarioStates[0].character->hudHead : ",";
|
||||
#endif
|
||||
print_text(GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(22), HUD_TOP_Y, displayHead); // 'Mario Head' glyph
|
||||
if (gHudDisplay.lives == -1) {
|
||||
|
@ -436,7 +435,7 @@ void render_hud_camera_status(void) {
|
|||
|
||||
switch (sCameraHUD.status & CAM_STATUS_MODE_GROUP) {
|
||||
case CAM_STATUS_MARIO:
|
||||
render_hud_tex_lut(x + 16, y, (*cameraLUT)[(gNetworkType == NT_SERVER) ? GLYPH_CAM_MARIO_HEAD : GLYPH_CAM_LUIGI_HEAD]);
|
||||
render_hud_tex_lut(x + 16, y, (*cameraLUT)[(gMarioStates[0].character) ? gMarioStates[0].character->cameraHudHead : GLYPH_CAM_MARIO_HEAD]);
|
||||
break;
|
||||
case CAM_STATUS_LAKITU:
|
||||
render_hud_tex_lut(x + 16, y, (*cameraLUT)[GLYPH_CAM_LAKITU_HEAD]);
|
||||
|
|
|
@ -2123,8 +2123,9 @@ static void init_single_mario(struct MarioState* m) {
|
|||
}
|
||||
|
||||
// set mario/luigi model
|
||||
// two-player hack
|
||||
m->marioObj->header.gfx.sharedChild = gLoadedGraphNodes[(gNetworkPlayers[0].globalIndex == 1) ? MODEL_LUIGI : MODEL_MARIO];
|
||||
enum CharacterType characterType = (gNetworkPlayers[0].globalIndex == 1) ? CT_LUIGI : CT_MARIO;
|
||||
m->character = &gCharacters[characterType];
|
||||
m->marioObj->header.gfx.sharedChild = gLoadedGraphNodes[m->character->modelId];
|
||||
}
|
||||
|
||||
void init_mario(void) {
|
||||
|
|
|
@ -2494,16 +2494,16 @@ static void end_peach_cutscene_kiss_from_peach(struct MarioState *m) {
|
|||
}
|
||||
|
||||
static void end_peach_cutscene_star_dance(struct MarioState *m) {
|
||||
u8 sadLuigi = (gNetworkType == NT_SERVER) ? (m->playerIndex != 0) : (m->playerIndex == 0);
|
||||
s32 animFrame = set_mario_animation(m, sadLuigi ? MARIO_ANIM_START_SLEEP_SITTING : MARIO_ANIM_CREDITS_PEACE_SIGN);
|
||||
u8 nonMario = (m->character != &gCharacters[CT_MARIO]);
|
||||
s32 animFrame = set_mario_animation(m, nonMario ? MARIO_ANIM_START_SLEEP_SITTING : MARIO_ANIM_CREDITS_PEACE_SIGN);
|
||||
|
||||
if (animFrame == (sadLuigi ? 0 : 77)) {
|
||||
if (animFrame == (nonMario ? 0 : 77)) {
|
||||
cutscene_put_cap_on(m);
|
||||
}
|
||||
if (animFrame == 88 && m->playerIndex == 0) {
|
||||
play_sound(SOUND_MARIO_HERE_WE_GO, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
if (!sadLuigi && animFrame >= 98) {
|
||||
if (!nonMario && animFrame >= 98) {
|
||||
m->marioBodyState->handState = MARIO_HAND_PEACE_SIGN;
|
||||
}
|
||||
|
||||
|
@ -2548,8 +2548,8 @@ static void end_peach_cutscene_star_dance(struct MarioState *m) {
|
|||
// "let's bake a delicious cake..."
|
||||
// "...for Mario..."
|
||||
static void end_peach_cutscene_dialog_3(struct MarioState *m) {
|
||||
u8 sadLuigi = (gNetworkType == NT_SERVER) ? (m->playerIndex != 0) : (m->playerIndex == 0);
|
||||
set_mario_animation(m, sadLuigi ? MARIO_ANIM_SLEEP_IDLE : MARIO_ANIM_FIRST_PERSON);
|
||||
u8 nonMario = (m->character != &gCharacters[CT_MARIO]);
|
||||
set_mario_animation(m, nonMario ? MARIO_ANIM_SLEEP_IDLE : MARIO_ANIM_FIRST_PERSON);
|
||||
if (m->playerIndex != 0) { return; }
|
||||
sEndPeachObj->oPosY = end_obj_set_visual_pos(sEndPeachObj);
|
||||
sEndRightToadObj->oPosY = end_obj_set_visual_pos(sEndRightToadObj);
|
||||
|
@ -2586,8 +2586,8 @@ static void end_peach_cutscene_dialog_3(struct MarioState *m) {
|
|||
|
||||
// "Mario!"
|
||||
static void end_peach_cutscene_run_to_castle(struct MarioState *m) {
|
||||
u8 sadLuigi = (gNetworkType == NT_SERVER) ? (m->playerIndex != 0) : (m->playerIndex == 0);
|
||||
if (sadLuigi) {
|
||||
u8 nonMario = (m->character != &gCharacters[CT_MARIO]);
|
||||
if (nonMario) {
|
||||
set_mario_animation(m, m->actionState == 0 ? MARIO_ANIM_SLEEP_START_LYING
|
||||
: MARIO_ANIM_SLEEP_LYING);
|
||||
} else {
|
||||
|
|
|
@ -330,7 +330,9 @@ void network_receive_player(struct Packet* p) {
|
|||
}
|
||||
|
||||
// set model
|
||||
m->marioObj->header.gfx.sharedChild = gLoadedGraphNodes[(np->globalIndex == 1) ? MODEL_LUIGI : MODEL_MARIO];
|
||||
enum CharacterType characterType = (np->globalIndex == 1) ? CT_LUIGI : CT_MARIO;
|
||||
m->character = &gCharacters[characterType];
|
||||
m->marioObj->header.gfx.sharedChild = gLoadedGraphNodes[m->character->modelId];
|
||||
}
|
||||
|
||||
void network_update_player(void) {
|
||||
|
|
Loading…
Reference in a new issue