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

Some matching for transition.c #108

Merged
merged 1 commit into from
Nov 10, 2024
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
2 changes: 1 addition & 1 deletion config/sly1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ segments:
#- [0x, asm, P2/thread]
#- [0x, asm, P2/tn]

- [0xe5e38, asm, P2/transition]
- [0xe5e38, c, P2/transition]
- [0xe6378, asm, P2/turret]
- [0xe6e70, asm, P2/tv]
- [0xe98d0, asm, P2/ub]
Expand Down
11 changes: 11 additions & 0 deletions config/symbol_addrs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,12 @@ g_unkblot11 = 0x26eed0; // size:0x280
g_totals = 0x26f138; // size:0x280


////////////////////////////////////////////////////////////////
// P2/sound.c
////////////////////////////////////////////////////////////////
SetMvgkRvol__Ff = 0x1c05d0; // type:func


////////////////////////////////////////////////////////////////
// P2/steppower.c
////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1055,7 +1061,12 @@ g_psw = 0x275710; // size:0x4
////////////////////////////////////////////////////////////////
// P2/transition.c
////////////////////////////////////////////////////////////////
__11CTransition = 0x1E4E38; // type:func
Set__11CTransitionPc3OIDT2i = 0x1E4E80; // type:func
Execute__11CTransition = 0x1e4ea8; // type:func
ResetWorld__F6TRANS = 0x1E5278; // type:func
transition__static_initialization_and_destruction_0 = 0x1E5328; // type:func
_GLOBAL_$I$g_transition = 0x1E5358; // type:func

g_transition = 0x275af0;

Expand Down
9 changes: 6 additions & 3 deletions include/transition.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ struct TRANS
class CTransition
{
protected:
int m_fPending; // Basically like a level pending flag.
char *m_pchzWorld; // This is the ptr to enc level sector offset and size in memory
OID m_oidWarp; // Which checkpoint you spawn at when you start a level
OID m_oidWarpContext;

public:
GRFTRANS grftrans; // Flags that affect level loading, one of them checks if you lost all lives when you die.
char m_achzWorldCur[64]; // File description contents.
int m_fPending; // Basically like a level pending flag.

// Reloads the current level. The value of FTRANS affects the load.
void ResetWorld(FTRANS ftrans);
// Constructor
CTransition();

// Sets the conditions on the level if you died or loading a level
void Set(char *pchzWorld, OID oidWarp, OID oidWarpContext, GRFTRANS grftrans);
Expand All @@ -65,4 +65,7 @@ class CTransition
void Execute();
};

// Reloads the current level. The value of FTRANS affects the load.
void ResetWorld(FTRANS ftrans);

#endif // TRANSITION_H
63 changes: 63 additions & 0 deletions src/P2/transition.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#include "common.h"
#include <chkpnt.h>
#include <transition.h>
#include <sce/memset.h>

extern void SetMvgkRvol(float); // todo: replace with header file/declaration

CTransition::CTransition()
{
m_pchzWorld = (char*)nullptr;
grftrans = FTRANS_None;
m_oidWarp = OID_Nil;
m_oidWarpContext = OID_Nil;
memset(m_achzWorldCur, 0, 0x20);
}

void CTransition::Set(char *pchzWorld, OID oidWarp, OID oidWarpContext, GRFTRANS grftrans)
{
if (m_fPending == false)
{
this->m_fPending = true;
this->m_pchzWorld = pchzWorld;
this->m_oidWarp = oidWarp;
this->m_oidWarpContext = oidWarpContext;
this->grftrans = grftrans;
}
}

INCLUDE_ASM(const s32, "P2/transition", Execute__11CTransition);

// Matching, blocked by broken references in joy.c
INCLUDE_ASM(const s32, "P2/transition", ResetWorld__F6TRANS);
// void ResetWorld(FTRANS ftrans)
// {
// GRFTRANS grftrans;

// SetMvgkRvol(0.0f);
// switch (ftrans)
// {
// case FTRANS_None:
// /* Reload with no transition */
// grftrans = FTRANS_None;
// break;

// case FTRANS_Checkpoint:
// ReturnChkmgrToCheckpoint(&g_chkmgr);
// return;

// case FTRANS_RetryWorld:
// grftrans = FTRANS_RetryWorld;
// break;

// case (FTRANS_Checkpoint | FTRANS_RetryWorld):
// /* Transition with the Sly Cooper logo wipe */
// grftrans = 4;
// break;
// }
// g_transition.Set(g_transition.m_achzWorldCur, OID_Nil, OID_Nil, grftrans);
// }

INCLUDE_ASM(const s32, "P2/transition", transition__static_initialization_and_destruction_0);

INCLUDE_ASM(const s32, "P2/transition", _GLOBAL_$I$g_transition);
Loading