Skip to content

Conversation

@TheAzack9
Copy link
Contributor

I have been gatekeeping this for far too long. I am very sorry that this has taken so long, and it is probably a bit messy since i have worked so on and off on it.

I do really suspect that each nozzle was their own class, but the map says nothing of it. Idk if fully inlined classes is possible or not? On the other hand it wouldn't make sense bcs of the getNozzleKind 🤔 Idk, something in here is very puzzling to me still.

I dislike the way NozzleTypes work rn, but i'm not sure how to do it "properly". Suggestions are appreciated :)

Any other remarks are also appreciated, again, sorry for this being mega huge. Especially WaterGun.cpp

@TheAzack9 TheAzack9 changed the title Az watergun Watergun decomp Jan 29, 2026
@encounter
Copy link
Contributor

encounter commented Jan 29, 2026

Report for GMSJ01 (6940483 - cdc29ce)

📈 Matched code: 25.58% (+0.02%, +568 bytes)
📈 Matched data: 26.53% (+0.00%, +4 bytes)

✅ 11 new matches
Unit Item Bytes Before After
mario/Player/WaterGun TNozzleBase::movement(const TMarioControllerWork&) +200 0.00% 100.00%
mario/Player/WaterGun TWaterGun::triggerPressureMovement(const TMarioControllerWork&) +152 0.00% 100.00%
mario/Player/WaterGun TWaterGun::damage() +80 0.00% 100.00%
mario/Player/WaterGun TNozzleBase::init() +36 0.00% 100.00%
mario/Player/WaterGun TNozzleTrigger::init() +32 0.00% 100.00%
mario/Player/WaterGun TWaterGun::getNozzleMtx() +28 0.00% 100.00%
mario/Player/WaterGun TWaterGun::getCurrentNozzle() const +20 0.00% 100.00%
mario/Player/WaterGun TNozzleBase::getWaistAngle() +8 0.00% 100.00%
mario/Player/WaterGun TNozzleTrigger::getNozzleKind() const +8 0.00% 100.00%
mario/Player/WaterGun .ctors +4 0.00% 100.00%
mario/Player/WaterGun TWaterGun::initInLoadAfter() +4 0.00% 100.00%
📈 32 improvements in unmatched functions
Unit Item Bytes Before After
mario/Player/WaterGun TNozzleBase::TNozzleBase(const char*, const char*, TWaterGun*) +1666 0.00% 81.40%
mario/Player/WaterGun .rodata +1213 0.00% 59.01%
mario/Player/WaterGun TWaterGun::TWaterGun(TMario*) +800 0.00% 85.17%
mario/Player/WaterGun TWaterGun::movement() +788 0.00% 58.46%
mario/Player/WaterGun TNozzleTrigger::movement(const TMarioControllerWork&) +756 0.00% 74.70%
mario/Player/WaterGun __sinit_WaterGun_cpp +712 0.00% 93.19%
mario/Player/WaterGun TWaterGun::emit() +615 0.00% 91.12%
mario/Player/WaterGun TWaterGun::calcAnimation(JDrama::TGraphics*) +407 0.00% 62.58%
mario/Player/WaterGun TNozzleBase::animation(int) +396 0.00% 36.67%
mario/Player/WaterGun TWaterGun::init() +392 0.00% 23.50%
mario/Player/WaterGun .data +332 0.00% 81.37%
mario/Player/WaterGun TNozzleBase::emitCommon(int, TWaterEmitInfo*) +324 0.00% 79.41%
mario/Player/WaterGun TWaterGun::perform(unsigned long, JDrama::TGraphics*) +283 0.00% 85.54%
mario/Player/WaterGun TNozzleBase::calcGunAngle(const TMarioControllerWork&) +239 0.00% 77.92%
mario/Player/WaterGun TWaterGun::suck() +232 0.00% 82.86%
mario/Player/WaterGun TWaterGun::setBaseTRMtx(float(*)[4]) +180 0.00% 76.27%
mario/Player/WaterGun .bss +178 0.00% 96.77%
mario/Player/WaterGun TWaterGun::rotateProp(float) +176 0.00% 97.78%
mario/Player/WaterGun TWaterGun::getEmitPosDirSpeed(int, JGeometry::TVec3<float>*, JGeometry::TVec3<float>*, JGeometry::TVec3<float>*) +171 0.00% 89.58%
mario/Player/WaterGun TWaterGun::changeBackup() +152 0.00% 88.37%
mario/Player/WaterGun TWaterGun::getEmitMtx(int) +148 0.00% 59.68%
mario/Player/WaterGun NozzleCtrl(J3DNode*, int) +139 0.00% 81.40%
mario/Player/WaterGun .sdata2 +120 0.00% 65.62%
mario/Player/WaterGun TWaterGun::isPressureOn() +103 0.00% 83.87%
mario/Player/WaterGun TNozzleBase::emit(int) +103 0.00% 14.44%
mario/Player/WaterGun WaterGunDivingCtrlR(J3DNode*, int) +103 0.00% 72.22%
mario/Player/WaterGun WaterGunDivingCtrlL(J3DNode*, int) +103 0.00% 72.22%
mario/Player/WaterGun RotateCtrl(J3DNode*, int) +100 0.00% 75.76%
mario/Player/WaterGun TWaterGun::getPressureMax() +88 0.00% 81.48%
mario/Player/WaterGun TWaterGun::getPressure() +88 0.00% 81.48%

