Skip to content

Commit

Permalink
Merge pull request #24 from ProjectRevoTPP/decomp_maputil
Browse files Browse the repository at this point in the history
decompile MapUtil.cpp
  • Loading branch information
RevoSucks authored Jun 1, 2021
2 parents 270b197 + 68579a5 commit 515d00f
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 1 deletion.
44 changes: 44 additions & 0 deletions include/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,48 @@ class RumbleType {
static int getIndex(char *strIn);
};

struct gpMarDirectorStruct {
char filler0[0x7C];
u8 unk7C;
};

struct gpCameraStruct {
char filler0[0x50];
s32 unk50;
};

struct gpCubeFastCStruct {
char filler0[0x1C];
u32 unk1C;
};

struct UnkStructUnk58 {
char filler0[0x14];
float unk14;
};

struct J3DModel {
char filler0[0x58];
struct UnkStructUnk58 *unk58;
};

class TLiveActor {
public:
struct J3DModel *getModel() const;
};

struct UnkStruct44 {
char filler0[0x4C];
int unk4C;
};

class TBGCheckData {
public:
char filler0[0x44];
struct UnkStruct44 *unk44;
};

extern struct gpCameraStruct *gpCamera;
extern struct gpCubeFastCStruct *gpCubeFastC;

#endif // UNSORTED_TYPES_H
2 changes: 1 addition & 1 deletion obj_files.mk
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ O_FILES := \
$(BUILD_DIR)/asm/MarioUtil/PacketUtil.o \
$(BUILD_DIR)/asm/MarioUtil/GDUtil.o \
$(BUILD_DIR)/asm/MarioUtil/TexUtil.o \
$(BUILD_DIR)/asm/MarioUtil/MapUtil.o \
$(BUILD_DIR)/src/MarioUtil/MapUtil.o \
$(BUILD_DIR)/asm/MarioUtil/ToolData.o \
$(BUILD_DIR)/asm/M3DUtil/M3UJoint.o \
$(BUILD_DIR)/asm/M3DUtil/M3UModel.o \
Expand Down
44 changes: 44 additions & 0 deletions src/MarioUtil/MapUtil.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#include <dolphin.h>
#include "gpMarDirector.hpp"
#include "types.h"

float SMS_GetSandRiseUpRatio(const TLiveActor *actor) {
float retvar = actor->getModel()->unk58->unk14;

if (retvar > 1.0f) {
retvar = 1.0f;
} else if (retvar < 0.0f) {
retvar = 0.0f;
}

return retvar;
}

void *SMS_GetGroundActor(const TBGCheckData *bgData, u32 value) {
void *actor = NULL;
if(bgData) {
actor = bgData->unk44;
if(bgData->unk44 && value != bgData->unk44->unk4C) {
actor = NULL;
}
}
return actor;
}

int SMS_GetMonteVillageAreaInMario() {
int retvar = 4;
if(gpMarDirector->map == 8) {
if(gpCamera->unk50 == 0x33) {
return retvar = 1;
}
switch(gpCubeFastC->unk1C) {
case 0:
retvar = 2; break;
case 1:
retvar = 0; break;
default:
retvar = 3; break;
}
}
return retvar;
}

0 comments on commit 515d00f

Please sign in to comment.