From f510545bc3282b10bf330f3c440286d9974b43d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=A0imek?= Date: Fri, 10 Jun 2022 08:23:43 +0200 Subject: [PATCH] Rename function parameters and use ROTATION_COUNT enum (#39) --- src/actions.cc | 2 +- src/animation.cc | 4 ++-- src/animation.h | 20 ++++++++++---------- src/object.cc | 4 ++-- src/proto_instance.cc | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/actions.cc b/src/actions.cc index b94c2a0..1cbd6b6 100644 --- a/src/actions.cc +++ b/src/actions.cc @@ -1454,7 +1454,7 @@ int _pick_fall(Object* obj, int anim) } } } else if (anim == ANIM_FALL_BACK) { - rotation = (obj->rotation + 3) % 6u; + rotation = (obj->rotation + 3) % ROTATION_COUNT; for (i = 1; i < 3; i++) { tile_num = tileGetTileInDirection(obj->tile, rotation, i); if (_obj_blocking_at(obj, tile_num, obj->elevation) != NULL) { diff --git a/src/animation.cc b/src/animation.cc index 6d6209a..bf714d3 100644 --- a/src/animation.cc +++ b/src/animation.cc @@ -1870,12 +1870,12 @@ int animateMoveObjectToObject(Object* from, Object* to, int a3, int anim, int an int v13; STRUCT_530014* ptr; - int hidden = (to->flags & OBJECT_HIDDEN); + bool hidden = (to->flags & OBJECT_HIDDEN); to->flags |= OBJECT_HIDDEN; v10 = _anim_move(from, to->tile, to->elevation, -1, anim, 0, animationSequenceIndex); - if (hidden == 0) { + if (!hidden) { to->flags &= ~OBJECT_HIDDEN; } diff --git a/src/animation.h b/src/animation.h index abc65d0..8003405 100644 --- a/src/animation.h +++ b/src/animation.h @@ -257,15 +257,15 @@ int _idist(int a1, int a2, int a3, int a4); int _tile_idistance(int tile1, int tile2); int _make_straight_path(Object* a1, int from, int to, STRUCT_530014_28* pathNodes, Object** a5, int a6); int _make_straight_path_func(Object* a1, int from, int to, STRUCT_530014_28* a4, Object** a5, int a6, Object* (*a7)(Object*, int, int)); -int animateMoveObjectToObject(Object* from, Object* to, int a3, int a4, int a5); -int animateMoveObjectToTile(Object* obj, int tile_num, int elev, int a4, int a5, int a6); -int _anim_move(Object* obj, int tile, int elev, int a3, int a4, int a5, int animationSequenceIndex); -int _anim_move_straight_to_tile(Object* obj, int a2, int a3, int fid, int a5, int a6); -int _anim_move_on_stairs(Object* obj, int a2, int a3, int fid, int a5); -int _check_for_falling(Object* obj, int a2, int a3); +int animateMoveObjectToObject(Object* from, Object* to, int a3, int anim, int animationSequenceIndex); +int animateMoveObjectToTile(Object* obj, int tile_num, int elev, int a4, int anim, int animationSequenceIndex); +int _anim_move(Object* obj, int tile, int elev, int a3, int anim, int a5, int animationSequenceIndex); +int _anim_move_straight_to_tile(Object* obj, int tile, int elevation, int anim, int animationSequenceIndex, int flags); +int _anim_move_on_stairs(Object* obj, int tile, int elevation, int anim, int animationSequenceIndex); +int _check_for_falling(Object* obj, int anim, int a3); void _object_move(int index); -void _object_straight_move(int a1); -int _anim_animate(Object* obj, int a2, int a3, int a4); +void _object_straight_move(int index); +int _anim_animate(Object* obj, int anim, int animationSequenceIndex, int flags); void _object_animate(); void _object_anim_compact(); int _check_move(int* a1); @@ -274,8 +274,8 @@ int _dude_run(int a1); void _dude_fidget(); void _dude_stand(Object* obj, int rotation, int fid); void _dude_standup(Object* a1); -int actionRotate(Object* obj, int a2, int a3); -int _anim_change_fid(Object* obj, int a2, int fid); +int actionRotate(Object* obj, int delta, int animationSequenceIndex); +int _anim_change_fid(Object* obj, int animationSequenceIndex, int fid); void _anim_stop(); int _check_gravity(int tile, int elevation); unsigned int _compute_tpf(Object* object, int fid); diff --git a/src/object.cc b/src/object.cc index e10149b..0594ba8 100644 --- a/src/object.cc +++ b/src/object.cc @@ -3438,11 +3438,11 @@ void _obj_light_table_init() { for (int s = 0; s < 2; s++) { int v4 = gCenterTile + s; - for (int i = 0; i < 6; i++) { + for (int i = 0; i < ROTATION_COUNT; i++) { int v15 = 8; int* p = _light_offsets[v4 & 1][i]; for (int j = 0; j < 8; j++) { - int tile = tileGetTileInDirection(v4, (i + 1) % 6, j); + int tile = tileGetTileInDirection(v4, (i + 1) % ROTATION_COUNT, j); for (int m = 0; m < v15; m++) { *p++ = tileGetTileInDirection(tile, i, m + 1) - v4; diff --git a/src/proto_instance.cc b/src/proto_instance.cc index 5fe2060..a246990 100644 --- a/src/proto_instance.cc +++ b/src/proto_instance.cc @@ -2198,7 +2198,7 @@ int _objPMAttemptPlacement(Object* obj, int tile, int elevation) for (int v4 = 1; v4 <= 100; v4++) { // TODO: Check. v7++; - v9 = tileGetTileInDirection(v9, v7 % 6, 1); + v9 = tileGetTileInDirection(v9, v7 % ROTATION_COUNT, 1); if (_wmEvalTileNumForPlacement(v9) != 0) { break; }