...and 2 more improvements in unmatched functions


class MActor {
public:
enum AnimationType { BCK, BLK, BPK, BTP, BTK, BRK };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer a global enum with prefixed names, i.e. ANM_TYPE_BCK. That makes more sense when seen in code than MActor::BCK

#define ATTR_IS_SHALLOW_WATER 0x10000
#define ATTR_IS_WATER 0x20000
#define ATTR_HAS_SHIRT 0x100000
#define ATTR_IS_PERFORMING 0x200000
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use an enum and give a more descriptive prefix than just ATTR_, something like MARIO_FLAG_* with the corresponding function/field being called checkMarioFlag & mMarioFlag (as other flags exist in the mario hierarchy)

} else {
condition = false;
}
return condition;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does a simple return unk118 & attribute ? true : false not match? other "check" functions have all been like that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does, thanks for the heads up. Sometimes i get blinded by stupid shit trying to get it to match lmao.

/* 0x38A */ char unk38A[0x5A];

/* 0x3E4 */ void* mWaterGun; // TWaterGun
/* 0x3E4 */ TWaterGun* mWaterGun; // TWaterGun
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the // TWaterGun comment

/* 0x3EC */ u32 unk3EC;

/* 0x3F0 */ void* mYoshi; // TYoshi 0x3F0
/* 0x3F0 */ TYoshi* mYoshi; // TYoshi 0x3F0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the // TYoshi 0x3F0 comment

u32 _080[0x29];
u8 mGameState;

}* gpMarDirector;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't define classes & variables in one line, this is a C person fetish that makes new people very, very confused 😭

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lmao, looking closer at this. This entire hpp is mute now since there is stuff decompiled for MarDirector :)


extern size_t gpMarioAddress;

// Define the global variable in .data section
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useless comment

extern size_t gpMarioAddress;

// Define the global variable in .data section
TNozzleBmdData nozzleBmdData
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use oxford commas to make formatting nicer, i.e.

{
  { a, b, c },
  { d, e },
  { f }, // oxford comma!
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL, i hated how it autoformatted it lmao, thanks :)

// Unused stack space
// volatile u32 unused2[6];
MsMtxSetRotRPH(mtx, 0.0f, 0.0f, 0.005493164f * gunAngle);
PSMTXConcat(J3DSys::mCurrentMtx, mtx, J3DSys::mCurrentMtx);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use MTXConcat macro and others, the original code probably used these, and they will make porting easier

}
}
}
return 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use true for bools here and in other places too please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants