Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document texture of kart #663

Merged
merged 6 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions include/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,17 @@
#define FOUR_PLAYERS_SELECTED 4
#define SELECTED_PLAYER_DEFINES_TOTAL 5

#define PLAYER_ONE 0
#define PLAYER_TWO 1
#define PLAYER_THREE 2
#define PLAYER_FOUR 3
enum PlayerId {
PLAYER_NONE = -1,
PLAYER_ONE = 0,
PLAYER_TWO = 1,
PLAYER_THREE = 2,
PLAYER_FOUR = 3,
PLAYER_FIVE = 4,
PLAYER_SIX = 5,
PLAYER_SEVEN = 6,
PLAYER_EIGHT = 7
};

#define NUM_PLAYERS 8

Expand Down
10 changes: 5 additions & 5 deletions src/buffers.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,18 @@ typedef struct {
extern u16 gRandomSeed16;
extern u8 randomSeedPadding[216];
extern union_D_802BFB80 D_802BFB80;
extern struct_D_802DFB80 D_802DFB80[][2][8];
extern struct_D_802DFB80 gEncodedKartTexture[][2][8];

/**
* It would be nice to define D_802F1F80 as "struct_D_802F1F80 D_802F1F80[2][4][8]".
* But due to register allocation issues in load_kart_palette / func_80026B4C
* It would be nice to define gPlayerPalettesList as "struct_D_802F1F80 gPlayerPalettesList[2][4][8]".
* But due to register allocation issues in load_kart_palette / update_wheel_palette
* we have to define it in a different manner to match those functions.
* If AVOID_UB is defined, the struct is properly defined with their correct pointers.
**/
#ifdef AVOID_UB
extern struct_D_802F1F80 D_802F1F80[2][4][8];
extern struct_D_802F1F80 gPlayerPalettesList[2][4][8];
#else
extern u16 D_802F1F80[][4][0x100 * 8];
extern u16 gPlayerPalettesList[][4][0x100 * 8];
#endif
extern u16 gZBuffer[SCREEN_WIDTH * SCREEN_HEIGHT];

Expand Down
9 changes: 6 additions & 3 deletions src/buffers/buffers.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
#include <mk64.h>
#include "buffers.h"

/**
* @brief look like to be a buffer of decoded textures
*/
ALIGNED8 union_D_802BFB80 D_802BFB80;
ALIGNED8 struct_D_802DFB80 D_802DFB80[2][2][8];
ALIGNED8 struct_D_802DFB80 gEncodedKartTexture[2][2][8];
#ifdef AVOID_UB
ALIGNED8 struct_D_802F1F80 D_802F1F80[2][4][8];
ALIGNED8 struct_D_802F1F80 gPlayerPalettesList[2][4][8];
#else
ALIGNED8 u16 D_802F1F80[2][4][0x100 * 8];
ALIGNED8 u16 gPlayerPalettesList[2][4][0x100 * 8];
#endif

ALIGNED8 u16 gZBuffer[SCREEN_WIDTH * SCREEN_HEIGHT];
Expand Down
112 changes: 56 additions & 56 deletions src/code_80057C60.c
Original file line number Diff line number Diff line change
Expand Up @@ -6257,134 +6257,134 @@ void func_8006D194(Player *player, s8 arg1, s8 arg2) {
}
}

