Merge pull request #105 from abnormalhare/main

fault.c start & player.c progress
This commit is contained in:
gamemasterplc 2024-01-07 17:15:01 -06:00 committed by GitHub
commit a22158db45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 95 additions and 5 deletions

View file

@ -4,6 +4,7 @@
#include "game/window.h"
#include "game/object.h"
#include "game/process.h"
#include "game/hsfman.h"
#include "game/board/player.h"
#include "game/board/main.h"
@ -149,14 +150,10 @@ s32 ExecJunction(s32, s16*);
s32 MegaPlayerPassFunc(s32, s16);
s32 BoardPlayerAnimBlendCheck(s32);
static void (*playerMatCopy[4])();
static HsfMaterial *playerMatCopy[4];
static s32 (*postTurnHook[4])();
static s32 (*preTurnHook[4])();
static s32 diceJumpObj[4] = {0, 0, 0, 0};
static s32 animDoneF[4] = {0, 0, 0, 0};
static s16 bowserSuitMot[5] = {-1, -1, -1, -1, -1};
s16 boardPlayerMdl[4];
static s16 playerMot[4];
static s16 junctionArrowRot[4];
@ -169,6 +166,35 @@ static s16 suitMdl = -1;
static s16 suitPlayerMdl = -1;
static s16 suitCurrMot = -1;
static s32 diceJumpObj[4] = {0, 0, 0, 0};
static s32 animDoneF[4] = {0, 0, 0, 0};
static s16 bowserSuitMot[5] = {-1, -1, -1, -1, -1};
char* lbl_8013993C[] = {
"eye1",
"eye2",
"mat14",
"mat16",
"mat65",
"mat66",
"Mario",
"Luigi",
"Peach",
"Yoshi",
"Wario",
"Donky",
"Daisy",
"Waluigi",
};
inline PlayerState* GetPlayer(s32 index) {
return &GWPlayer[index];
}
inline s16 GetBoardPlayer(s32 index) {
PlayerState *player = GetPlayer(index);
return boardPlayerMdl[player->player_idx];
}
s32 BoardRollTypeGet(void) {
return rollType;
}
@ -963,4 +989,20 @@ void BoardJunctionMaskReset(s32 arg0) {
void BoardJunctionMaskZero(void) {
junctionMask = 0;
}
// ...
void BoardPlayerCopyMat(s32 arg0) {
s16 modelID;
ModelData *model;
void* temp_r3;
HsfData* temp_r31;
modelID = BoardModelIDGet(GetBoardPlayer(arg0));
model = &Hu3DData[modelID];
temp_r31 = model->hsfData;
temp_r3 = HuMemDirectMallocNum(HEAP_SYSTEM, temp_r31->materialCnt * 0x3C, 0x10000000U);
memcpy(temp_r3, temp_r31->material, temp_r31->materialCnt * 0x3C);
playerMatCopy[arg0] = temp_r3;
}

48
src/game/fault.c Normal file
View file

@ -0,0 +1,48 @@
#include "common.h"
#include "stdarg.h"
#include "stdio.h"
typedef struct rgb_color {
s8 r;
s8 g;
s8 b;
} RGBColor;
static RGBColor XFB_Colors[5] = {
{ 0x00, 0x80, 0x80 },
{ 0xFF, 0x80, 0x80 },
{ 0xC0, 0x80, 0x80 },
{ 0x80, 0x80, 0x80 },
{ 0x40, 0x80, 0x80 }
};
s16 XFB_Geometry[6][2];
static RGBColor Draw_Color;
static s32 y_start;
static s32 x_start;
const char* lbl_801D34A0 = "OSPanic encounterd:";
void OSPanic(const char* file, int line, const char* msg, ...) {
va_list sp78;
s32 sp74;
s32 sp70;
char sp84[1024];
s32 puts;
sp74 = x_start = 0x10;
sp70 = y_start = 0x20;
puts = XFB_puts(lbl_801D34A0, sp74, sp70);
XFB_CR(puts + 1, &sp74, &sp70);
sprintf(sp84, "%s:%d", file, line);
puts = XFB_puts(sp84, sp74, sp70);
XFB_CR(puts, &sp74, &sp70);
va_start(sp78, msg);
vsnprintf(sp84, 0x400U, msg, &sp78[0]);
puts = XFB_puts(sp84, sp74, sp70);
XFB_CR(puts, &sp74, &sp70);
XFB_WriteBackCache();
PPCHalt();
va_end();
}