Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
75 changes: 75 additions & 0 deletions src/SB/Core/x/xSGT.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
S32 xSGT_LoadPrefsCB(void* vp, st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_READCONTEXT* rctxt, U32 ui,
S32 i)
{
U32 stereo;

xSGReadData(xsgdata, rctxt, &stereo, 1);
xSGReadData(xsgdata, rctxt, &gSnd.categoryVolFader[2], 1);
xSGReadData(xsgdata, rctxt, &gSnd.categoryVolFader[0], 1);
xSGReadData(xsgdata, rctxt, &globals.option_vibration, 1);
if (globals.option_vibration != 0)
{
xPadRumbleEnable(globals.currentActivePad, 1);
}
else
{
xPadRumbleEnable(globals.currentActivePad, 0);
}
return 1;
}

S32 xSGT_LoadLoadCB(void* vp, st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_READCONTEXT* rctxt, U32 ui,
S32 i)
{
char bigbuf[32] = {};
S32 compdiff = 0;

xSGReadData(xsgdata, rctxt, bigbuf, 1, strlen(currSceneStr));
if (strlen(currSceneStr) != strlen(bigbuf))
{
compdiff = 1;
}
if (compdiff == 0)
{
strcpy(sceneRead, bigbuf);
}

return compdiff == 0;
}

S32 xSGT_SaveProcPrefsCB(void* vp, st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_WRITECONTEXT* wctxt)
{
int sum = 0;
sum += xSGWriteData(xsgdata, wctxt, &gSnd.stereo, 1);
sum += xSGWriteData(xsgdata, wctxt, &gSnd.categoryVolFader[2], 1);
sum += xSGWriteData(xsgdata, wctxt, &gSnd.categoryVolFader[0], 1);
sum += xSGWriteData(xsgdata, wctxt, &globals.option_vibration, 1);
return sum + 1;
}

S32 xSGT_SaveInfoPrefsCB(void* p1, st_XSAVEGAME_DATA* data, S32* i, S32* j)
{
*i = 16;
*j = *i * 2;
return 1;
}

S32 xSGT_SaveProcCB(void* vp, st_XSAVEGAME_DATA* xsgdata, st_XSAVEGAME_WRITECONTEXT* wctxt)
{
if (globals.sceneCur->sceneID == 'PG12')
{
strcpy(currSceneStr, xUtil_idtag2string('HB01', 0));
}
else
{
strcpy(currSceneStr, xUtil_idtag2string(globals.sceneCur->sceneID, 0));
}
return xSGWriteData(xsgdata, wctxt, currSceneStr, 1, strlen(currSceneStr)) + 1;
}

S32 xSGT_SaveInfoCB(void* vp, st_XSAVEGAME_DATA* xsgdata, S32* need, S32* most)
{
*need = xSGWriteStrLen(currSceneStr);
*most = *need << 1;
return 1;
}
1 change: 1 addition & 0 deletions src/SB/Game/zActionLine.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "zActionLine.h"
1 change: 1 addition & 0 deletions src/SB/Game/zAnimList.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "zAnimList.h"
2 changes: 2 additions & 0 deletions src/SB/Game/zAssetTypes.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// TODO: Set up all the headers that this one includes
//#include "zAssetTypes.h"
1 change: 1 addition & 0 deletions src/SB/Game/zAsync.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "zAsync.h"
4 changes: 4 additions & 0 deletions src/SB/Game/zAsync.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#ifndef ZASYNC_H
#define ZASYNC_H

#endif
1 change: 1 addition & 0 deletions src/SB/Game/zBusStop.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "zBusStop.h"
4 changes: 4 additions & 0 deletions src/SB/Game/zBusStop.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#ifndef ZBUSSTOP_H
#define ZBUSSTOP_H

#endif
1 change: 1 addition & 0 deletions src/SB/Game/zCam.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "zCam.h"
4 changes: 4 additions & 0 deletions src/SB/Game/zCam.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#ifndef ZCAM_H
#define ZCAM_H

#endif
1 change: 1 addition & 0 deletions src/SB/Game/zCamCar.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "zCamCar.h"
4 changes: 4 additions & 0 deletions src/SB/Game/zCamCar.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#ifndef ZCAMCAR_H
#define ZCAMCAR_H

#endif
1 change: 1 addition & 0 deletions src/SB/Game/zCamDrive.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "zCamDrive.h"
4 changes: 4 additions & 0 deletions src/SB/Game/zCamDrive.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#ifndef ZCAMDRIVE_H
#define ZCAMDRIVE_H

#endif
1 change: 1 addition & 0 deletions src/SB/Game/zCamMarker.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "zCamMarker.h"
1 change: 1 addition & 0 deletions src/SB/Game/zCamSB.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "zCamSB.h"
14 changes: 14 additions & 0 deletions src/SB/Game/zCamSB.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef ZCAMSB_H
#define ZCAMSB_H

#include "xCamera.h"

struct zCamSB : xCam
{
void update(F32 dt);
void start();
void destroy();
void create();
};

#endif
81 changes: 81 additions & 0 deletions src/SB/Game/zCamera.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#include "zCamera.h"

namespace
{
WallJumpViewState wall_jump_enabled;
bool lassocam_enabled;
U32 stop_track;
bool input_enabled = true;
F32 dMultiplier;
F32 dOffset;
F32 hMultiplier;
F32 hOffset;
zCamSB* follow_cam;
} // namespace

