mirror of
https://github.com/LostArtefacts/TR2X.git
synced 2025-01-07 22:03:19 +00:00
port Overlay_DrawHealthBar
This commit is contained in:
parent
7d8f6838a2
commit
82a6a54624
@ -69,10 +69,10 @@
|
||||
</g>
|
||||
<g transform="translate(0 116)">
|
||||
<text x="0" y="7.50">Tomb2.exe progress according to the physical function order:</text>
|
||||
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">29.31% (357)</tspan> · <tspan class="known">68.23% (831)</tspan> · <tspan class="todo">0.66% (8)</tspan> · <tspan class="unused">1.81% (22)</tspan></tspan></text>
|
||||
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">29.39% (358)</tspan> · <tspan class="known">68.14% (830)</tspan> · <tspan class="todo">0.66% (8)</tspan> · <tspan class="unused">1.81% (22)</tspan></tspan></text>
|
||||
<g transform="translate(0 20)">
|
||||
<rect width="218.95" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="509.65" height="6" x="218.95" y="0" class="known"/>
|
||||
<rect width="219.56" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="509.04" height="6" x="219.56" y="0" class="known"/>
|
||||
<rect width="4.91" height="6" x="728.60" y="0" class="todo"/>
|
||||
<rect width="13.49" height="6" x="733.51" y="0" class="unused"/>
|
||||
</g>
|
||||
@ -394,8 +394,8 @@
|
||||
<rect width="12" height="12" x="210" y="90" class="decompiled"><title>BOOL __cdecl Overlay_FlashCounter(void);</title></rect>
|
||||
<rect width="12" height="12" x="225" y="90" class="decompiled"><title>void __cdecl Overlay_DrawAssaultTimer(void);</title></rect>
|
||||
<rect width="12" height="12" x="240" y="90" class="decompiled"><title>void __cdecl Overlay_DrawGameInfo(bool pickup_state);</title></rect>
|
||||
<rect width="12" height="12" x="255" y="90" class="known"><title>void __cdecl Overlay_DrawHealthBar(int32_t flash_state);</title></rect>
|
||||
<rect width="12" height="12" x="270" y="90" class="known"><title>void __cdecl Overlay_DrawAirBar(int32_t flash_state);</title></rect>
|
||||
<rect width="12" height="12" x="255" y="90" class="decompiled"><title>void __cdecl Overlay_DrawHealthBar(bool flash_state);</title></rect>
|
||||
<rect width="12" height="12" x="270" y="90" class="known"><title>void __cdecl Overlay_DrawAirBar(bool flash_state);</title></rect>
|
||||
<rect width="12" height="12" x="285" y="90" class="known"><title>void __cdecl Overlay_MakeAmmoString(char *string);</title></rect>
|
||||
<rect width="12" height="12" x="300" y="90" class="known"><title>void __cdecl Overlay_DrawAmmoInfo(void);</title></rect>
|
||||
<rect width="12" height="12" x="315" y="90" class="known"><title>void __cdecl Overlay_InitialisePickUpDisplay(void);</title></rect>
|
||||
@ -1299,10 +1299,10 @@
|
||||
</g>
|
||||
<g transform="translate(0 546)">
|
||||
<text x="0" y="7.50">Tomb2.exe progress according to the function sizes:</text>
|
||||
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">27.90%</tspan> · <tspan class="known">71.77%</tspan> · <tspan class="todo">0.02%</tspan> · <tspan class="unused">0.31%</tspan></tspan></text>
|
||||
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">27.95%</tspan> · <tspan class="known">71.72%</tspan> · <tspan class="todo">0.02%</tspan> · <tspan class="unused">0.31%</tspan></tspan></text>
|
||||
<g transform="translate(0 20)">
|
||||
<rect width="208.42" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="536.14" height="6" x="208.42" y="0" class="known"/>
|
||||
<rect width="208.79" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="535.77" height="6" x="208.79" y="0" class="known"/>
|
||||
<rect width="0.13" height="6" x="744.56" y="0" class="todo"/>
|
||||
<rect width="2.31" height="6" x="744.69" y="0" class="unused"/>
|
||||
</g>
|
||||
@ -1810,7 +1810,7 @@
|
||||
<rect width="8.75" height="9.08" x="702.99" y="161.72" class="decompiled"><title>bool __cdecl Matrix_TranslateRel(int32_t x, int32_t y, int32_t z);</title></rect>
|
||||
<rect width="8.75" height="9.08" x="714.74" y="161.72" class="known"><title>int32_t __cdecl Item_GetAnimChange(struct ITEM_INFO *item, struct ANIM_STRUCT *anim);</title></rect>
|
||||
<rect width="8.75" height="9.08" x="726.49" y="161.72" class="known"><title>int16_t __cdecl DragonFire(int32_t x, int32_t y, int32_t z, int16_t speed, PHD_ANGLE yrot, int16_t room_num);</title></rect>
|
||||
<rect width="8.75" height="9.08" x="738.25" y="161.72" class="known"><title>void __cdecl Overlay_DrawHealthBar(int32_t flash_state);</title></rect>
|
||||
<rect width="8.75" height="9.08" x="738.25" y="161.72" class="decompiled"><title>void __cdecl Overlay_DrawHealthBar(bool flash_state);</title></rect>
|
||||
<rect width="8.66" height="9.17" x="534.18" y="173.80" class="decompiled"><title>void __cdecl Lara_SlideEdgeJump(struct ITEM_INFO *item, struct COLL_INFO *coll);</title></rect>
|
||||
<rect width="8.66" height="9.17" x="534.18" y="185.97" class="known"><title>void __cdecl S_CopyScreenToBuffer(void);</title></rect>
|
||||
<rect width="8.66" height="9.10" x="534.18" y="198.14" class="decompiled"><title>void __cdecl Matrix_RotX(int16_t rx);</title></rect>
|
||||
@ -1857,7 +1857,7 @@
|
||||
<rect width="8.17" height="8.29" x="545.84" y="277.09" class="known"><title>void __cdecl WarriorSparkleTrail(struct ITEM_INFO *item);</title></rect>
|
||||
<rect width="8.17" height="8.29" x="545.84" y="288.38" class="known"><title>void __cdecl CreateBackBuffer(void);</title></rect>
|
||||
<rect width="8.17" height="8.29" x="545.84" y="299.68" class="known"><title>bool __cdecl CreateTexturePageSurface(TEXPAGE_DESC *desc);</title></rect>
|
||||
<rect width="8.17" height="8.22" x="545.84" y="310.97" class="known"><title>void __cdecl Overlay_DrawAirBar(int32_t flash_state);</title></rect>
|
||||
<rect width="8.17" height="8.22" x="545.84" y="310.97" class="known"><title>void __cdecl Overlay_DrawAirBar(bool flash_state);</title></rect>
|
||||
<rect width="8.17" height="8.22" x="545.84" y="322.19" class="known"><title>void __cdecl AdjustTextureUVs(bool reset_uv_add);</title></rect>
|
||||
<rect width="8.17" height="8.15" x="545.84" y="333.42" class="decompiled"><title>void __cdecl Output_DrawScreenSprite2D(int32_t sx, int32_t sy, int32_t sz, int32_t scale_h, int32_t scale_v, int16_t sprite_idx, int16_t shade, uint16_t flags);</title></rect>
|
||||
<rect width="8.17" height="8.15" x="545.84" y="344.56" class="known"><title>void __cdecl Lara_Control_Cutscene(int16_t item_num);</title></rect>
|
||||
|
Before Width: | Height: | Size: 367 KiB After Width: | Height: | Size: 367 KiB |
@ -1981,8 +1981,8 @@ typedef enum GAME_OBJECT_ID {
|
||||
004219A0 0000002D + BOOL __cdecl Overlay_FlashCounter(void);
|
||||
004219D0 00000145 + void __cdecl Overlay_DrawAssaultTimer(void);
|
||||
00421B20 00000045 + void __cdecl Overlay_DrawGameInfo(bool pickup_state);
|
||||
00421B70 000000AB * void __cdecl Overlay_DrawHealthBar(int32_t flash_state);
|
||||
00421C20 00000097 * void __cdecl Overlay_DrawAirBar(int32_t flash_state);
|
||||
00421B70 000000AB + void __cdecl Overlay_DrawHealthBar(bool flash_state);
|
||||
00421C20 00000097 * void __cdecl Overlay_DrawAirBar(bool flash_state);
|
||||
00421CC0 00000028 - void __cdecl Overlay_MakeAmmoString(char *string);
|
||||
00421CF0 00000132 * void __cdecl Overlay_DrawAmmoInfo(void);
|
||||
00421E40 00000015 - void __cdecl Overlay_InitialisePickUpDisplay(void);
|
||||
@ -2952,7 +2952,7 @@ typedef enum GAME_OBJECT_ID {
|
||||
|
||||
00464060 - uint32_t g_PerspectiveDistance = 0x3000000;
|
||||
00464068 - void (*__cdecl g_PolyDrawRoutines[9])(const int16_t *);
|
||||
0046408C - float g_RhwFactor = 0x14000000.p0;
|
||||
0046408C - float g_RhwFactor = 335544320.0f; // 10*2**25
|
||||
004640B0 - int32_t g_CineTrackID = 1;
|
||||
004640B8 - int32_t g_CineTickRate = 0x8000; // 0x8000 = PHD_ONE/TICKS_PER_FRAME
|
||||
004640BC - int16_t g_CD_TrackID = -1;
|
||||
@ -3200,3 +3200,5 @@ typedef enum GAME_OBJECT_ID {
|
||||
00526314 - int16_t g_CineFrameIdx;
|
||||
00526320 - struct CAMERA_INFO g_Camera;
|
||||
005263CC - struct BOX_INFO *g_Boxes;
|
||||
004D7928 + int32_t g_OldHitPoints;
|
||||
004D7C3C - int32_t g_HealthBarTimer;
|
||||
|
@ -5,11 +5,13 @@
|
||||
#include "global/const.h"
|
||||
#include "global/funcs.h"
|
||||
#include "global/vars.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define FLASH_FRAMES 5
|
||||
|
||||
static int32_t m_OldHitPoints = -1;
|
||||
static bool m_FlashState = false;
|
||||
static int32_t m_FlashCounter = 0;
|
||||
|
||||
@ -74,7 +76,7 @@ void __cdecl Overlay_DrawAssaultTimer(void)
|
||||
}
|
||||
}
|
||||
|
||||
void __cdecl Overlay_DrawGameInfo(bool pickup_state)
|
||||
void __cdecl Overlay_DrawGameInfo(const bool pickup_state)
|
||||
{
|
||||
Overlay_DrawAmmoInfo();
|
||||
Overlay_DrawModeInfo();
|
||||
@ -87,3 +89,30 @@ void __cdecl Overlay_DrawGameInfo(bool pickup_state)
|
||||
}
|
||||
Text_Draw();
|
||||
}
|
||||
|
||||
void __cdecl Overlay_DrawHealthBar(const bool flash_state)
|
||||
{
|
||||
int32_t hit_points = g_LaraItem->hit_points;
|
||||
CLAMP(hit_points, 0, LARA_MAX_HITPOINTS);
|
||||
|
||||
if (m_OldHitPoints != hit_points) {
|
||||
m_OldHitPoints = hit_points;
|
||||
g_HealthBarTimer = 40;
|
||||
}
|
||||
|
||||
int32_t timer = g_HealthBarTimer;
|
||||
if (timer < 0) {
|
||||
timer = 0;
|
||||
g_HealthBarTimer = 0;
|
||||
}
|
||||
|
||||
if (hit_points <= LARA_MAX_HITPOINTS / 4 && !flash_state) {
|
||||
S_DrawHealthBar(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (timer <= 0 && g_Lara.gun_status != LGS_READY) {
|
||||
return;
|
||||
}
|
||||
S_DrawHealthBar(hit_points / 10);
|
||||
}
|
||||
|
@ -5,3 +5,4 @@
|
||||
bool __cdecl Overlay_FlashCounter(void);
|
||||
void __cdecl Overlay_DrawAssaultTimer(void);
|
||||
void __cdecl Overlay_DrawGameInfo(bool pickup_state);
|
||||
void __cdecl Overlay_DrawHealthBar(bool flash_state);
|
||||
|
@ -203,8 +203,7 @@
|
||||
#define InitialiseHair ((void __cdecl (*)(void))0x00420EA0)
|
||||
#define HairControl ((void __cdecl (*)(int32_t in_cutscene))0x00420F20)
|
||||
#define DrawHair ((void __cdecl (*)(void))0x00421920)
|
||||
#define Overlay_DrawHealthBar ((void __cdecl (*)(int32_t flash_state))0x00421B70)
|
||||
#define Overlay_DrawAirBar ((void __cdecl (*)(int32_t flash_state))0x00421C20)
|
||||
#define Overlay_DrawAirBar ((void __cdecl (*)(bool flash_state))0x00421C20)
|
||||
#define Overlay_MakeAmmoString ((void __cdecl (*)(char *string))0x00421CC0)
|
||||
#define Overlay_DrawAmmoInfo ((void __cdecl (*)(void))0x00421CF0)
|
||||
#define Overlay_InitialisePickUpDisplay ((void __cdecl (*)(void))0x00421E40)
|
||||
|
@ -133,6 +133,7 @@
|
||||
#define g_GF_StartGame (*(int8_t*)0x004D780C)
|
||||
#define g_IsInventoryActive (*(uint16_t*)0x004D7978)
|
||||
#define g_LevelItemCount (*(int32_t*)0x004D7C38)
|
||||
#define g_HealthBarTimer (*(int32_t*)0x004D7C3C)
|
||||
#define g_SoundTrackIds (*(int32_t(*)[128])0x004D7C80)
|
||||
#define g_D3DDev (*(LPDIRECT3DDEVICE2*)0x004D7EBC)
|
||||
#define g_IsGameWindowCreated (*(bool*)0x004D7EE4)
|
||||
|
@ -237,6 +237,7 @@ static void Inject_Overlay(void)
|
||||
INJECT(1, 0x004219A0, Overlay_FlashCounter);
|
||||
INJECT(1, 0x004219D0, Overlay_DrawAssaultTimer);
|
||||
INJECT(1, 0x00421B20, Overlay_DrawGameInfo);
|
||||
INJECT(1, 0x00421B70, Overlay_DrawHealthBar);
|
||||
}
|
||||
|
||||
static void Inject_Random(void)
|
||||
|
Loading…
Reference in New Issue
Block a user