@@ -1060,21 +1060,21 @@ int _action_climb_ladder(Object* a1, Object* a2)
10601060}
10611061
10621062// 0x411F2C
1063- int _action_use_an_item_on_object (Object* a1 , Object* a2 , Object* a3 )
1063+ int _action_use_an_item_on_object (Object* user , Object* targetObj , Object* item )
10641064{
10651065 Proto* proto = nullptr ;
1066- int type = FID_TYPE (a2 ->fid );
1066+ int type = FID_TYPE (targetObj ->fid );
10671067 int sceneryType = -1 ;
10681068 if (type == OBJ_TYPE_SCENERY ) {
1069- if (protoGetProto (a2 ->pid , &proto) == -1 ) {
1069+ if (protoGetProto (targetObj ->pid , &proto) == -1 ) {
10701070 return -1 ;
10711071 }
10721072
10731073 sceneryType = proto->scenery .type ;
10741074 }
10751075
1076- if (sceneryType != SCENERY_TYPE_LADDER_UP || a3 != nullptr ) {
1077- if (a1 == gDude ) {
1076+ if (sceneryType != SCENERY_TYPE_LADDER_UP || item != nullptr ) {
1077+ if (user == gDude ) {
10781078 int anim = FID_ANIM_TYPE (gDude ->fid );
10791079 if (anim == ANIM_WALK || anim == ANIM_RUNNING ) {
10801080 reg_anim_clear (gDude );
@@ -1085,72 +1085,72 @@ int _action_use_an_item_on_object(Object* a1, Object* a2, Object* a3)
10851085 int actionPoints;
10861086 if (isInCombat ()) {
10871087 animationRequestOptions = ANIMATION_REQUEST_RESERVED ;
1088- actionPoints = a1 ->data .critter .combat .ap ;
1088+ actionPoints = user ->data .critter .combat .ap ;
10891089 } else {
10901090 animationRequestOptions = ANIMATION_REQUEST_UNRESERVED ;
10911091 actionPoints = -1 ;
10921092 }
10931093
1094- if (a1 == gDude ) {
1094+ if (user == gDude ) {
10951095 animationRequestOptions = ANIMATION_REQUEST_RESERVED ;
10961096 }
10971097
10981098 reg_anim_begin (animationRequestOptions);
10991099
1100- if (actionPoints != -1 || objectGetDistanceBetween (a1, a2 ) < 5 ) {
1101- animationRegisterMoveToObject (a1, a2 , actionPoints, 0 );
1100+ if (actionPoints != -1 || objectGetDistanceBetween (user, targetObj ) < 5 ) {
1101+ animationRegisterMoveToObject (user, targetObj , actionPoints, 0 );
11021102 } else {
1103- animationRegisterRunToObject (a1, a2 , -1 , 0 );
1103+ animationRegisterRunToObject (user, targetObj , -1 , 0 );
11041104 }
11051105
1106- animationRegisterCallbackForced (a1, a2 , (AnimationCallback*)_is_next_to, -1 );
1106+ animationRegisterCallbackForced (user, targetObj , (AnimationCallback*)_is_next_to, -1 );
11071107
1108- if (a3 == nullptr ) {
1109- animationRegisterCallback (a1, a2 , (AnimationCallback*)_check_scenery_ap_cost, -1 );
1108+ if (item == nullptr ) {
1109+ animationRegisterCallback (user, targetObj , (AnimationCallback*)_check_scenery_ap_cost, -1 );
11101110 }
11111111
1112- int a2a = (a1 ->fid & 0xF000 ) >> 12 ;
1113- if (a2a != 0 ) {
1114- const char * sfx = sfxBuildCharName (a1 , ANIM_PUT_AWAY , CHARACTER_SOUND_EFFECT_UNUSED );
1115- animationRegisterPlaySoundEffect (a1 , sfx, -1 );
1116- animationRegisterAnimate (a1 , ANIM_PUT_AWAY , 0 );
1112+ int weaponAnimCode = (user ->fid & 0xF000 ) >> 12 ;
1113+ if (weaponAnimCode != 0 ) {
1114+ const char * sfx = sfxBuildCharName (user , ANIM_PUT_AWAY , CHARACTER_SOUND_EFFECT_UNUSED );
1115+ animationRegisterPlaySoundEffect (user , sfx, -1 );
1116+ animationRegisterAnimate (user , ANIM_PUT_AWAY , 0 );
11171117 }
11181118
11191119 int anim;
1120- int objectType = FID_TYPE (a2 ->fid );
1121- if (objectType == OBJ_TYPE_CRITTER && _critter_is_prone (a2 )) {
1120+ int objectType = FID_TYPE (targetObj ->fid );
1121+ if (objectType == OBJ_TYPE_CRITTER && _critter_is_prone (targetObj )) {
11221122 anim = ANIM_MAGIC_HANDS_GROUND ;
11231123 } else if (objectType == OBJ_TYPE_SCENERY && (proto->scenery .extendedFlags & 0x01 ) != 0 ) {
11241124 anim = ANIM_MAGIC_HANDS_GROUND ;
11251125 } else {
11261126 anim = ANIM_MAGIC_HANDS_MIDDLE ;
11271127 }
11281128
1129- if (sceneryType != SCENERY_TYPE_STAIRS && a3 == nullptr ) {
1130- animationRegisterAnimate (a1 , anim, -1 );
1129+ if (sceneryType != SCENERY_TYPE_STAIRS && item == nullptr ) {
1130+ animationRegisterAnimate (user , anim, -1 );
11311131 }
11321132
1133- if (a3 != nullptr ) {
1133+ if (item != nullptr ) {
11341134 // TODO: Get rid of cast.
1135- animationRegisterCallback3 (a1, a2, a3 , (AnimationCallback3*)_obj_use_item_on, -1 );
1135+ animationRegisterCallback3 (user, targetObj, item , (AnimationCallback3*)_obj_use_item_on, -1 );
11361136 } else {
1137- animationRegisterCallback (a1, a2 , (AnimationCallback*)_obj_use, -1 );
1137+ animationRegisterCallback (user, targetObj , (AnimationCallback*)_obj_use, -1 );
11381138 }
11391139
1140- if (a2a != 0 ) {
1141- animationRegisterTakeOutWeapon (a1, a2a , -1 );
1140+ if (weaponAnimCode != 0 ) {
1141+ animationRegisterTakeOutWeapon (user, weaponAnimCode , -1 );
11421142 }
11431143
11441144 return reg_anim_end ();
11451145 }
11461146
1147- return _action_climb_ladder (a1, a2 );
1147+ return _action_climb_ladder (user, targetObj );
11481148}
11491149
11501150// 0x412114
1151- int _action_use_an_object (Object* a1 , Object* a2 )
1151+ int _action_use_an_object (Object* user , Object* targetObj )
11521152{
1153- return _action_use_an_item_on_object (a1, a2 , nullptr );
1153+ return _action_use_an_item_on_object (user, targetObj , nullptr );
11541154}
11551155
11561156// 0x412134
@@ -1322,53 +1322,53 @@ static int _action_use_skill_in_combat_error(Object* critter)
13221322
13231323// skill_use
13241324// 0x41255C
1325- int actionUseSkill (Object* a1 , Object* a2 , int skill)
1325+ int actionUseSkill (Object* user , Object* target , int skill)
13261326{
13271327 switch (skill) {
13281328 case SKILL_FIRST_AID :
13291329 case SKILL_DOCTOR :
13301330 if (isInCombat ()) {
13311331 // NOTE: Uninline.
1332- return _action_use_skill_in_combat_error (a1 );
1332+ return _action_use_skill_in_combat_error (user );
13331333 }
13341334
1335- if (PID_TYPE (a2 ->pid ) != OBJ_TYPE_CRITTER ) {
1335+ if (PID_TYPE (target ->pid ) != OBJ_TYPE_CRITTER ) {
13361336 return -1 ;
13371337 }
13381338 break ;
13391339 case SKILL_LOCKPICK :
13401340 if (isInCombat ()) {
13411341 // NOTE: Uninline.
1342- return _action_use_skill_in_combat_error (a1 );
1342+ return _action_use_skill_in_combat_error (user );
13431343 }
13441344
1345- if (PID_TYPE (a2 ->pid ) != OBJ_TYPE_ITEM && PID_TYPE (a2 ->pid ) != OBJ_TYPE_SCENERY ) {
1345+ if (PID_TYPE (target ->pid ) != OBJ_TYPE_ITEM && PID_TYPE (target ->pid ) != OBJ_TYPE_SCENERY ) {
13461346 return -1 ;
13471347 }
13481348
13491349 break ;
13501350 case SKILL_STEAL :
13511351 if (isInCombat ()) {
13521352 // NOTE: Uninline.
1353- return _action_use_skill_in_combat_error (a1 );
1353+ return _action_use_skill_in_combat_error (user );
13541354 }
13551355
1356- if (PID_TYPE (a2 ->pid ) != OBJ_TYPE_ITEM && PID_TYPE (a2 ->pid ) != OBJ_TYPE_CRITTER ) {
1356+ if (PID_TYPE (target ->pid ) != OBJ_TYPE_ITEM && PID_TYPE (target ->pid ) != OBJ_TYPE_CRITTER ) {
13571357 return -1 ;
13581358 }
13591359
1360- if (a2 == a1 ) {
1360+ if (target == user ) {
13611361 return -1 ;
13621362 }
13631363
13641364 break ;
13651365 case SKILL_TRAPS :
13661366 if (isInCombat ()) {
13671367 // NOTE: Uninline.
1368- return _action_use_skill_in_combat_error (a1 );
1368+ return _action_use_skill_in_combat_error (user );
13691369 }
13701370
1371- if (PID_TYPE (a2 ->pid ) == OBJ_TYPE_CRITTER ) {
1371+ if (PID_TYPE (target ->pid ) == OBJ_TYPE_CRITTER ) {
13721372 return -1 ;
13731373 }
13741374
@@ -1377,18 +1377,18 @@ int actionUseSkill(Object* a1, Object* a2, int skill)
13771377 case SKILL_REPAIR :
13781378 if (isInCombat ()) {
13791379 // NOTE: Uninline.
1380- return _action_use_skill_in_combat_error (a1 );
1380+ return _action_use_skill_in_combat_error (user );
13811381 }
13821382
1383- if (PID_TYPE (a2 ->pid ) != OBJ_TYPE_CRITTER ) {
1383+ if (PID_TYPE (target ->pid ) != OBJ_TYPE_CRITTER ) {
13841384 break ;
13851385 }
13861386
1387- if (critterGetKillType (a2 ) == KILL_TYPE_ROBOT ) {
1387+ if (critterGetKillType (target ) == KILL_TYPE_ROBOT ) {
13881388 break ;
13891389 }
13901390
1391- if (critterGetKillType (a2 ) == KILL_TYPE_BRAHMIN
1391+ if (critterGetKillType (target ) == KILL_TYPE_BRAHMIN
13921392 && skill == SKILL_SCIENCE ) {
13931393 break ;
13941394 }
@@ -1398,7 +1398,7 @@ int actionUseSkill(Object* a1, Object* a2, int skill)
13981398 int targetType = SCIENCE_REPAIR_TARGET_TYPE_DEFAULT ;
13991399 configGetInt (&gSfallConfig , SFALL_CONFIG_MISC_KEY , SFALL_CONFIG_SCIENCE_REPAIR_TARGET_TYPE_KEY , &targetType);
14001400 if (targetType == SCIENCE_REPAIR_TARGET_TYPE_DUDE ) {
1401- if (a2 == gDude ) {
1401+ if (target == gDude ) {
14021402 break ;
14031403 }
14041404 } else if (targetType == SCIENCE_REPAIR_TARGET_TYPE_ANYONE ) {
@@ -1418,7 +1418,7 @@ int actionUseSkill(Object* a1, Object* a2, int skill)
14181418 // skill in entire party, and this skill is his/her own best.
14191419 Object* performer = gDude ;
14201420
1421- if (a1 == gDude ) {
1421+ if (user == gDude ) {
14221422 Object* partyMember = partyMemberGetBestInSkill (skill);
14231423
14241424 if (partyMember == gDude ) {
@@ -1451,7 +1451,7 @@ int actionUseSkill(Object* a1, Object* a2, int skill)
14511451
14521452 if (partyMember != nullptr ) {
14531453 bool isDude = false ;
1454- if (objectGetDistanceBetween (gDude , a2 ) <= 1 ) {
1454+ if (objectGetDistanceBetween (gDude , target ) <= 1 ) {
14551455 isDude = true ;
14561456 }
14571457
@@ -1478,21 +1478,21 @@ int actionUseSkill(Object* a1, Object* a2, int skill)
14781478
14791479 if (isInCombat ()) {
14801480 reg_anim_begin (ANIMATION_REQUEST_RESERVED );
1481- animationRegisterMoveToObject (performer, a2 , performer->data .critter .combat .ap , 0 );
1481+ animationRegisterMoveToObject (performer, target , performer->data .critter .combat .ap , 0 );
14821482 } else {
1483- reg_anim_begin (a1 == gDude ? ANIMATION_REQUEST_RESERVED : ANIMATION_REQUEST_UNRESERVED );
1484- if (a2 != gDude ) {
1485- if (objectGetDistanceBetween (performer, a2 ) >= 5 ) {
1486- animationRegisterRunToObject (performer, a2 , -1 , 0 );
1483+ reg_anim_begin (user == gDude ? ANIMATION_REQUEST_RESERVED : ANIMATION_REQUEST_UNRESERVED );
1484+ if (target != gDude ) {
1485+ if (objectGetDistanceBetween (performer, target ) >= 5 ) {
1486+ animationRegisterRunToObject (performer, target , -1 , 0 );
14871487 } else {
1488- animationRegisterMoveToObject (performer, a2 , -1 , 0 );
1488+ animationRegisterMoveToObject (performer, target , -1 , 0 );
14891489 }
14901490 }
14911491 }
14921492
1493- animationRegisterCallbackForced (performer, a2 , (AnimationCallback*)_is_next_to, -1 );
1493+ animationRegisterCallbackForced (performer, target , (AnimationCallback*)_is_next_to, -1 );
14941494
1495- int anim = (FID_TYPE (a2 ->fid ) == OBJ_TYPE_CRITTER && _critter_is_prone (a2 )) ? ANIM_MAGIC_HANDS_GROUND : ANIM_MAGIC_HANDS_MIDDLE ;
1495+ int anim = (FID_TYPE (target ->fid ) == OBJ_TYPE_CRITTER && _critter_is_prone (target )) ? ANIM_MAGIC_HANDS_GROUND : ANIM_MAGIC_HANDS_MIDDLE ;
14961496 int fid = buildFid (OBJ_TYPE_CRITTER , performer->fid & 0xFFF , anim, 0 , performer->rotation + 1 );
14971497
14981498 CacheEntry* artHandle;
@@ -1504,7 +1504,7 @@ int actionUseSkill(Object* a1, Object* a2, int skill)
15041504
15051505 animationRegisterAnimate (performer, anim, -1 );
15061506 // TODO: Get rid of casts.
1507- animationRegisterCallback3 (performer, a2 , (void *)skill, (AnimationCallback3*)_obj_use_skill_on, -1 );
1507+ animationRegisterCallback3 (performer, target , (void *)skill, (AnimationCallback3*)_obj_use_skill_on, -1 );
15081508 return reg_anim_end ();
15091509}
15101510
0 commit comments