void zCameraReset(xCamera* cam)
{
zcam_mode = 0;
zcam_bbounce = 0;
zcam_lbbounce = 0;
zcam_lconvers = 0;
zcam_longbounce = 0;
zcam_highbounce = 0;
zcam_convers = 0;
zcam_fly = 0;
zcam_flypaused = 0;
zcam_cutscene = 0;
zcam_reward = 0;

zcam_fovcurr = 75.0f;
zcam_overrot_tmr = 0.0f;
wall_jump_enabled = WJVS_DISABLED;
lassocam_enabled = '\0';
stop_track = 0;
zcam_mintgtheight = -1e+38f;
zcam_centering = '\0';
zcam_lastcentering = '\0';
sNearToggleEnabled = '\0';

cam->fov = 75.0f;

sCamTweakLerp -= 0.0f / sCamTweakTime;
if (sCamTweakLerp < 0.0f)
{
sCamTweakLerp = 0.0f;
}

sCamTweakPitchCur =
sCamTweakPitch[1] * sCamTweakLerp + sCamTweakPitch[0] * (1.0f - sCamTweakLerp);

sCamTweakDistMultCur =
sCamTweakDistMult[1] * sCamTweakLerp + sCamTweakDistMult[0] * (1.0f - sCamTweakLerp);

zCamTweakLook* tweak = (zcam_near != 0) ? &zcam_neartweak : &zcam_fartweak;

sCamD = sCamTweakDistMultCur * tweak->dist * icos(tweak->pitch + sCamTweakPitchCur);
sCamH = sCamTweakDistMultCur * tweak->dist * isin(tweak->pitch + sCamTweakPitchCur) + tweak->h;
sCamPitch = tweak->pitch + sCamTweakPitchCur;

F32 dist = (zcam_highbounce != 0) ? zcam_highbounce_d :
(wall_jump_enabled == WJVS_ENABLED ? zcam_wall_d : sCamD);
F32 camDist = dMultiplier * dist + dOffset;
F32 height = (zcam_highbounce != 0) ? zcam_highbounce_h :
(wall_jump_enabled == WJVS_ENABLED ? zcam_wall_h : sCamH);
F32 camHeight = dMultiplier * height + dOffset;

F32 pitch = (zcam_highbounce != 0) ? zcam_highbounce_pitch : sCamPitch;

xCameraReset(cam, camDist, camHeight, pitch);

input_enabled = true;
dMultiplier = 1.0f;
dOffset = 0.0f;
hMultiplier = 1.0f;
hOffset = 0.0f;

if (follow_cam != NULL)
{
follow_cam->cfg_common.priority = '\0';
}
}
25 changes: 24 additions & 1 deletion src/SB/Game/zCamera.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef ZCAMERA_H
#define ZCAMERA_H

#include "xCamera.h"
#include "zCamSB.h"

enum WallJumpViewState
{
Expand Down Expand Up @@ -31,6 +31,13 @@ struct zFlyKey
F32 focal;
};

struct zCamTweakLook
{
F32 h;
F32 dist;
F32 pitch;
};

extern F32 zcam_overrot_tmr;
extern S32 zcam_near;
extern S32 zcam_mode;
Expand Down Expand Up @@ -90,6 +97,22 @@ extern F32 zcam_overrot_velmax;
extern F32 zcam_overrot_tmanual;
extern F32 zcam_mintgtheight;


U8 zcam_centering;
U8 zcam_lastcentering;
bool sNearToggleEnabled;
F32 sCamTweakLerp;
F32 sCamTweakTime;
F32 sCamTweakPitchCur;
F32 sCamTweakPitch[2];
F32 sCamTweakDistMultCur;
F32 sCamTweakDistMult[2];
static zCamTweakLook zcam_neartweak;
static zCamTweakLook zcam_fartweak;
F32 sCamD;
F32 sCamH;
F32 sCamPitch;

void zCameraReset(xCamera* cam);
void zCameraSetBbounce(S32 bbouncing);
void zCameraSetHighbounce(S32 hbounce);
Expand Down
1 change: 1 addition & 0 deletions src/SB/Game/zCameraFly.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "zCameraFly.h"
1 change: 1 addition & 0 deletions src/SB/Game/zCameraTweak.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "zCameraTweak.h"
63 changes: 63 additions & 0 deletions src/SB/Game/zCar.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#include "zCar.h"

// Refrain from doing these functions until the zCar struct is fixed.

#define Car 1
#define Idle01 2
#define Drive 3
#define DriveSlippy 4
#define Boosting 5
#define Reversing 6
#define Crash 7
#define SpinLeft 8
#define SpinRight 9
#define Success 10
#define Failed 11
#define Death 12
#define Jump 13
#define JumpLandSquash 14

#define ANIM_COUNT 78
extern U32 g_hash_caranim[ANIM_COUNT];
const char* g_strz_caranim[ANIM_COUNT];

// Needs the functions calls updated
// NewState and DefaultBeforeEnter do not have correct amount of params yet

xAnimTable* CreateAnimTable()
{
S32 ourAnims[32] = {
// clang-format off
Car,
Idle01,
Drive,
DriveSlippy,
Boosting,
Reversing,
Crash,
SpinLeft,
SpinRight,
Success,
Failed,
Death,
Jump,
JumpLandSquash,

// clang-format on
};

xAnimTable* table = xAnimTableNew("stop0", 0);

xAnimTableNewState(table, "Car", 0x10, 0, 1.0f, NULL, NULL, 0.0f, NULL, NULL,
xAnimDefaultBeforeEnter, NULL, NULL);
}

U32 zCar::JumpEndedCB(xAnimTransition* unk0, xAnimSingle* anim, void* unk3)
{
zCar* pCar = zEntPlayerCarGetCar();
}

U32 zCar::AnimDefaultCB(xAnimTransition* unk0, xAnimSingle* anim, void*)
{
zCar* pCar = zEntPlayerCarGetCar();
}
Loading