Skip to content

Commit bc7503c

Browse files
authored
fix push pull callback UB in other compilers (zeldaret#3134)
1 parent f64015e commit bc7503c

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

include/d/actor/d_a_obj_iceblock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class daObjIceBlk_c : public dBgS_MoveBgActor {
3737
ACTION_DEAD_e,
3838
};
3939

40-
static void PPCallBack(fopAc_ac_c*, fopAc_ac_c*, s16, dBgW_Base::PushPullLabel);
40+
static fopAc_ac_c* PPCallBack(fopAc_ac_c*, fopAc_ac_c*, s16, dBgW_Base::PushPullLabel);
4141
void initBaseMtx();
4242
void setBaseMtx();
4343
u16 getPointNo();

src/d/actor/d_a_door_push.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,28 @@
1111
#include "f_pc/f_pc_name.h"
1212
#include "f_op/f_op_actor_mng.h"
1313

14-
static void PPCallBack(fopAc_ac_c* i_this, fopAc_ac_c* i_unused, s16 i_unused2,
14+
static fopAc_ac_c* PPCallBack(fopAc_ac_c* i_this, fopAc_ac_c* i_unused, s16 i_unused2,
1515
dBgW_Base::PushPullLabel param_3) {
1616
if (cLib_checkBit(param_3, dBgW_Base::PPLABEL_PUSH) != 0) {
1717
daDoorPush_c* l_this = (daDoorPush_c*)i_this;
1818
l_this->field_0x62e[0]++;
1919
l_this->field_0x62e[1] = 0;
2020
l_this->field_0x62c[0] = 1;
2121
}
22+
23+
return i_this;
2224
}
2325

24-
static void PPCallBack2(fopAc_ac_c* i_this, fopAc_ac_c* i_unused, s16 i_unused2,
26+
static fopAc_ac_c* PPCallBack2(fopAc_ac_c* i_this, fopAc_ac_c* i_unused, s16 i_unused2,
2527
dBgW_Base::PushPullLabel param_3) {
2628
if (cLib_checkBit(param_3, dBgW_Base::PPLABEL_PUSH) != 0) {
2729
daDoorPush_c* l_this = (daDoorPush_c*)i_this;
2830
l_this->field_0x62e[1]++;
2931
l_this->field_0x62e[0] = 0;
3032
l_this->field_0x62c[1] = 1;
3133
}
34+
35+
return i_this;
3236
}
3337

3438
void daDoorPush_c::initBaseMtx() {

src/d/actor/d_a_obj_iceblock.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ enum WALK_TYPE {
2525
WALK_IRON_BALL_HIT,
2626
};
2727

28-
void daObjIceBlk_c::PPCallBack(fopAc_ac_c* i_bgActor, fopAc_ac_c* i_pushActor, s16 i_angle,
28+
fopAc_ac_c* daObjIceBlk_c::PPCallBack(fopAc_ac_c* i_bgActor, fopAc_ac_c* i_pushActor, s16 i_angle,
2929
dBgW_Base::PushPullLabel i_label) {
3030
bool temp_r3 = cLib_checkBit<u8>(i_label, dBgW::PPLABEL_PUSH) != 0;
3131
bool temp_r3_2 = cLib_checkBit<u8>(i_label, dBgW::PPLABEL_PUSH) != 0;
@@ -54,6 +54,7 @@ void daObjIceBlk_c::PPCallBack(fopAc_ac_c* i_bgActor, fopAc_ac_c* i_pushActor, s
5454
}
5555

5656
((daObjIceBlk_c*)i_bgActor)->mPPLabel = i_label;
57+
return i_bgActor;
5758
}
5859

5960
static void rideCallBack(dBgW* i_bgw, fopAc_ac_c* i_bgActor, fopAc_ac_c* i_rideActor) {

0 commit comments

Comments
 (0)