void func_8006D474(Player *player, s8 arg1, s8 arg2) {
void func_8006D474(Player *player, s8 playerId, s8 screenId) {
s16 var_s2;
if ((player->unk_002 & (8 << (arg2 * 4))) == (8 << (arg2 * 4))) {
if ((player->unk_002 & (8 << (screenId * 4))) == (8 << (screenId * 4))) {
for (var_s2 = 0; var_s2 < 10; var_s2++) {
switch (player->unk_258[var_s2].unk_012) {
case 1:
if (gActiveScreenMode == SCREEN_MODE_3P_4P_SPLITSCREEN) {
if (arg2 == arg1) {
func_8006538C(player, arg1, var_s2, arg2);
if (screenId == playerId) {
func_8006538C(player, playerId, var_s2, screenId);
}
} else {
func_8006538C(player, arg1, var_s2, arg2);
func_8006538C(player, playerId, var_s2, screenId);
}
break;
case 6:
if (gActiveScreenMode == SCREEN_MODE_3P_4P_SPLITSCREEN) {
if (arg2 == arg1) {
func_80066BAC(player, arg1, var_s2, arg2);
if (screenId == playerId) {
func_80066BAC(player, playerId, var_s2, screenId);
}
} else if (arg2 == arg1) {
func_80066BAC(player, arg1, var_s2, arg2);
} else if (screenId == playerId) {
func_80066BAC(player, playerId, var_s2, screenId);
}
break;
}
switch (player->unk_258[var_s2 + 30].unk_012) {
case 1:
case 9:
if (gActiveScreenMode == SCREEN_MODE_1P) {
func_800691B8(player, arg1, var_s2, arg2);
} else if (arg2 == arg1) {
func_800691B8(player, arg1, var_s2, arg2);
func_800691B8(player, playerId, var_s2, screenId);
} else if (screenId == playerId) {
func_800691B8(player, playerId, var_s2, screenId);
}
break;
case 2:
if (gActiveScreenMode == SCREEN_MODE_1P) {
func_800696CC(player, arg1, var_s2, arg2, player->unk_258[var_s2 + 30].unk_00C);
} else if (arg2 == arg1) {
func_800696CC(player, arg1, var_s2, arg2, player->unk_258[var_s2 + 30].unk_00C);
func_800696CC(player, playerId, var_s2, screenId, player->unk_258[var_s2 + 30].unk_00C);
} else if (screenId == playerId) {
func_800696CC(player, playerId, var_s2, screenId, player->unk_258[var_s2 + 30].unk_00C);
}
break;
case 3:
if (gActiveScreenMode == SCREEN_MODE_1P) {
func_80067280(player, arg1, var_s2, arg2);
} else if (arg2 == arg1) {
func_80067280(player, (s32) arg1, var_s2, arg2);
func_80067280(player, playerId, var_s2, screenId);
} else if (screenId == playerId) {
func_80067280(player, (s32) playerId, var_s2, screenId);
}
break;
case 4:
if (gActiveScreenMode == SCREEN_MODE_1P) {
func_80069444(player, arg1, var_s2, arg2);
} else if (arg2 == arg1) {
func_80069444(player, arg1, var_s2, arg2);
func_80069444(player, playerId, var_s2, screenId);
} else if (screenId == playerId) {
func_80069444(player, playerId, var_s2, screenId);
}
break;
case 5:
if (gActiveScreenMode == SCREEN_MODE_1P) {
func_80069938(player, arg1, var_s2, arg2);
} else if (arg2 == arg1) {
func_80069938(player, arg1, var_s2, arg2);
func_80069938(player, playerId, var_s2, screenId);
} else if (screenId == playerId) {
func_80069938(player, playerId, var_s2, screenId);
}
break;
case 6:
if (gActiveScreenMode == SCREEN_MODE_1P) {
func_80069BA8(player, arg1, var_s2, arg2);
} else if (arg2 == arg1) {
func_80069BA8(player, arg1, var_s2, arg2);
func_80069BA8(player, playerId, var_s2, screenId);
} else if (screenId == playerId) {
func_80069BA8(player, playerId, var_s2, screenId);
}
break;
case 7:
if (gActiveScreenMode == SCREEN_MODE_1P) {
func_80069DB8(player, arg1, var_s2, arg2);
} else if (arg2 == arg1) {
func_80069DB8(player, arg1, var_s2, arg2);
func_80069DB8(player, playerId, var_s2, screenId);
} else if (screenId == playerId) {
func_80069DB8(player, playerId, var_s2, screenId);
}
break;
case 8:
if (gActiveScreenMode == SCREEN_MODE_1P) {
func_80067604(player, arg1, var_s2, arg2);
} else if (arg2 == arg1) {
func_80067604(player, arg1, var_s2, arg2);
func_80067604(player, playerId, var_s2, screenId);
} else if (screenId == playerId) {
func_80067604(player, playerId, var_s2, screenId);
}
break;
}
switch (player->unk_258[var_s2 + 10].unk_012) {
case 1:
if (gActiveScreenMode == SCREEN_MODE_3P_4P_SPLITSCREEN) {
if (arg2 == arg1) {
func_80065AB0(player, arg1, var_s2, arg2);
if (screenId == playerId) {
func_80065AB0(player, playerId, var_s2, screenId);
}
} else {
func_80065AB0(player, arg1, var_s2, arg2);
func_80065AB0(player, playerId, var_s2, screenId);
}
break;
case 2:
case 3:
case 4:
case 5:
if (gActiveScreenMode == SCREEN_MODE_3P_4P_SPLITSCREEN) {
if (arg2 == arg1) {
func_80065F0C(player, arg1, var_s2, arg2);
if (screenId == playerId) {
func_80065F0C(player, playerId, var_s2, screenId);
}
} else {
func_80065F0C(player, arg1, var_s2, arg2);
func_80065F0C(player, playerId, var_s2, screenId);
}
break;
case 9:
if (gActiveScreenMode == SCREEN_MODE_3P_4P_SPLITSCREEN) {
if (arg2 == arg1) {
func_800664E0(player, (s32) arg1, var_s2, arg2);
if (screenId == playerId) {
func_800664E0(player, (s32) playerId, var_s2, screenId);
}
} else {
func_800664E0(player, (s32) arg1, var_s2, arg2);
func_800664E0(player, (s32) playerId, var_s2, screenId);
}
break;
case 11:
if (gActiveScreenMode == SCREEN_MODE_3P_4P_SPLITSCREEN) {
if (arg2 == arg1) {
func_8006A01C(player, arg1, var_s2, arg2);
if (screenId == playerId) {
func_8006A01C(player, playerId, var_s2, screenId);
}
} else if (arg2 == arg1) {
func_8006A01C(player, arg1, var_s2, arg2);
} else if (screenId == playerId) {
func_8006A01C(player, playerId, var_s2, screenId);
}
break;
}
}
}
if ((gModeSelection == BATTLE) && (player->unk_002 & (2 << (arg2 * 4)))) {
func_8006BA94(player, arg1, arg2);
if ((gModeSelection == BATTLE) && (player->unk_002 & (2 << (screenId * 4)))) {
func_8006BA94(player, playerId, screenId);
}
}

Expand Down Expand Up @@ -6564,20 +6564,20 @@ void func_8006E420(Player* player, s8 arg1, s8 arg2) {
}
}

void func_8006E5AC(Player* player, s8 arg1, s8 arg2) {
void render_kart_particle_on_screen_one(Player* player, s8 playerId, s8 screenId) {
if ((player->type & PLAYER_EXISTS) == PLAYER_EXISTS) {
if ((player->effects & BOO_EFFECT) == BOO_EFFECT) {
if (arg1 == arg2) {
func_8006D474(player, arg1, arg2);
if (playerId == screenId) {
func_8006D474(player, playerId, screenId);
}
} else {
func_8006D474(player, arg1, arg2);
func_8006D474(player, playerId, screenId);
}
func_8006DC54(player, arg1, arg2);
func_8006DC54(player, playerId, screenId);
}
}

void func_8006E634(Player* player, s8 arg1, s8 arg2) {
void render_kart_particle_on_screen_two(Player* player, s8 arg1, s8 arg2) {
if ((player->type & PLAYER_EXISTS) == PLAYER_EXISTS) {
if ((player->effects & BOO_EFFECT) == BOO_EFFECT) {
if (arg1 == arg2) {
Expand All @@ -6590,7 +6590,7 @@ void func_8006E634(Player* player, s8 arg1, s8 arg2) {
}
}

void func_8006E6BC(Player* player, s8 arg1, s8 arg2) {
void render_kart_particle_on_screen_three(Player* player, s8 arg1, s8 arg2) {
if ((player->type & PLAYER_EXISTS) == PLAYER_EXISTS) {
if ((player->effects & BOO_EFFECT) == BOO_EFFECT) {
if (arg1 == arg2) {
Expand All @@ -6603,7 +6603,7 @@ void func_8006E6BC(Player* player, s8 arg1, s8 arg2) {
}
}

void func_8006E744(Player* player, s8 arg1, s8 arg2) {
void render_kart_particle_on_screen_four(Player* player, s8 arg1, s8 arg2) {
if ((player->type & PLAYER_EXISTS) == PLAYER_EXISTS) {
if ((player->effects & BOO_EFFECT) == BOO_EFFECT) {
if (arg1 == arg2) {
Expand Down
8 changes: 4 additions & 4 deletions src/code_80057C60.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,10 @@ void func_8006DD3C(Player*, s8, s8);

void func_8006E058(void);
void func_8006E420(Player*, s8, s8);
void func_8006E5AC(Player*, s8, s8);
void func_8006E634(Player*, s8, s8);
void func_8006E6BC(Player*, s8, s8);
void func_8006E744(Player*, s8, s8);
void render_kart_particle_on_screen_one(Player*, s8, s8);
void render_kart_particle_on_screen_two(Player*, s8, s8);
void render_kart_particle_on_screen_three(Player*, s8, s8);
void render_kart_particle_on_screen_four(Player*, s8, s8);
void func_8006E7CC(Player*, s8, s8);
void func_8006E848(Player*, s8, s8);
void func_8006E8C4(Player*, s8, s8);
Expand Down
Loading