Skip to content

Commit b3bb2af

Browse files
committed
Add complete hud class
1 parent 40cec2c commit b3bb2af

File tree

5 files changed

+190
-60
lines changed

5 files changed

+190
-60
lines changed

runtime/PyLoader/libstd/cleo.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
from typing import Tuple
66
import _cleo
77

8-
def call_function(address :int, num_args:int, pop :int, *arg) -> int:
9-
'''Calls the function from the address. Arguments are passed left to right.\nMore info https://gtagmodding.com/opcode-database/opcode/0AA5/'''
8+
def call_function(address :int, num_args:int = 0, pop :int = 0, *arg) -> int:
9+
'''Calls the function from the address. More info https://gtagmodding.com/opcode-database/opcode/0AA5/'''
1010

1111
return _cleo.call_function(address, num_args, pop, *arg)
1212

13-
def call_method(address :int, struct :int, num_args :int, pop :int, *arg) -> int:
14-
'''Calls the method from the address. Arguments are passed left to right.\nMore info https://gtagmodding.com/opcode-database/opcode/0AA6/'''
13+
def call_method(address :int, struct :int, num_args :int = 0, pop :int = 0, *arg) -> int:
14+
'''Calls the method from the address. More info https://gtagmodding.com/opcode-database/opcode/0AA6/'''
1515

1616
_cleo.call_method(address, struct, num_args, pop, *arg)
1717

@@ -131,7 +131,7 @@ def set_vehicle_engine_state(hveh :int, state: bool) -> None:
131131
_cleo.set_vehicle_engine_state(hveh, state)
132132

133133
def test_cheat(cheat :str) -> bool:
134-
'''Checks whether the particular chracter sequence was pressed'''
134+
'''Checks whether the particular character sequence was pressed'''
135135

136136
return _cleo.test_cheat(cheat)
137137

runtime/PyLoader/libstd/hud.py

Lines changed: 185 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,190 @@
11
# Function definations for the intellisense
22
# Author: Grinch_
3-
# Last updated on: 05/06/2021
3+
# Last updated on: 27/09/2021
44

5-
import _hud
5+
import ctypes, cleo
66

