Match daNpc_Bs1_c::CreateInit and cLib_minMaxLimit inline

This commit is contained in:
LagoLunatic
2024-07-19 13:17:43 -04:00
parent 66dfae2571
commit 287bdab653
4 changed files with 6 additions and 21 deletions
+1 -16
View File
@@ -58,22 +58,7 @@ inline void cLib_setBit(T& value, T bit) {
template <typename T>
inline T cLib_minMaxLimit(T val, T min, T max) {
T ret;
T var_r30;
if (val < min) {
ret = min;
} else {
if (val > max) {
var_r30 = max;
} else {
var_r30 = val;
}
ret = var_r30;
}
return (T)ret;
return (T)((T)val < (T)min ? (T)min : ((T)val > (T)max ? (T)max : (T)val));
}
template <typename T>
+3 -3
View File
@@ -1293,10 +1293,10 @@ namespace daBomb2 {
};
if(fopAcM_GetModel(this) == 0) {
f32 frame = mBck0.getFrame();
frame = mult[cLib_minMaxLimit<int>(mBck0.getEndFrame() - frame, 0, 9)] * 25.0f;
int framesLeft = mBck0.getEndFrame() - mBck0.getFrame();
f32 scale = mult[cLib_minMaxLimit<int>(framesLeft, 0, 9)] * 25.0f;
dComIfGd_setSimpleShadow2(&current.pos, mAcch.GetGroundH(), frame, mAcch.m_gnd, 0, 1.0f, dDlst_shadowControl_c::getSimpleTex());
dComIfGd_setSimpleShadow2(&current.pos, mAcch.GetGroundH(), scale, mAcch.m_gnd, 0, 1.0f, dDlst_shadowControl_c::getSimpleTex());
}
}
+1 -1
View File
@@ -1596,7 +1596,7 @@ BOOL daNpc_Bs1_c::CreateInit() {
mShopIndex = 6;
}
mShopIndex = cLib_minMaxLimit<int>(mShopIndex, 0, 7);
mShopIndex = cLib_minMaxLimit<s8>(mShopIndex, 0, 7);
mShopCamAction.setCamDataIdx(mShopIndex);
mShopItems.setItemDataIdx(mShopIndex);
+1 -1
View File
@@ -100,7 +100,7 @@ s32 daObj_Roten_c::_create() {
fopAcM_SetupActor(this, daObj_Roten_c);
mType = fopAcM_GetParam(this) >> 0x18;
mType = cLib_minMaxLimit<u8>((int)mType, 0, 2); // fakematch? debug says this is templated to u8
mType = cLib_minMaxLimit<u8>(mType, 0, 2);
if(Roten_create_check(mType)) {
field_0x2D1 = 0;