From 06f5e7a218c0a67f135c32c58084383dcb127f7a Mon Sep 17 00:00:00 2001 From: rr- Date: Thu, 18 Feb 2021 16:40:32 +0100 Subject: [PATCH] rename the repository --- .github/workflows/release.yml | 4 +- Makefile | 2 +- README.md | 8 ++-- TR1Main.json => Tomb1Main.json | 0 bin/README.md | 4 +- bin/tombati.exe | Bin 397312 -> 397312 bytes docs/progress.txt | 2 +- src/3dsystem/3d_gen.h | 4 +- src/3dsystem/3d_insert.h | 4 +- src/3dsystem/phd_math.h | 4 +- src/3dsystem/scalespr.h | 4 +- src/game/box.h | 4 +- src/game/camera.h | 4 +- src/game/collide.h | 4 +- src/game/const.h | 4 +- src/game/control.c | 10 ++--- src/game/control.h | 6 +-- src/game/data.h | 4 +- src/game/demo.h | 4 +- src/game/draw.c | 2 +- src/game/draw.h | 6 +-- src/game/effects.c | 4 +- src/game/effects.h | 6 +-- src/game/health.c | 10 ++--- src/game/health.h | 6 +-- src/game/inv.h | 4 +- src/game/items.c | 2 +- src/game/items.h | 6 +-- src/game/lara.c | 20 ++++----- src/game/lara.h | 18 ++++---- src/game/laramisc.c | 6 +-- src/game/larasurf.c | 2 +- src/game/laraswim.c | 12 ++--- src/game/lot.c | 2 +- src/game/lot.h | 6 +-- src/game/misc.h | 4 +- src/game/savegame.h | 4 +- src/game/setup.c | 10 ++--- src/game/setup.h | 6 +-- src/game/text.c | 50 ++++++++++----------- src/game/text.h | 6 +-- src/game/types.h | 4 +- src/json_utils.h | 4 +- src/main.c | 79 +++++++++++++++++---------------- src/mod.c | 46 +++++++++---------- src/mod.h | 40 ++++++++--------- src/specific/display.h | 4 +- src/specific/file.c | 6 +-- src/specific/file.h | 6 +-- src/specific/frontend.h | 4 +- src/specific/game.c | 4 +- src/specific/game.h | 6 +-- src/specific/init.c | 2 +- src/specific/init.h | 6 +-- src/specific/input.c | 12 ++--- src/specific/input.h | 6 +-- src/specific/output.c | 6 +-- src/specific/output.h | 6 +-- src/specific/shed.h | 4 +- src/specific/sndpc.h | 4 +- src/util.c | 4 +- src/util.h | 10 ++--- 62 files changed, 266 insertions(+), 265 deletions(-) rename TR1Main.json => Tomb1Main.json (100%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 863555bf7..288e77a37 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ jobs: - name: Build project run: | make build - 7z a release.zip ./bin/tombati.exe ./build/TR1Main.dll TR1Main.json + 7z a release.zip ./bin/tombati.exe ./build/Tomb1Main.dll Tomb1Main.json - name: Create Release id: create_release uses: actions/create-release@v1 @@ -40,5 +40,5 @@ jobs: with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: release.zip - asset_name: TR1Main-${{ steps.get_version.outputs.VERSION }}.zip + asset_name: Tomb1Main-${{ steps.get_version.outputs.VERSION }}.zip asset_content_type: application/zip diff --git a/Makefile b/Makefile index 990536f03..e1238b925 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ CC=i686-w64-mingw32-gcc CFLAGS=-W -static -shared -Isrc build: $(shell find src) - $(CC) $(CFLAGS) $(shell find src -type f -iname '*.c') -ldbghelp -o build/TR1Main.dll + $(CC) $(CFLAGS) $(shell find src -type f -iname '*.c') -ldbghelp -o build/Tomb1Main.dll docker_build: docker build -t tr1main . diff --git a/README.md b/README.md index fea45540b..de0fd561a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# TR1Main +# Tomb1Main This is a dynamic library for the classic Tomb Raider I game (TombATI version). The purpose of the library is to reimplement all the routines performed by the @@ -10,13 +10,13 @@ This project is inspired by Arsunt's ## Installing Get a copy of the latest release from -[here](https://github.com/rr-/TR1Main/releases) and unpack the contents to your -game directory. Make sure you overwrite existing files. Currently TR1Main +[here](https://github.com/rr-/Tomb1Main/releases) and unpack the contents to your +game directory. Make sure you overwrite existing files. Currently Tomb1Main requires you to have the TombATI patch installed to work. ## Configuring -To configure TR1Main, edit the `TR1Main.json` file in your text editor such as +To configure Tomb1Main, edit the `Tomb1Main.json` file in your text editor such as Notepad. Currently the following configuration options are supported: diff --git a/TR1Main.json b/Tomb1Main.json similarity index 100% rename from TR1Main.json rename to Tomb1Main.json diff --git a/bin/README.md b/bin/README.md index 145ad72f6..48f54f261 100644 --- a/bin/README.md +++ b/bin/README.md @@ -1,4 +1,4 @@ -## TR1Main binaries +## Tomb1Main binaries -- `tombati.exe` - a patched version of TombATI executable that loads the `TR1Main.dll` library. +- `tombati.exe` - a patched version of TombATI executable that loads the `Tomb1Main.dll` library. - `tombati.orig.exe` - the original TombATI version. diff --git a/bin/tombati.exe b/bin/tombati.exe index abd685f214c1d5806c8dcefbc9b8fb3d57596395..ff214718e8d70c9b868ee122b1ca00b8b567e5c6 100755 GIT binary patch delta 48 tcmZozAkhFsEsQNpEzB(}Ev#GE7VwGeH_&GQ0T>;UpPRIO6CaxoBLG;R45$DA delta 49 ucmZozAkhFsEsQNpEzB(}Ev#GE7Vrt}HPB}O0T>+;w0#R7n-3!s0|NkHRtvfS diff --git a/docs/progress.txt b/docs/progress.txt index 125057a16..9218cb5bd 100644 --- a/docs/progress.txt +++ b/docs/progress.txt @@ -1,6 +1,6 @@ # Flags: # - to do -# * to do, called by TR1Main +# * to do, called by Tomb1Main # + fully decompiled # # Name Offset Size Flags diff --git a/src/3dsystem/3d_gen.h b/src/3dsystem/3d_gen.h index b542c6a03..728fbd038 100644 --- a/src/3dsystem/3d_gen.h +++ b/src/3dsystem/3d_gen.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_3DSYSTEM_3D_GEN_H -#define TR1MAIN_3DSYSTEM_3D_GEN_H +#ifndef TOMB1MAIN_3DSYSTEM_3D_GEN_H +#define TOMB1MAIN_3DSYSTEM_3D_GEN_H // clang-format off #define S_InsertRoom ((void __cdecl(*)(int16_t* objptr))0x00401BD0) diff --git a/src/3dsystem/3d_insert.h b/src/3dsystem/3d_insert.h index e45886c99..f4cdb2a08 100644 --- a/src/3dsystem/3d_insert.h +++ b/src/3dsystem/3d_insert.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_3DSYSTEM_3D_INSERT_H -#define TR1MAIN_3DSYSTEM_3D_INSERT_H +#ifndef TOMB1MAIN_3DSYSTEM_3D_INSERT_H +#define TOMB1MAIN_3DSYSTEM_3D_INSERT_H // clang-format off #define Insert2DLine ((void __cdecl(*)(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t z, uint8_t color))0x00402710) diff --git a/src/3dsystem/phd_math.h b/src/3dsystem/phd_math.h index 62b0a0f9d..63c034ae8 100644 --- a/src/3dsystem/phd_math.h +++ b/src/3dsystem/phd_math.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_3DSYSTEM_PHD_MATH_H -#define TR1MAIN_3DSYSTEM_PHD_MATH_H +#ifndef TOMB1MAIN_3DSYSTEM_PHD_MATH_H +#define TOMB1MAIN_3DSYSTEM_PHD_MATH_H // clang-format off #define phd_atan ((int32_t __cdecl(*)(int32_t x, int32_t y))0x0042A8A0) diff --git a/src/3dsystem/scalespr.h b/src/3dsystem/scalespr.h index df0efcf77..34e2a2f64 100644 --- a/src/3dsystem/scalespr.h +++ b/src/3dsystem/scalespr.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_3DSYSTEM_SCALESPR_H -#define TR1MAIN_3DSYSTEM_SCALESPR_H +#ifndef TOMB1MAIN_3DSYSTEM_SCALESPR_H +#define TOMB1MAIN_3DSYSTEM_SCALESPR_H // clang-format off #define S_DrawUISprite ((void __cdecl(*)(int32_t x, int32_t y, int32_t scale, int16_t sprnum, int16_t brightness))0x00435D80) diff --git a/src/game/box.h b/src/game/box.h index b2a58dd2f..d177fa08f 100644 --- a/src/game/box.h +++ b/src/game/box.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_GAME_BOX_H -#define TR1MAIN_GAME_BOX_H +#ifndef TOMB1MAIN_GAME_BOX_H +#define TOMB1MAIN_GAME_BOX_H #include "game/types.h" diff --git a/src/game/camera.h b/src/game/camera.h index 487893ea8..158794f12 100644 --- a/src/game/camera.h +++ b/src/game/camera.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_GAME_CAMERA_H -#define TR1MAIN_GAME_CAMERA_H +#ifndef TOMB1MAIN_GAME_CAMERA_H +#define TOMB1MAIN_GAME_CAMERA_H // clang-format off #define CalculateCamera ((void __cdecl(*)())0x00410B40) diff --git a/src/game/collide.h b/src/game/collide.h index 4346aa905..ffa96951e 100644 --- a/src/game/collide.h +++ b/src/game/collide.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_GAME_COLLIDE_H -#define TR1MAIN_GAME_COLLIDE_H +#ifndef TOMB1MAIN_GAME_COLLIDE_H +#define TOMB1MAIN_GAME_COLLIDE_H #include "types.h" diff --git a/src/game/const.h b/src/game/const.h index eccdde8f0..fcc26c1b6 100644 --- a/src/game/const.h +++ b/src/game/const.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_GAME_CONST_H -#define TR1MAIN_GAME_CONST_H +#ifndef TOMB1MAIN_GAME_CONST_H +#define TOMB1MAIN_GAME_CONST_H #define ONE_DEGREE 182 #define NUM_PU 3 diff --git a/src/game/control.c b/src/game/control.c index 3d5fd9d82..611781547 100644 --- a/src/game/control.c +++ b/src/game/control.c @@ -125,7 +125,7 @@ int32_t __cdecl ControlPhase(int32_t nframes, int demo_mode) ++SaveGame[0].timer; --HealthBarTimer; - if (TR1MConfig.disable_healing_between_levels) { + if (Tomb1MConfig.disable_healing_between_levels) { int lara_found = 0; for (int i = 0; i < LevelItemCount; i++) { if (Items[i].object_number == O_LARA) { @@ -133,13 +133,13 @@ int32_t __cdecl ControlPhase(int32_t nframes, int demo_mode) } } if (lara_found) { - TR1MData.stored_lara_health = + Tomb1MData.stored_lara_health = LaraItem ? LaraItem->hit_points : LARA_HITPOINTS; } } - if (TR1MConfig.healthbar_showing_mode == TR1M_BSM_ALWAYS - || (TR1MConfig.healthbar_showing_mode == TR1M_BSM_FLASHING + if (Tomb1MConfig.healthbar_showing_mode == Tomb1M_BSM_ALWAYS + || (Tomb1MConfig.healthbar_showing_mode == Tomb1M_BSM_FLASHING && LaraItem && LaraItem->hit_points < (LARA_HITPOINTS * 20) / 100)) { HealthBarTimer = 1; @@ -148,7 +148,7 @@ int32_t __cdecl ControlPhase(int32_t nframes, int demo_mode) return 0; } -void TR1MInjectGameControl() +void Tomb1MInjectGameControl() { INJECT(0x004133B0, ControlPhase); } diff --git a/src/game/control.h b/src/game/control.h index 85ca0cecb..28a462b26 100644 --- a/src/game/control.h +++ b/src/game/control.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_GAME_CONTROL_H -#define TR1MAIN_GAME_CONTROL_H +#ifndef TOMB1MAIN_GAME_CONTROL_H +#define TOMB1MAIN_GAME_CONTROL_H #include @@ -14,6 +14,6 @@ int32_t __cdecl ControlPhase(int32_t nframes, int demo_mode); -void TR1MInjectGameControl(); +void Tomb1MInjectGameControl(); #endif diff --git a/src/game/data.h b/src/game/data.h index 714a7617d..4bb3fc926 100644 --- a/src/game/data.h +++ b/src/game/data.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_GAME_DATA_H -#define TR1MAIN_GAME_DATA_H +#ifndef TOMB1MAIN_GAME_DATA_H +#define TOMB1MAIN_GAME_DATA_H #include "game/const.h" #include "game/types.h" diff --git a/src/game/demo.h b/src/game/demo.h index c2e9edb23..12cdfadc3 100644 --- a/src/game/demo.h +++ b/src/game/demo.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_GAME_DEMO_H -#define TR1MAIN_GAME_DEMO_H +#ifndef TOMB1MAIN_GAME_DEMO_H +#define TOMB1MAIN_GAME_DEMO_H // clang-format off #define GetDemoInput ((void __cdecl(*)())0x00415D70) diff --git a/src/game/draw.c b/src/game/draw.c index 5c70e7110..0e735fc6a 100644 --- a/src/game/draw.c +++ b/src/game/draw.c @@ -63,7 +63,7 @@ void __cdecl PrintRooms(int16_t room_number) r->bound_top = PhdWinMaxY; } -void TR1MInjectGameDraw() +void Tomb1MInjectGameDraw() { INJECT(0x004171E0, PrintRooms); } diff --git a/src/game/draw.h b/src/game/draw.h index 3c82dd10e..af814534c 100644 --- a/src/game/draw.h +++ b/src/game/draw.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_GAME_DRAW_H -#define TR1MAIN_GAME_DRAW_H +#ifndef TOMB1MAIN_GAME_DRAW_H +#define TOMB1MAIN_GAME_DRAW_H #include @@ -11,6 +11,6 @@ void __cdecl PrintRooms(int16_t room_number); -void TR1MInjectGameDraw(); +void Tomb1MInjectGameDraw(); #endif diff --git a/src/game/effects.c b/src/game/effects.c index d483ef090..d852359fd 100644 --- a/src/game/effects.c +++ b/src/game/effects.c @@ -5,7 +5,7 @@ void __cdecl FxChainBlock(ITEM_INFO* item) { - if (TR1MConfig.fix_tihocan_secret_sound) { + if (Tomb1MConfig.fix_tihocan_secret_sound) { SoundEffect(33, NULL, 0); FlipEffect = -1; } else { @@ -21,7 +21,7 @@ void __cdecl FxChainBlock(ITEM_INFO* item) } } -void TR1MInjectGameEffects() +void Tomb1MInjectGameEffects() { INJECT(0x0041AD00, FxChainBlock); } diff --git a/src/game/effects.h b/src/game/effects.h index be9b7da81..e52999290 100644 --- a/src/game/effects.h +++ b/src/game/effects.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_GAME_EFFECTS_H -#define TR1MAIN_GAME_EFFECTS_H +#ifndef TOMB1MAIN_GAME_EFFECTS_H +#define TOMB1MAIN_GAME_EFFECTS_H #include #include "game/types.h" @@ -13,6 +13,6 @@ void __cdecl FxChainBlock(ITEM_INFO* item); -void TR1MInjectGameEffects(); +void Tomb1MInjectGameEffects(); #endif diff --git a/src/game/health.c b/src/game/health.c index f2591e154..57e75808d 100644 --- a/src/game/health.c +++ b/src/game/health.c @@ -14,12 +14,12 @@ void __cdecl DrawGameInfo() DrawAirBar(); DrawPickups(); - if (TR1MConfig.enable_enemy_healthbar && Lara.target) { - TR1MRenderBar( + if (Tomb1MConfig.enable_enemy_healthbar && Lara.target) { + Tomb1MRenderBar( Lara.target->hit_points, Objects[Lara.target->object_number].hit_points * (SaveGame[0].bonus_flag ? 2 : 1), - TR1M_BAR_ENEMY_HEALTH); + Tomb1M_BAR_ENEMY_HEALTH); } } @@ -144,7 +144,7 @@ void __cdecl DrawPickups() pu->duration = 0; } else { S_DrawUISprite( - x, y, TR1MGetRenderScale(12288), pu->sprnum, 4096); + x, y, Tomb1MGetRenderScale(12288), pu->sprnum, 4096); x -= sprite_width; } } @@ -162,7 +162,7 @@ void __cdecl AddDisplayPickup(int16_t objnum) } } -void TR1MInjectGameHealth() +void Tomb1MInjectGameHealth() { INJECT(0x0041DD00, DrawGameInfo); INJECT(0x0041DEA0, DrawHealthBar); diff --git a/src/game/health.h b/src/game/health.h index 7cc2f1c4a..09950aaf9 100644 --- a/src/game/health.h +++ b/src/game/health.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_GAME_HEALTH_H -#define TR1MAIN_GAME_HEALTH_H +#ifndef TOMB1MAIN_GAME_HEALTH_H +#define TOMB1MAIN_GAME_HEALTH_H void __cdecl MakeAmmoString(char* string); void __cdecl DrawAmmoInfo(); @@ -10,6 +10,6 @@ void __cdecl AddDisplayPickup(int16_t objnum); void __cdecl InitialisePickUpDisplay(); void __cdecl DrawPickups(); -void TR1MInjectGameHealth(); +void Tomb1MInjectGameHealth(); #endif diff --git a/src/game/inv.h b/src/game/inv.h index d0ed8fe98..c48ba5562 100644 --- a/src/game/inv.h +++ b/src/game/inv.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_GAME_INV_H -#define TR1MAIN_GAME_INV_H +#ifndef TOMB1MAIN_GAME_INV_H +#define TOMB1MAIN_GAME_INV_H // clang-format off #define Inv_RemoveItem ((void __cdecl(*)(int16_t item_num))0x004212A0) diff --git a/src/game/items.c b/src/game/items.c index c490d4d48..c02b6e36c 100644 --- a/src/game/items.c +++ b/src/game/items.c @@ -15,7 +15,7 @@ void __cdecl InitialiseFXArray() fx->next_fx = NO_ITEM; } -void TR1MInjectGameItems() +void Tomb1MInjectGameItems() { INJECT(0x00422250, InitialiseFXArray); } diff --git a/src/game/items.h b/src/game/items.h index 8971c6996..5ecc85ad2 100644 --- a/src/game/items.h +++ b/src/game/items.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_GAME_ITEMS_H -#define TR1MAIN_GAME_ITEMS_H +#ifndef TOMB1MAIN_GAME_ITEMS_H +#define TOMB1MAIN_GAME_ITEMS_H // clang-format off #define InitialiseItemArray ((void __cdecl(*)(int item_count))0x00421B10) @@ -8,6 +8,6 @@ void __cdecl InitialiseFXArray(); -void TR1MInjectGameItems(); +void Tomb1MInjectGameItems(); #endif diff --git a/src/game/lara.c b/src/game/lara.c index 36b9e8376..0c5716f7c 100644 --- a/src/game/lara.c +++ b/src/game/lara.c @@ -12,7 +12,7 @@ #include "mod.h" #include "util.h" -void TR1MLookLeftRight() +void Tomb1MLookLeftRight() { Camera.type = CAM_LOOK; if (Input & IN_LEFT) { @@ -31,7 +31,7 @@ void TR1MLookLeftRight() } } -void __cdecl TR1MLookUpDown() +void __cdecl Tomb1MLookUpDown() { Camera.type = CAM_LOOK; if (Input & IN_FORWARD) { @@ -50,7 +50,7 @@ void __cdecl TR1MLookUpDown() } } -void TR1MResetLook() +void Tomb1MResetLook() { if (Camera.type == CAM_LOOK) { return; @@ -84,11 +84,11 @@ void __cdecl LaraAboveWater(ITEM_INFO* item, COLL_INFO* coll) coll->enable_spaz = 1; coll->enable_baddie_push = 1; - if (TR1MConfig.enable_enhanced_look) { + if (Tomb1MConfig.enable_enhanced_look) { if (Input & IN_LOOK) { - TR1MLookLeftRight(); + Tomb1MLookLeftRight(); } else { - TR1MResetLook(); + Tomb1MResetLook(); } } @@ -336,7 +336,7 @@ void __cdecl LaraAsFastBack(ITEM_INFO* item, COLL_INFO* coll) void __cdecl LaraAsTurnR(ITEM_INFO* item, COLL_INFO* coll) { if (item->hit_points <= 0 - || (TR1MConfig.enable_enhanced_look && (Input & IN_LOOK))) { + || (Tomb1MConfig.enable_enhanced_look && (Input & IN_LOOK))) { item->goal_anim_state = AS_STOP; return; } @@ -366,7 +366,7 @@ void __cdecl LaraAsTurnR(ITEM_INFO* item, COLL_INFO* coll) void __cdecl LaraAsTurnL(ITEM_INFO* item, COLL_INFO* coll) { if (item->hit_points <= 0 - || (TR1MConfig.enable_enhanced_look && (Input & IN_LOOK))) { + || (Tomb1MConfig.enable_enhanced_look && (Input & IN_LOOK))) { item->goal_anim_state = AS_STOP; return; } @@ -496,7 +496,7 @@ void __cdecl LaraAsBack(ITEM_INFO* item, COLL_INFO* coll) void __cdecl LaraAsFastTurn(ITEM_INFO* item, COLL_INFO* coll) { if (item->hit_points <= 0 - || (TR1MConfig.enable_enhanced_look && (Input & IN_LOOK))) { + || (Tomb1MConfig.enable_enhanced_look && (Input & IN_LOOK))) { item->goal_anim_state = AS_STOP; return; } @@ -2154,7 +2154,7 @@ int32_t __cdecl LaraLandedBad(ITEM_INFO* item, COLL_INFO* coll) return 0; } -void TR1MInjectGameLara() +void Tomb1MInjectGameLara() { INJECT(0x00422480, LaraAboveWater); diff --git a/src/game/lara.h b/src/game/lara.h index be5117179..6759819b0 100644 --- a/src/game/lara.h +++ b/src/game/lara.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_GAME_LARA_H -#define TR1MAIN_GAME_LARA_H +#ifndef TOMB1MAIN_GAME_LARA_H +#define TOMB1MAIN_GAME_LARA_H #include "game/types.h" #include "util.h" @@ -122,13 +122,13 @@ void __cdecl LaraSwimCollision(ITEM_INFO* item, COLL_INFO* coll); void __cdecl LaraWaterCurrent(COLL_INFO* coll); void __cdecl UseItem(__int16 object_num); -void TR1MLookLeftRight(); -void TR1MLookUpDown(); -void TR1MResetLook(); +void Tomb1MLookLeftRight(); +void Tomb1MLookUpDown(); +void Tomb1MResetLook(); -void TR1MInjectGameLara(); -void TR1MInjectGameLaraMisc(); -void TR1MInjectGameLaraSurf(); -void TR1MInjectGameLaraSwim(); +void Tomb1MInjectGameLara(); +void Tomb1MInjectGameLaraMisc(); +void Tomb1MInjectGameLaraSurf(); +void Tomb1MInjectGameLaraSwim(); #endif diff --git a/src/game/laramisc.c b/src/game/laramisc.c index d750785f0..a85c2cb54 100644 --- a/src/game/laramisc.c +++ b/src/game/laramisc.c @@ -11,8 +11,8 @@ void __cdecl InitialiseLara() TRACE(""); LaraItem->collidable = 0; LaraItem->data = &Lara; - LaraItem->hit_points = TR1MConfig.disable_healing_between_levels - ? TR1MData.stored_lara_health + LaraItem->hit_points = Tomb1MConfig.disable_healing_between_levels + ? Tomb1MData.stored_lara_health : LARA_HITPOINTS; Lara.air = LARA_AIR; @@ -119,7 +119,7 @@ void __cdecl UseItem(__int16 object_num) } } -void TR1MInjectGameLaraMisc() +void Tomb1MInjectGameLaraMisc() { INJECT(0x00428020, InitialiseLara); INJECT(0x00427E80, UseItem); diff --git a/src/game/larasurf.c b/src/game/larasurf.c index d33aa207c..73a43ed6d 100644 --- a/src/game/larasurf.c +++ b/src/game/larasurf.c @@ -96,7 +96,7 @@ void __cdecl LaraAsSurfSwim(ITEM_INFO* item, COLL_INFO* coll) } } -void TR1MInjectGameLaraSurf() +void Tomb1MInjectGameLaraSurf() { INJECT(0x004286E0, LaraSurface); INJECT(0x004288A0, LaraAsSurfSwim); diff --git a/src/game/laraswim.c b/src/game/laraswim.c index 99553a30f..a19e2434d 100644 --- a/src/game/laraswim.c +++ b/src/game/laraswim.c @@ -24,11 +24,11 @@ void __cdecl LaraUnderWater(ITEM_INFO* item, COLL_INFO* coll) coll->enable_spaz = 0; coll->enable_baddie_push = 0; - if (TR1MConfig.enable_enhanced_look) { + if (Tomb1MConfig.enable_enhanced_look) { if (Input & IN_LOOK) { - TR1MLookLeftRight(); + Tomb1MLookLeftRight(); } else { - TR1MResetLook(); + Tomb1MResetLook(); } } @@ -148,9 +148,9 @@ void __cdecl LaraAsGlide(ITEM_INFO* item, COLL_INFO* coll) void __cdecl LaraAsTread(ITEM_INFO* item, COLL_INFO* coll) { - if (TR1MConfig.enable_enhanced_look) { + if (Tomb1MConfig.enable_enhanced_look) { if (Input & IN_LOOK) { - TR1MLookUpDown(); + Tomb1MLookUpDown(); } } @@ -359,7 +359,7 @@ void __cdecl LaraWaterCurrent(COLL_INFO* coll) coll->old.z = item->pos.z; } -void TR1MInjectGameLaraSwim() +void Tomb1MInjectGameLaraSwim() { INJECT(0x00428F10, LaraUnderWater); diff --git a/src/game/lot.c b/src/game/lot.c index 244e28f0d..f37f62c9c 100644 --- a/src/game/lot.c +++ b/src/game/lot.c @@ -17,7 +17,7 @@ void __cdecl InitialiseLOTArray() SlotsUsed = 0; } -void TR1MInjectGameLOT() +void Tomb1MInjectGameLOT() { INJECT(0x0042A300, InitialiseLOTArray); } diff --git a/src/game/lot.h b/src/game/lot.h index 84bb1ab2d..b47a16e97 100644 --- a/src/game/lot.h +++ b/src/game/lot.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_GAME_LOT_H -#define TR1MAIN_GAME_LOT_H +#ifndef TOMB1MAIN_GAME_LOT_H +#define TOMB1MAIN_GAME_LOT_H // clang-format off #define InitialiseLOT ((void __cdecl(*)())0x0042A780) @@ -7,6 +7,6 @@ void __cdecl InitialiseLOTArray(); -void TR1MInjectGameLOT(); +void Tomb1MInjectGameLOT(); #endif diff --git a/src/game/misc.h b/src/game/misc.h index d43431f62..5cf621db7 100644 --- a/src/game/misc.h +++ b/src/game/misc.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_GAME_MISC_H -#define TR1MAIN_GAME_MISC_H +#ifndef TOMB1MAIN_GAME_MISC_H +#define TOMB1MAIN_GAME_MISC_H #define SQUARE(A) ((A) * (A)) #ifndef ABS diff --git a/src/game/savegame.h b/src/game/savegame.h index dd0945bc0..b8d15838c 100644 --- a/src/game/savegame.h +++ b/src/game/savegame.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_GAME_SAVEGAME_H -#define TR1MAIN_GAME_SAVEGAME_H +#ifndef TOMB1MAIN_GAME_SAVEGAME_H +#define TOMB1MAIN_GAME_SAVEGAME_H // clang-format off #define CreateStartInfo ((void __cdecl(*)(int level_id))0x004345E0) diff --git a/src/game/setup.c b/src/game/setup.c index 28f9415a6..3e921bb25 100644 --- a/src/game/setup.c +++ b/src/game/setup.c @@ -33,7 +33,7 @@ void __cdecl InitialiseObjects() TrapObjects(); ObjectObjects(); - if (TR1MConfig.disable_medpacks) { + if (Tomb1MConfig.disable_medpacks) { Objects[O_MEDI_ITEM].initialise = NULL; Objects[O_MEDI_ITEM].collision = NULL; Objects[O_MEDI_ITEM].control = NULL; @@ -49,7 +49,7 @@ void __cdecl InitialiseObjects() Objects[O_BIGMEDI_ITEM].floor = NULL; } - if (TR1MConfig.disable_magnums) { + if (Tomb1MConfig.disable_magnums) { Objects[O_MAGNUM_ITEM].initialise = NULL; Objects[O_MAGNUM_ITEM].collision = NULL; Objects[O_MAGNUM_ITEM].control = NULL; @@ -65,7 +65,7 @@ void __cdecl InitialiseObjects() Objects[O_MAG_AMMO_ITEM].floor = NULL; } - if (TR1MConfig.disable_uzis) { + if (Tomb1MConfig.disable_uzis) { Objects[O_UZI_ITEM].initialise = NULL; Objects[O_UZI_ITEM].collision = NULL; Objects[O_UZI_ITEM].control = NULL; @@ -81,7 +81,7 @@ void __cdecl InitialiseObjects() Objects[O_UZI_AMMO_ITEM].floor = NULL; } - if (TR1MConfig.disable_shotgun) { + if (Tomb1MConfig.disable_shotgun) { Objects[O_SHOTGUN_ITEM].initialise = NULL; Objects[O_SHOTGUN_ITEM].collision = NULL; Objects[O_SHOTGUN_ITEM].control = NULL; @@ -98,7 +98,7 @@ void __cdecl InitialiseObjects() } } -void TR1MInjectGameSetup() +void Tomb1MInjectGameSetup() { INJECT(0x00437A50, InitialiseObjects); } diff --git a/src/game/setup.h b/src/game/setup.h index a2417f33b..60a3436b6 100644 --- a/src/game/setup.h +++ b/src/game/setup.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_GAME_SETUP_H -#define TR1MAIN_GAME_SETUP_H +#ifndef TOMB1MAIN_GAME_SETUP_H +#define TOMB1MAIN_GAME_SETUP_H // clang-format off #define BaddyObjects ((void __cdecl(*)())0x004363E0) @@ -9,6 +9,6 @@ void __cdecl InitialiseObjects(); -void TR1MInjectGameSetup(); +void Tomb1MInjectGameSetup(); #endif diff --git a/src/game/text.c b/src/game/text.c index cd5767556..033a34934 100644 --- a/src/game/text.c +++ b/src/game/text.c @@ -282,10 +282,10 @@ void __cdecl T_DrawText() } else { int fps_x; int fps_y; - if (!TR1MConfig.enable_enhanced_ui - && TR1MGetRenderScaleGLRage(1) > 1) { - fps_x = TR1MData.fps_x; - fps_y = TR1MData.fps_y; + if (!Tomb1MConfig.enable_enhanced_ui + && Tomb1MGetRenderScaleGLRage(1) > 1) { + fps_x = Tomb1MData.fps_x; + fps_y = Tomb1MData.fps_y; } else { fps_x = 10; fps_y = 30; @@ -330,17 +330,17 @@ void __cdecl T_DrawThisText(TEXTSTRING* textstring) int zpos = textstring->zpos; int textwidth = T_GetTextWidth(textstring); - if (TR1MConfig.enable_enhanced_ui) { + if (Tomb1MConfig.enable_enhanced_ui) { if (textstring->flags & TF_CENTRE_H) { - xpos += (TR1MGetRenderWidthDownscaled() - textwidth) / 2; + xpos += (Tomb1MGetRenderWidthDownscaled() - textwidth) / 2; } else if (textstring->flags & TF_RIGHT) { - xpos += TR1MGetRenderWidthDownscaled() - textwidth; + xpos += Tomb1MGetRenderWidthDownscaled() - textwidth; } if (textstring->flags & TF_CENTRE_V) { - ypos += TR1MGetRenderHeightDownscaled() / 2; + ypos += Tomb1MGetRenderHeightDownscaled() / 2; } else if (textstring->flags & TF_BOTTOM) { - ypos += TR1MGetRenderHeightDownscaled(); + ypos += Tomb1MGetRenderHeightDownscaled(); } } else { if (textstring->flags & TF_CENTRE_H) { @@ -385,11 +385,11 @@ void __cdecl T_DrawThisText(TEXTSTRING* textstring) sy = ypos; sh = textstring->scale_h; sv = textstring->scale_v; - if (TR1MConfig.enable_enhanced_ui) { - sx = TR1MGetRenderScale(sx); - sy = TR1MGetRenderScale(sy); - sh = TR1MGetRenderScale(sh); - sv = TR1MGetRenderScale(sv); + if (Tomb1MConfig.enable_enhanced_ui) { + sx = Tomb1MGetRenderScale(sx); + sy = Tomb1MGetRenderScale(sy); + sh = Tomb1MGetRenderScale(sh); + sv = Tomb1MGetRenderScale(sv); } S_DrawScreenSprite2d( sx, sy, zpos, sh, sv, Objects[O_ALPHABET].mesh_index + sprite, @@ -425,11 +425,11 @@ void __cdecl T_DrawThisText(TEXTSTRING* textstring) sy = bypos; sh = bwidth; sv = bheight; - if (TR1MConfig.enable_enhanced_ui) { - sx = TR1MGetRenderScale(sx); - sy = TR1MGetRenderScale(sy); - sh = TR1MGetRenderScale(sh); - sv = TR1MGetRenderScale(sv); + if (Tomb1MConfig.enable_enhanced_ui) { + sx = Tomb1MGetRenderScale(sx); + sy = Tomb1MGetRenderScale(sy); + sh = Tomb1MGetRenderScale(sh); + sv = Tomb1MGetRenderScale(sv); } if (textstring->flags & TF_BGND) { @@ -472,11 +472,11 @@ void __cdecl T_DrawThisText(TEXTSTRING* textstring) sy = bypos; sh = bwidth; sv = bheight; - if (TR1MConfig.enable_enhanced_ui) { - sx = TR1MGetRenderScale(sx); - sy = TR1MGetRenderScale(sy); - sh = TR1MGetRenderScale(sh); - sv = TR1MGetRenderScale(sv); + if (Tomb1MConfig.enable_enhanced_ui) { + sx = Tomb1MGetRenderScale(sx); + sy = Tomb1MGetRenderScale(sy); + sh = Tomb1MGetRenderScale(sh); + sv = Tomb1MGetRenderScale(sv); } S_DrawScreenBox( sx, sy, zpos + textstring->bgnd_off_z, sh, sv, @@ -485,7 +485,7 @@ void __cdecl T_DrawThisText(TEXTSTRING* textstring) } } -void TR1MInjectGameText() +void Tomb1MInjectGameText() { INJECT(0x00439750, T_InitPrint); INJECT(0x00439780, T_Print); diff --git a/src/game/text.h b/src/game/text.h index d0abb025f..d9a12e776 100644 --- a/src/game/text.h +++ b/src/game/text.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_GAME_TEXT_H -#define TR1MAIN_GAME_TEXT_H +#ifndef TOMB1MAIN_GAME_TEXT_H +#define TOMB1MAIN_GAME_TEXT_H #include "game/types.h" @@ -27,6 +27,6 @@ void __cdecl T_RemovePrint(TEXTSTRING* textstring); void __cdecl T_DrawText(); void __cdecl T_DrawThisText(TEXTSTRING* textstring); -void TR1MInjectGameText(); +void Tomb1MInjectGameText(); #endif diff --git a/src/game/types.h b/src/game/types.h index bef173900..ab889d1ed 100644 --- a/src/game/types.h +++ b/src/game/types.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_GAME_TYPES_H -#define TR1MAIN_GAME_TYPES_H +#ifndef TOMB1MAIN_GAME_TYPES_H +#define TOMB1MAIN_GAME_TYPES_H #include "const.h" #include diff --git a/src/json_utils.h b/src/json_utils.h index 89cbc0d9e..2396896ad 100644 --- a/src/json_utils.h +++ b/src/json_utils.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_JSON_UTILS_H -#define TR1MAIN_JSON_UTILS_H +#ifndef TOMB1MAIN_JSON_UTILS_H +#define TOMB1MAIN_JSON_UTILS_H #include "json-parser/json.h" diff --git a/src/main.c b/src/main.c index a81618617..e06269d9a 100644 --- a/src/main.c +++ b/src/main.c @@ -22,30 +22,30 @@ HINSTANCE hInstance = NULL; -static void TR1MInject() +static void Tomb1MInject() { - TR1MInjectGameControl(); - TR1MInjectGameDraw(); - TR1MInjectGameEffects(); - TR1MInjectGameHealth(); - TR1MInjectGameItems(); - TR1MInjectGameLOT(); - TR1MInjectGameLara(); - TR1MInjectGameLaraMisc(); - TR1MInjectGameLaraSurf(); - TR1MInjectGameLaraSwim(); - TR1MInjectGameSetup(); - TR1MInjectGameText(); - TR1MInjectSpecificFile(); - TR1MInjectSpecificGame(); - TR1MInjectSpecificInit(); - TR1MInjectSpecificInput(); - TR1MInjectSpecificOutput(); + Tomb1MInjectGameControl(); + Tomb1MInjectGameDraw(); + Tomb1MInjectGameEffects(); + Tomb1MInjectGameHealth(); + Tomb1MInjectGameItems(); + Tomb1MInjectGameLOT(); + Tomb1MInjectGameLara(); + Tomb1MInjectGameLaraMisc(); + Tomb1MInjectGameLaraSurf(); + Tomb1MInjectGameLaraSwim(); + Tomb1MInjectGameSetup(); + Tomb1MInjectGameText(); + Tomb1MInjectSpecificFile(); + Tomb1MInjectSpecificGame(); + Tomb1MInjectSpecificInit(); + Tomb1MInjectSpecificInput(); + Tomb1MInjectSpecificOutput(); } -static int TR1MReadConfig() +static int Tomb1MReadConfig() { - FILE* fp = fopen("TR1Main.json", "rb"); + FILE* fp = fopen("Tomb1Main.json", "rb"); if (!fp) { return 0; } @@ -64,42 +64,43 @@ static int TR1MReadConfig() json_value* json = json_parse((const json_char*)cfg_data, cfg_size); - TR1MData.medipack_cooldown = 0; + Tomb1MData.medipack_cooldown = 0; - TR1MConfig.disable_healing_between_levels = + Tomb1MConfig.disable_healing_between_levels = tr1m_json_get_boolean_value(json, "disable_healing_between_levels"); - TR1MConfig.disable_medpacks = + Tomb1MConfig.disable_medpacks = tr1m_json_get_boolean_value(json, "disable_medpacks"); - TR1MConfig.disable_magnums = + Tomb1MConfig.disable_magnums = tr1m_json_get_boolean_value(json, "disable_magnums"); - TR1MConfig.disable_uzis = tr1m_json_get_boolean_value(json, "disable_uzis"); - TR1MConfig.disable_shotgun = + Tomb1MConfig.disable_uzis = + tr1m_json_get_boolean_value(json, "disable_uzis"); + Tomb1MConfig.disable_shotgun = tr1m_json_get_boolean_value(json, "disable_shotgun"); - TR1MConfig.enable_red_healthbar = + Tomb1MConfig.enable_red_healthbar = tr1m_json_get_boolean_value(json, "enable_red_healthbar"); - TR1MConfig.enable_enemy_healthbar = + Tomb1MConfig.enable_enemy_healthbar = tr1m_json_get_boolean_value(json, "enable_enemy_healthbar"); - TR1MConfig.enable_enhanced_look = + Tomb1MConfig.enable_enhanced_look = tr1m_json_get_boolean_value(json, "enable_enhanced_look"); - TR1MConfig.enable_enhanced_ui = + Tomb1MConfig.enable_enhanced_ui = tr1m_json_get_boolean_value(json, "enable_enhanced_ui"); const char* healthbar_showing_mode = tr1m_json_get_string_value(json, "healthbar_showing_mode"); - TR1MConfig.healthbar_showing_mode = TR1M_BSM_DEFAULT; + Tomb1MConfig.healthbar_showing_mode = Tomb1M_BSM_DEFAULT; if (healthbar_showing_mode) { if (!strcmp(healthbar_showing_mode, "flashing")) { - TR1MConfig.healthbar_showing_mode = TR1M_BSM_FLASHING; + Tomb1MConfig.healthbar_showing_mode = Tomb1M_BSM_FLASHING; } else if (!strcmp(healthbar_showing_mode, "always")) { - TR1MConfig.healthbar_showing_mode = TR1M_BSM_ALWAYS; + Tomb1MConfig.healthbar_showing_mode = Tomb1M_BSM_ALWAYS; } } - TR1MConfig.enable_numeric_keys = + Tomb1MConfig.enable_numeric_keys = tr1m_json_get_boolean_value(json, "enable_numeric_keys"); - TR1MConfig.fix_end_of_level_freeze = + Tomb1MConfig.fix_end_of_level_freeze = tr1m_json_get_boolean_value(json, "fix_end_of_level_freeze"); - TR1MConfig.fix_tihocan_secret_sound = + Tomb1MConfig.fix_tihocan_secret_sound = tr1m_json_get_boolean_value(json, "fix_tihocan_secret_sound"); json_value_free(json); @@ -111,11 +112,11 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { switch (fdwReason) { case DLL_PROCESS_ATTACH: - freopen("./TR1Main.log", "w", stdout); - TR1MReadConfig(); + freopen("./Tomb1Main.log", "w", stdout); + Tomb1MReadConfig(); TRACE("Attached"); hInstance = hinstDLL; - TR1MInject(); + Tomb1MInject(); break; case DLL_PROCESS_DETACH: diff --git a/src/mod.c b/src/mod.c index 36462005b..de61c7326 100644 --- a/src/mod.c +++ b/src/mod.c @@ -8,27 +8,27 @@ int MulDiv(int x, int y, int z) return (x * y) / z; } -int TR1MGetRenderHeightDownscaled() +int Tomb1MGetRenderHeightDownscaled() { - return PhdWinHeight * PHD_ONE / TR1MGetRenderScale(PHD_ONE); + return PhdWinHeight * PHD_ONE / Tomb1MGetRenderScale(PHD_ONE); } -int TR1MGetRenderWidthDownscaled() +int Tomb1MGetRenderWidthDownscaled() { - return PhdWinWidth * PHD_ONE / TR1MGetRenderScale(PHD_ONE); + return PhdWinWidth * PHD_ONE / Tomb1MGetRenderScale(PHD_ONE); } -int TR1MGetRenderHeight() +int Tomb1MGetRenderHeight() { return PhdWinHeight; } -int TR1MGetRenderWidth() +int Tomb1MGetRenderWidth() { return PhdWinWidth; } -int TR1MGetRenderScale(int unit) +int Tomb1MGetRenderScale(int unit) { // TR2Main-style UI scaler int baseWidth = 800; @@ -44,7 +44,7 @@ int TR1MGetRenderScale(int unit) return scaleY; } -int TR1MGetRenderScaleGLRage(int unit) +int Tomb1MGetRenderScaleGLRage(int unit) { // GLRage-style UI scaler double result = PhdWinWidth; @@ -59,7 +59,7 @@ int TR1MGetRenderScaleGLRage(int unit) return round(result); } -void TR1MRenderBar(int value, int value_max, int bar_type) +void Tomb1MRenderBar(int value, int value_max, int bar_type) { const int p1 = -100; const int p2 = -200; @@ -75,34 +75,34 @@ void TR1MRenderBar(int value, int value_max, int bar_type) int percent = value * 100 / value_max; #define COLOR_BAR_SIZE 5 - int color_bar[TR1M_BAR_NUMBER][COLOR_BAR_SIZE] = { + int color_bar[Tomb1M_BAR_NUMBER][COLOR_BAR_SIZE] = { { 8, 11, 8, 6, 24 }, { 32, 41, 32, 19, 21 }, { 18, 17, 18, 19, 21 }, }; - if (TR1MConfig.enable_red_healthbar) { - color_bar[TR1M_BAR_LARA_HEALTH][0] = 29; - color_bar[TR1M_BAR_LARA_HEALTH][1] = 30; - color_bar[TR1M_BAR_LARA_HEALTH][2] = 29; - color_bar[TR1M_BAR_LARA_HEALTH][3] = 28; - color_bar[TR1M_BAR_LARA_HEALTH][4] = 26; + if (Tomb1MConfig.enable_red_healthbar) { + color_bar[Tomb1M_BAR_LARA_HEALTH][0] = 29; + color_bar[Tomb1M_BAR_LARA_HEALTH][1] = 30; + color_bar[Tomb1M_BAR_LARA_HEALTH][2] = 29; + color_bar[Tomb1M_BAR_LARA_HEALTH][3] = 28; + color_bar[Tomb1M_BAR_LARA_HEALTH][4] = 26; } const int color_border_1 = 19; const int color_border_2 = 17; const int color_bgnd = 0; - int scale = TR1MGetRenderScaleGLRage(1); + int scale = Tomb1MGetRenderScaleGLRage(1); int width = percent_max * scale; int height = 5 * scale; int x = 8 * scale; int y = 8 * scale; - if (bar_type == TR1M_BAR_LARA_AIR) { + if (bar_type == Tomb1M_BAR_LARA_AIR) { // place air bar on the right x = PhdWinWidth - width - x; - } else if (bar_type == TR1M_BAR_ENEMY_HEALTH) { + } else if (bar_type == Tomb1M_BAR_ENEMY_HEALTH) { // place enemy bar on the bottom y = PhdWinHeight - height - y; } @@ -113,9 +113,9 @@ void TR1MRenderBar(int value, int value_max, int bar_type) int bottom = top + height + padding + 1; int right = left + width + padding + 1; - if (bar_type == TR1M_BAR_LARA_HEALTH) { - TR1MData.fps_x = left; - TR1MData.fps_y = bottom + 24; + if (bar_type == Tomb1M_BAR_LARA_HEALTH) { + Tomb1MData.fps_x = left; + Tomb1MData.fps_y = bottom + 24; } // background @@ -132,7 +132,7 @@ void TR1MRenderBar(int value, int value_max, int bar_type) Insert2DLine(right, top, right, bottom, p2, color_border_2); const int blink_interval = 20; - const int blink_threshold = bar_type == TR1M_BAR_ENEMY_HEALTH ? 0 : 20; + const int blink_threshold = bar_type == Tomb1M_BAR_ENEMY_HEALTH ? 0 : 20; int blink_time = SaveGame[0].timer % blink_interval; int blink = percent <= blink_threshold && blink_time > blink_interval / 2; diff --git a/src/mod.h b/src/mod.h index c8e1f1ee1..bee440c69 100644 --- a/src/mod.h +++ b/src/mod.h @@ -1,20 +1,20 @@ -#ifndef TR1MAIN_MOD_H -#define TR1MAIN_MOD_H +#ifndef TOMB1MAIN_MOD_H +#define TOMB1MAIN_MOD_H #include "util.h" typedef enum { - TR1M_BAR_LARA_HEALTH = 0, - TR1M_BAR_LARA_AIR = 1, - TR1M_BAR_ENEMY_HEALTH = 2, - TR1M_BAR_NUMBER = 3, -} TR1M_BAR; + Tomb1M_BAR_LARA_HEALTH = 0, + Tomb1M_BAR_LARA_AIR = 1, + Tomb1M_BAR_ENEMY_HEALTH = 2, + Tomb1M_BAR_NUMBER = 3, +} Tomb1M_BAR; typedef enum { - TR1M_BSM_DEFAULT = 0, - TR1M_BSM_FLASHING = 1, - TR1M_BSM_ALWAYS = 2, -} TR1M_BAR_SHOW_MODE; + Tomb1M_BSM_DEFAULT = 0, + Tomb1M_BSM_FLASHING = 1, + Tomb1M_BSM_ALWAYS = 2, +} Tomb1M_BAR_SHOW_MODE; struct { int disable_healing_between_levels; @@ -30,7 +30,7 @@ struct { int healthbar_showing_mode; int fix_end_of_level_freeze; int fix_tihocan_secret_sound; -} TR1MConfig; +} Tomb1MConfig; struct { int stored_lara_health; @@ -38,14 +38,14 @@ struct { // replicate glrage patch FPS counter repositioning int fps_x; int fps_y; -} TR1MData; +} Tomb1MData; -int TR1MGetRenderScale(int base); -int TR1MGetRenderScaleGLRage(int unit); -void TR1MRenderBar(int value, int value_max, int bar_type); -int TR1MGetRenderHeightDownscaled(); -int TR1MGetRenderWidthDownscaled(); -int TR1MGetRenderHeight(); -int TR1MGetRenderWidth(); +int Tomb1MGetRenderScale(int base); +int Tomb1MGetRenderScaleGLRage(int unit); +void Tomb1MRenderBar(int value, int value_max, int bar_type); +int Tomb1MGetRenderHeightDownscaled(); +int Tomb1MGetRenderWidthDownscaled(); +int Tomb1MGetRenderHeight(); +int Tomb1MGetRenderWidth(); #endif diff --git a/src/specific/display.h b/src/specific/display.h index 6c613afe0..fe33ce67d 100644 --- a/src/specific/display.h +++ b/src/specific/display.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_SPECIFIC_DISPLAY_H -#define TR1MAIN_SPECIFIC_DISPLAY_H +#ifndef TOMB1MAIN_SPECIFIC_DISPLAY_H +#define TOMB1MAIN_SPECIFIC_DISPLAY_H // clang-format off #define TempVideoRemove ((void __cdecl(*)())0x004167D0) diff --git a/src/specific/file.c b/src/specific/file.c index 10ba79e73..f52d4faf2 100644 --- a/src/specific/file.c +++ b/src/specific/file.c @@ -168,7 +168,7 @@ int32_t __cdecl S_LoadLevel(int level_id) TRACE("%d (%s)", level_id, LevelNames[level_id]); int ret = LoadLevel(LevelNames[level_id], level_id); - if (TR1MConfig.disable_healing_between_levels) { + if (Tomb1MConfig.disable_healing_between_levels) { // check if we're in main menu by seeing if there is Lara item in the // currently loaded level. int lara_found = 0; @@ -185,7 +185,7 @@ int32_t __cdecl S_LoadLevel(int level_id) } } if (!lara_found && !in_cutscene) { - TR1MData.stored_lara_health = LARA_HITPOINTS; + Tomb1MData.stored_lara_health = LARA_HITPOINTS; } } @@ -235,7 +235,7 @@ int32_t __cdecl FindCdDrive() return 0; } -void TR1MInjectSpecificFile() +void Tomb1MInjectSpecificFile() { INJECT(0x0041B3F0, LoadRooms); INJECT(0x0041BC60, LoadItems); diff --git a/src/specific/file.h b/src/specific/file.h index ed4483a83..823498ff2 100644 --- a/src/specific/file.h +++ b/src/specific/file.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_SPECIFIC_FILE_H -#define TR1MAIN_SPECIFIC_FILE_H +#ifndef TOMB1MAIN_SPECIFIC_FILE_H +#define TOMB1MAIN_SPECIFIC_FILE_H #include @@ -14,6 +14,6 @@ int32_t __cdecl S_LoadLevel(int level_id); const char* __cdecl GetFullPath(const char* filename); int32_t __cdecl FindCdDrive(); -void TR1MInjectSpecificFile(); +void Tomb1MInjectSpecificFile(); #endif diff --git a/src/specific/frontend.h b/src/specific/frontend.h index 58a173573..d72416592 100644 --- a/src/specific/frontend.h +++ b/src/specific/frontend.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_SPECIFIC_FRONTEND_H -#define TR1MAIN_SPECIFIC_FRONTEND_H +#ifndef TOMB1MAIN_SPECIFIC_FRONTEND_H +#define TOMB1MAIN_SPECIFIC_FRONTEND_H // clang-format off #define S_FadeToBlack ((void __cdecl(*)())0x0041CD10) diff --git a/src/specific/game.c b/src/specific/game.c index 49a90a9f9..b0dbe2311 100644 --- a/src/specific/game.c +++ b/src/specific/game.c @@ -120,7 +120,7 @@ void __cdecl LevelStats(int level_id) T_CentreV(txt, 1); // wait till action key release - if (TR1MConfig.fix_end_of_level_freeze) { + if (Tomb1MConfig.fix_end_of_level_freeze) { while (Input & IN_SELECT) { S_UpdateInput(); S_InitialisePolyList(); @@ -173,7 +173,7 @@ void __cdecl LevelStats(int level_id) TempVideoRemove(); } -void TR1MInjectSpecificGame() +void Tomb1MInjectSpecificGame() { INJECT(0x0041D5A0, LevelStats); INJECT(0x0041D950, LevelIsValid); diff --git a/src/specific/game.h b/src/specific/game.h index 62f340bfd..9d1610a10 100644 --- a/src/specific/game.h +++ b/src/specific/game.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_SPECIFIC_GAME_H -#define TR1MAIN_SPECIFIC_GAME_H +#ifndef TOMB1MAIN_SPECIFIC_GAME_H +#define TOMB1MAIN_SPECIFIC_GAME_H #include @@ -14,6 +14,6 @@ int32_t __cdecl GetRandomControl(); int32_t __cdecl GetRandomDraw(); void __cdecl LevelStats(int level_id); -void TR1MInjectSpecificGame(); +void Tomb1MInjectSpecificGame(); #endif diff --git a/src/specific/init.c b/src/specific/init.c index eeeb4ec3d..94a74598a 100644 --- a/src/specific/init.c +++ b/src/specific/init.c @@ -34,7 +34,7 @@ void __cdecl game_free(int free_size) GameAllocMemUsed -= free_size; } -void TR1MInjectSpecificInit() +void Tomb1MInjectSpecificInit() { INJECT(0x0042A2C0, DB_Log); INJECT(0x0041E2C0, init_game_malloc); diff --git a/src/specific/init.h b/src/specific/init.h index 429db4f2d..f1ce905fa 100644 --- a/src/specific/init.h +++ b/src/specific/init.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_SPECIFIC_INIT_H -#define TR1MAIN_SPECIFIC_INIT_H +#ifndef TOMB1MAIN_SPECIFIC_INIT_H +#define TOMB1MAIN_SPECIFIC_INIT_H // clang-format off #define game_malloc ((void __cdecl*(*)(uint32_t length, int type))0x0041E2F0) @@ -8,6 +8,6 @@ void __cdecl init_game_malloc(); void __cdecl game_free(int free_size); -void TR1MInjectSpecificInit(); +void Tomb1MInjectSpecificInit(); #endif diff --git a/src/specific/input.c b/src/specific/input.c index 6177971ac..f3f34ccbe 100644 --- a/src/specific/input.c +++ b/src/specific/input.c @@ -70,7 +70,7 @@ void __cdecl S_UpdateInput() linput |= IN_ROLL; } - if (TR1MConfig.enable_numeric_keys) { + if (Tomb1MConfig.enable_numeric_keys) { if (KeyData->keymap[DIK_1] && Inv_RequestItem(O_GUN_ITEM)) { Lara.request_gun_type = LGT_PISTOLS; } else if (KeyData->keymap[DIK_2] && Inv_RequestItem(O_SHOTGUN_ITEM)) { @@ -81,16 +81,16 @@ void __cdecl S_UpdateInput() Lara.request_gun_type = LGT_UZIS; } - if (TR1MData.medipack_cooldown > 0) { - --TR1MData.medipack_cooldown; + if (Tomb1MData.medipack_cooldown > 0) { + --Tomb1MData.medipack_cooldown; } else { if (KeyData->keymap[DIK_8] && Inv_RequestItem(O_MEDI_OPTION)) { UseItem(O_MEDI_OPTION); - TR1MData.medipack_cooldown = 15; // half a second + Tomb1MData.medipack_cooldown = 15; // half a second } else if ( KeyData->keymap[DIK_9] && Inv_RequestItem(O_BIGMEDI_OPTION)) { UseItem(O_BIGMEDI_OPTION); - TR1MData.medipack_cooldown = 15; + Tomb1MData.medipack_cooldown = 15; } } } @@ -141,7 +141,7 @@ void __cdecl S_UpdateInput() return; } -void TR1MInjectSpecificInput() +void Tomb1MInjectSpecificInput() { INJECT(0x0041E550, S_UpdateInput); } diff --git a/src/specific/input.h b/src/specific/input.h index 50112fd9b..949d4cf56 100644 --- a/src/specific/input.h +++ b/src/specific/input.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_SPECIFIC_INPUT_H -#define TR1MAIN_SPECIFIC_INPUT_H +#ifndef TOMB1MAIN_SPECIFIC_INPUT_H +#define TOMB1MAIN_SPECIFIC_INPUT_H // clang-format off #define Key_ ((int __cdecl(*)(int number))0x0041E3E0) @@ -8,6 +8,6 @@ void __cdecl S_UpdateInput(); -void TR1MInjectSpecificInput(); +void Tomb1MInjectSpecificInput(); #endif diff --git a/src/specific/output.c b/src/specific/output.c index fe740fe16..952785d22 100644 --- a/src/specific/output.c +++ b/src/specific/output.c @@ -4,15 +4,15 @@ void __cdecl S_DrawHealthBar(int32_t percent) { - TR1MRenderBar(percent, 100, TR1M_BAR_LARA_HEALTH); + Tomb1MRenderBar(percent, 100, Tomb1M_BAR_LARA_HEALTH); } void __cdecl S_DrawAirBar(int32_t percent) { - TR1MRenderBar(percent, 100, TR1M_BAR_LARA_AIR); + Tomb1MRenderBar(percent, 100, Tomb1M_BAR_LARA_AIR); } -void TR1MInjectSpecificOutput() +void Tomb1MInjectSpecificOutput() { INJECT(0x004302D0, S_DrawHealthBar); INJECT(0x00430450, S_DrawAirBar); diff --git a/src/specific/output.h b/src/specific/output.h index 9cc6574e9..545e89bca 100644 --- a/src/specific/output.h +++ b/src/specific/output.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_SPECIFIC_OUTPUT_H -#define TR1MAIN_SPECIFIC_OUTPUT_H +#ifndef TOMB1MAIN_SPECIFIC_OUTPUT_H +#define TOMB1MAIN_SPECIFIC_OUTPUT_H // clang-format off #define S_DumpScreen ((void __cdecl(*)())0x0042FC70) @@ -15,6 +15,6 @@ void __cdecl S_DrawHealthBar(int percent); void __cdecl S_DrawAirBar(int percent); -void TR1MInjectSpecificOutput(); +void Tomb1MInjectSpecificOutput(); #endif diff --git a/src/specific/shed.h b/src/specific/shed.h index ae7e01fdf..e5a05d47a 100644 --- a/src/specific/shed.h +++ b/src/specific/shed.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_SPECIFIC_SHED_H -#define TR1MAIN_SPECIFIC_SHED_H +#ifndef TOMB1MAIN_SPECIFIC_SHED_H +#define TOMB1MAIN_SPECIFIC_SHED_H // a place for odd functions that have no place to go yet diff --git a/src/specific/sndpc.h b/src/specific/sndpc.h index 53a9b69e4..20f84f15f 100644 --- a/src/specific/sndpc.h +++ b/src/specific/sndpc.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_SPECIFIC_SNDPC_H -#define TR1MAIN_SPECIFIC_SNDPC_H +#ifndef TOMB1MAIN_SPECIFIC_SNDPC_H +#define TOMB1MAIN_SPECIFIC_SNDPC_H // clang-format off #define S_CDLoop ((void __cdecl(*)())0x004380B0) diff --git a/src/util.c b/src/util.c index 9371b0bd9..8fb588ed0 100644 --- a/src/util.c +++ b/src/util.c @@ -4,7 +4,7 @@ #include #include -void TR1MInjectFunc(void* from, void* to) +void Tomb1MInjectFunc(void* from, void* to) { DWORD tmp; TRACE("Patching %p to %p", from, to); @@ -20,7 +20,7 @@ void TR1MInjectFunc(void* from, void* to) //((JMP*)(from))->offset = (DWORD)(to) - ((DWORD)(from) + sizeof(JMP)); } -void TR1MPrintStackTrace() +void Tomb1MPrintStackTrace() { const size_t MaxNameLen = 255; BOOL result; diff --git a/src/util.h b/src/util.h index 0ed5d6d17..444ce6931 100644 --- a/src/util.h +++ b/src/util.h @@ -1,5 +1,5 @@ -#ifndef TR1MAIN_UTIL_H -#define TR1MAIN_UTIL_H +#ifndef TOMB1MAIN_UTIL_H +#define TOMB1MAIN_UTIL_H #define FEATURE_NOCD_DATA @@ -25,12 +25,12 @@ typedef struct { #define VAR_I_(address, type, value) (*(type*)(address)) #define ARRAY_(address, type, length) (*(type(*) length)(address)) -void TR1MInjectFunc(void* from, void* to); -void TR1MPrintStackTrace(); +void Tomb1MInjectFunc(void* from, void* to); +void Tomb1MPrintStackTrace(); #define INJECT(from, to) \ { \ - TR1MInjectFunc((void*)from, (void*)to); \ + Tomb1MInjectFunc((void*)from, (void*)to); \ } #endif