7-
def set_help_message(message :str, quick_msg :bool = False, permanent :bool = False, add_to_brief :bool = False) -> None:
8-
'''Shows a game hud help popup on top left corner of the screen with provided message string'''
7+
class Hud:
8+
m_BigMessage = ctypes.c_char.from_address(0xBAACC0) # char[128]
9+
bScriptDontDisplayAreaName = ctypes.c_bool.from_address(0xBAA3F8)
10+
bScriptDontDisplayVehicleName = ctypes.c_bool.from_address(0xBAA3F9)
11+
bScriptForceDisplayWithCounters = ctypes.c_bool.from_address(0xBAA3FA)
12+
m_LastBreathTime = ctypes.c_int.from_address(0xBAA3FC)
13+
bDrawClock = ctypes.c_bool.from_address(0xBAA400)
14+
m_WeaponState = ctypes.c_int.from_address(0xBAA404)
15+
m_WeaponFadeTimer = ctypes.c_int.from_address(0xBAA408)
16+
m_WeaponTimer = ctypes.c_int.from_address(0xBAA40C)
17+
m_LastWeapon = ctypes.c_int.from_address(0xBAA410)
18+
m_WantedState = ctypes.c_int.from_address(0xBAA414)
19+
m_WantedFadeTimer = ctypes.c_int.from_address(0xBAA418)
20+
m_WantedTimer = ctypes.c_int.from_address(0xBAA41C)
21+
m_LastWanted = ctypes.c_int.from_address(0xBAA420)
22+
m_DisplayScoreState = ctypes.c_int.from_address(0xBAA424)
23+
m_DisplayScoreFadeTimer = ctypes.c_int.from_address(0xBAA428)
24+
m_DisplayScoreTimer = ctypes.c_int.from_address(0xBAA42C)
25+
m_LastDisplayScore = ctypes.c_int.from_address(0xBAA430)
26+
m_EnergyLostState = ctypes.c_int.from_address(0xBAA434)
27+
m_EnergyLostFadeTimer = ctypes.c_int.from_address(0xBAA438)
28+
m_EnergyLostTimer = ctypes.c_int.from_address(0xBAA43C)
29+
m_LastTimeEnergyLost = ctypes.c_int.from_address(0xBAA440)
30+
# char *&m_pVehicleNameToPrint = *(char **)0xBAA444;
31+
m_VehicleState = ctypes.c_int.from_address(0xBAA448)
32+
m_VehicleFadeTimer = ctypes.c_int.from_address(0xBAA44C)
33+
m_VehicleNameTimer = ctypes.c_int.from_address(0xBAA450)
34+
# char *&m_pLastVehicleName = *(char **)0xBAA454;
35+
m_bDraw3dMarkers = ctypes.c_bool.from_address(0xBAA45C)
36+
m_Wants_To_Draw_Hud = ctypes.c_bool.from_address(0xBAA45D)
37+
m_fHelpMessageTime = ctypes.c_float.from_address(0xBAA460)
38+
m_fHelpMessageBoxWidth = ctypes.c_float.from_address(0x8D0934)
39+
m_bHelpMessagePermanent = ctypes.c_bool.from_address(0xBAA464)
40+
m_fHelpMessageStatUpdateValue = ctypes.c_float.from_address(0xBAA468)
41+
m_nHelpMessageMaxStatValue = ctypes.c_ushort.from_address(0xBAA46C)
42+
m_nHelpMessageStatId = ctypes.c_ushort.from_address(0xBAA470)
43+
m_bHelpMessageQuick = ctypes.c_bool.from_address(0xBAA472)
44+
m_nHelpMessageState = ctypes.c_int.from_address(0xBAA474)
45+
m_nHelpMessageFadeTimer = ctypes.c_int.from_address(0xBAA478)
46+
m_nHelpMessageTimer = ctypes.c_int.from_address(0xBAA47C)
47+
m_pHelpMessageToPrint = ctypes.c_char.from_address(0xBAA480)
48+
m_pLastHelpMessage = ctypes.c_char.from_address(0xBAA610)
49+
m_pHelpMessage = ctypes.c_char.from_address(0xBAA7A0)
50+
m_ZoneState = ctypes.c_int.from_address(0xBAA930)
51+
m_ZoneFadeTimer = ctypes.c_int.from_address(0xBAA934)
52+
m_ZoneNameTimer = ctypes.c_int.from_address(0xBAA938)
53+
m_Message = ctypes.c_char.from_address(0xBAB040)
54+
# char *&m_ZoneToPrint = *(char **)0xBAB1D0;
55+
# char *&m_pLastZoneName = *(char **)0xBAB1D4;
56+
# char *&m_pZoneName = *(char **)0xBAB1D8;
57+
m_ItemToFlash = ctypes.c_short.from_address(0xBAB1DC)
58+
bDrawingVitalStats = ctypes.c_bool.from_address(0xBAB1DE)
59+
# CSprite2d *Sprites = (CSprite2d *)0xBAB1FC;
60+
TimerMainCounterHideState = ctypes.c_short.from_address(0xBAA388)
61+
TimerMainCounterWasDisplayed = ctypes.c_bool.from_address(0xBAA38A)
62+
TimerCounterHideState = ctypes.c_short.from_address(0xBAA38C)
63+
TimerCounterWasDisplayed = ctypes.c_short.from_address(0xBAA394)
64+
OddJob2OffTimer = ctypes.c_int.from_address(0xBAA398)
65+
OddJob2Timer = ctypes.c_int.from_address(0xBAA3A0)
66+
OddJob2XOffset = ctypes.c_float.from_address(0xBAA39C)
67+
BigMessageAlpha = ctypes.c_float.from_address(0xBAA3A4)
68+
BigMessageInUse = ctypes.c_float.from_address(0xBAA3C0)
69+
BigMessageX = ctypes.c_float.from_address(0xBAA3DC)
70+
LastBigMessage = ctypes.c_float.from_address(0xBAABC0)
71+
OddJob2On = ctypes.c_ushort.from_address(0xBAB1E0)
72+
PagerXOffset = ctypes.c_float.from_address(0x8D0938)
73+
74+
def draw():
75+
cleo.call_function(0x58FAE0)
76+
77+
def draw_after_fade():
78+
cleo.call_function(0x58D490)
79+
80+
def draw_area_name():
81+
cleo.call_function(0x58AA50)
82+
83+
def draw_busted_wasted_message():
84+
cleo.call_function(0x58CA50)
985

10-
_hud.set_help_message(message, quick_msg, permanent, add_to_brief)
86+
def draw_crosshairs():
87+
cleo.call_function(0x58E020)
88+
89+
def draw_fade_state(fade_state: int, arg1 :int):
90+
cleo.call_function(0x58D580, 2, 0, fade_state, arg1)
91+
92+
def draw_help_text():
93+
cleo.call_function(0x58B6E0)
94+
95+
def draw_mission_timers():
96+
cleo.call_function(0x58B180)
97+
98+
def draw_mission_title():
99+
cleo.call_function(0x58D240)
100+
101+
def draw_oddjob_message(priority : int):
102+
cleo.call_function(0x58CC80, 1, 0, priority)
103+
104+
def draw_radar():
105+
cleo.call_function(0x58A330)
106+
107+
def draw_script_text(priority : int):
108+
cleo.call_function(0x58C080, 1, 0, priority)
109+
110+
def draw_subtitles():
111+
cleo.call_function(0x58C250)
112+
113+
def draw_success_failed_message():
114+
cleo.call_function(0x58C6A0)
115+
116+
def draw_vehicle_names():
117+
cleo.call_function(0x58AEA0)
118+
119+
def draw_vital_stats():
120+
cleo.call_function(0x589650)
121+
122+
def get_rid_off_all_hud_messages(arg1 :int):
123+
cleo.call_function(0x588A50, 1, 0, arg1)
124+
125+
def get_posY_based_on_health(playerId :int, pos :float, offset: int):
126+
cleo.call_function(0x588B60, 3, 0, playerId, pos, offset)
127+
128+
def help_message_displayed():
129+
cleo.call_function(0x588B50)
130+
131+
def initialize():
132+
cleo.call_function(0x5BA850)
133+
134+
def reinitialize():
135+
cleo.call_function(0x588880)
136+
137+
def reset_wasted_text():
138+
cleo.call_function(0x589070)
139+
140+
def set_big_message(message :str, style: int):
141+
cleo.call_function(0x588FC0, 2, 0, message, style)
142+
143+
def set_help_message(message :str, quick_msg :bool = False, permanent :bool = False, add_to_brief :bool = False) -> None:
144+
'''Shows a game hud help popup on top left corner of the screen with provided message string'''
145+
cleo.call_function(0x588BE0, 4, 0, message, quick_msg, permanent, add_to_brief)
146+
147+
def set_help_message_stat_update(state :int, statId :int, diff :float, max :float):
148+
cleo.call_function(0x588D40, 4, 0, state, statId, diff, max)
149+
150+
def set_help_message_with_number(message :str, number :int, quick_msg :bool = False, permanent :bool = False, add_to_brief :bool = False) -> None:
151+
'''Shows a game hud help popup on top left corner of the screen with provided message string & number'''
152+
cleo.call_function(0x588E30, 4, 0, message, number, quick_msg, permanent, add_to_brief)
153+
154+
def set_message(message :str):
155+
cleo.call_function(0x588F60, 1, 0, message)
156+
157+
def set_vehicle_name(name :str):
158+
cleo.call_function(0x588F50, 1, 0, name)
159+
160+
def set_zone_name(name :str, state :int):
161+
cleo.call_function(0x588BB0, 2, 0, name, state)
162+
163+
def shutdown():
164+
cleo.call_function(0x588850)
165+
166+
def draw_ammo( pPed :int, x :int, y :int, alpha :float):
167+
cleo.call_function(0x5893B0, 4, 0, pPed, x, y, alpha)
168+
169+
def draw_player_info():
170+
cleo.call_function(0x58EAF0)
171+
172+
def draw_trip_skip():
173+
cleo.call_function(0x58A160)
174+
175+
def draw_wanted():
176+
cleo.call_function(0x58D9A0)
177+
178+
def draw_waeapon_icon( pPed :int, x :int, y :int, alpha :float):
179+
cleo.call_function(0x58D7D0, 4, 0, pPed, x, y, alpha)
180+
181+
def render_armour_bar( playerId :int, x :int, y :int):
182+
cleo.call_function(0x5890A0, 4, 0, playerId, x, y)
183+
184+
def render_breath_bar( playerId :int, x :int, y :int):
185+
cleo.call_function(0x589190, 4, 0, playerId, x, y)
186+
187+
def render_health_bar( playerId :int, x :int, y :int):
188+
cleo.call_function(0x589270, 4, 0, playerId, x, y)
189+
190+

src/PyLoader.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include <frameobject.h>
44
#include <Urlmon.h>
55
#include "depend/jute.h"
6-
#include "sdk/PyCHud.h"
76
#include "sdk/PyCommon.h"
87
#include "sdk/PyOpcodes.h"
98
#include "sdk/PyCLEO.h"
@@ -114,7 +113,6 @@ void PyLoader::PluginThread(void* param)
114113

115114
PyImport_AppendInittab("_bass", &PyBass::Init);
116115
PyImport_AppendInittab("_common", &PyCommon::Init);
117-
PyImport_AppendInittab("_hud", &PyCHud::Init);
118116
PyImport_AppendInittab("_memory", &PyMemory::Init);
119117
PyImport_AppendInittab("_opcodes", &PyOpcodes::Init);
120118
PyImport_AppendInittab("_cleo", &PyCLEO::Init);

src/sdk/PyCHud.cpp

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/sdk/PyCHud.h

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)