Skip to content

Commit ad01fa3

Browse files
committed
Move all ASM globals to globals.asm
1 parent d825a5c commit ad01fa3

32 files changed

+207
-86
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ endif
131131
# Global symbols.
132132
OBJS = sym.o
133133

134+
# Global variables
135+
OBJS += src\globals.o
136+
134137
# Source files included in ALL builds.
135138
OBJS += src/sun.ini.o
136139
OBJS += src/disable_dpi_scaling.o

src/attack_neutral_units.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
%include "TiberianSun.inc"
44
;; @CLEAR 0x0062D4B2, 0x90, 0x0062D4BA
55

6-
gbool AttackNeutralUnits, 0
6+
cextern AttackNeutralUnits
77

88
hack 0x0062D4B2, 0x0062D4BA
99
test al, al

src/auto_deploy_mcv.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
%include "macros/datatypes.inc"
33
%include "TiberianSun.inc"
44

5-
gbool AutoDeployMCV, false
5+
cextern AutoDeployMCV
66

77
; Makes starting units (the MCV on some scenarios) automatically deploy on game start
88

src/briefing_screen_mission_start.asm

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
%include "macros/datatypes.inc"
33
%include "TiberianSun.inc"
44

5-
cglobal PlayerSide
6-
cglobal SkipBriefingOnMissionStart
5+
cextern PlayerSide
6+
cextern SkipBriefingOnMissionStart
77
cextern DifficultyName
88

99
sstring str_Hard, "Difficulty: Hard"
@@ -12,8 +12,6 @@ sstring str_Easy, "Difficulty: Easy"
1212
sstring str_Difficulty, "Difficulty: "
1313

1414
section .bss
15-
PlayerSide RESD 1
16-
SkipBriefingOnMissionStart RESB 1
1715
DifficultyDisplayBuf RESB 256
1816

1917

src/buildconst_harvesterunit_baseunit.asm

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,8 @@
5454

5555
section .data
5656

57-
cglobal AlexB_HarvesterUnit
58-
AlexB_HarvesterUnit dd 0
59-
60-
cglobal AlexB_BuildRefinery
61-
AlexB_BuildRefinery dd 0
57+
cextern AlexB_HarvesterUnit
58+
cextern AlexB_BuildRefinery
6259

6360
section .text
6461

src/center_team.asm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
;;; Double tap the team selection key to center team on screen.
66
;;; Current way is to press alt+1 or alt+2 etc, to center team
77

8-
gint DoubleTapFrame, 0x7fffffff
9-
gint LastTeamNumber, 0
10-
gint DoubleTapInterval, 30
8+
cextern DoubleTapFrame
9+
cextern LastTeamNumber
10+
cextern DoubleTapInterval
1111

1212
hack 0x004E8E80, 0x004E8E86
1313
_SelectTeamCommandClass_Execute_after:

src/chatallies.asm

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
%include "macros/datatypes.inc"
33
%include "TiberianSun.inc"
44

5-
gstring str_ToAllies, "(Allies): "
6-
gstring str_ToAll, "(All): "
7-
gstring str_ToOne, "(one): "
8-
gstring str_ToSpectators, "(Specs): "
9-
10-
gbool ChatToAlliesFlag, 0
11-
gbool ChatToAllFlag, 0
12-
gbool ChatToOneFlag, 0
13-
gbool ChatToSpectatorsFlag, 0
5+
cextern str_ToAllies
6+
cextern str_ToAll
7+
cextern str_ToOne
8+
cextern str_ToSpectators
9+
10+
cextern ChatToAlliesFlag
11+
cextern ChatToAllFlag
12+
cextern ChatToOneFlag
13+
cextern ChatToSpectatorsFlag
1414

1515
cextern IsSpectatorArray
1616

src/disable_edge_scrolling.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
%include "macros/patch.inc"
33
%include "macros/datatypes.inc"
44

5-
gbool DisableEdgeScrolling, false ; Read from sun.ini in sun.ini.c
5+
cextern DisableEdgeScrolling ; Read from sun.ini in sun.ini.c
66
;;; Disable Edge scrolling
77
hack 0x005E9058, 0x005E905E
88
mov al, [DisableEdgeScrolling]

src/globals.asm

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
%include "macros/datatypes.inc"
2+
3+
; src\auto_ss.asm
4+
gbool RunAutoSS, 0
5+
gint DoingAutoSS, 0
6+
7+
; src\attack_neutral_units.asm
8+
gbool AttackNeutralUnits, 0
9+
10+
; src\auto_deploy_mcv.asm
11+
gbool AutoDeployMCV, false
12+
13+
; src\briefing_screen_mission_start.asm
14+
gint PlayerSide, 0
15+
gbool SkipBriefingOnMissionStart, 0
16+
17+
; src\buildconst_harvesterunit_baseunit.asm
18+
gint AlexB_HarvesterUnit, 0
19+
gint AlexB_BuildRefinery, 0
20+
21+
; src\center_team.asm
22+
gint DoubleTapFrame, 0x7fffffff
23+
gint LastTeamNumber, 0
24+
gint DoubleTapInterval, 30
25+
26+
; src\chatallies.asm
27+
gstring str_ToAllies, "(Allies): "
28+
gstring str_ToAll, "(All): "
29+
gstring str_ToOne, "(one): "
30+
gstring str_ToSpectators, "(Specs): "
31+
32+
gbool ChatToAlliesFlag, 0
33+
gbool ChatToAllFlag, 0
34+
gbool ChatToOneFlag, 0
35+
gbool ChatToSpectatorsFlag, 0
36+
37+
; src\disable_edge_scrolling.asm
38+
gbool DisableEdgeScrolling, false
39+
40+
; src\high_res_crash.asm
41+
gint BottomInfoPanel, 0
42+
43+
; src\manual_aim_sams.asm
44+
gbool AimableSams, 0
45+
46+
; src\mouse_always_in_focus.asm
47+
gbool MouseAlwaysInFocus, 0
48+
gbool MouseInFocusOnce, 0
49+
50+
; src\mouse_behavior.asm
51+
gint DragDistance, 4
52+
gbool OnlyRightClickDeselect, false
53+
54+
; src\mpdebug.asm
55+
gbool already_filled_rect, false
56+
57+
; src\multiplayer_movies.asm
58+
gbool NetworkRefreshStarted, false
59+
60+
; src\multiplayer_units_placing.asm
61+
gbool IsSpawnXAircraft, false
62+
cglobal UsedSpawnsArray
63+
section .bss
64+
UsedSpawnsArray: RESD 8
65+
66+
; src\no_window_frame.asm
67+
gbool NoWindowFrame, 1
68+
69+
; src\oil_derricks.asm
70+
gint ProduceCashFrameDelay, 180
71+
72+
; src\online_optimizations.asm
73+
gint LastRenderTime, 0
74+
gint WFPRenderInterval, 16
75+
76+
; src\record_rng_func.asm
77+
gbool NoRNG, 0
78+
79+
; src\scrap_metal_explosion.asm
80+
gbool ScrapMetal, false
81+
82+
; src\scrollrate_fix.asm
83+
gint ScrollDelay, 0
84+
85+
; src\smarter_firesale.asm
86+
gbool LeaveABuilding, false
87+
gint ObjectCount, 0
88+
89+
; src\smarter_harvesters.asm
90+
gint ClosestFreeRefinery, 0
91+
gint ClosestFreeRefineryDistance, 0
92+
gint ClosestPossiblyOccupiedRefinery, 0
93+
gint ClosestPossiblyOccupiedRefineryDistance, 0
94+
gint OldHarvDistance, 0
95+
96+
; src\unit_self_heal_repair_step.asm
97+
gint UnitSelfHealRepairStep, 1
98+
99+
; src\spawner\auto-surrender.asm
100+
gbool AutoSurrender, 0
101+
102+
; src\spawner\build_off_ally.asm
103+
gbool BuildOffAlly, 0
104+
105+
; src\spawner\protocol_zero.asm
106+
gbyte NewFrameSendRate, 2
107+
108+
; src\spawner\random_map.asm
109+
gbool RandomMap, 0
110+
111+
; src\spawner\spawner.asm
112+
gint SpawnerActive, 0
113+
cglobal INIClass_SPAWN
114+
cglobal SpawnLocationsArray
115+
cglobal SpawnLocationsHouses
116+
cglobal DifficultyName
117+
118+
gbool SavesDisabled, true
119+
gbool QuickMatch, false
120+
gbool IsHost, true
121+
gbool UseMPAIBaseNodes, false
122+
gbool PlayMoviesInMultiplayer, false
123+
gbool DifficultyBasedAINames, false
124+
gint CampaignID, 0
125+
126+
gstring MapHash, "", 256
127+
128+
section .bss
129+
INIClass_SPAWN RESB 256 ; FIXME: make this a local variable
130+
SpawnLocationsArray RESD 8
131+
SpawnLocationsHouses RESD 8
132+
DifficultyName RESB 30
133+
134+
; src\spawner\spectators.asm
135+
gbool SpectatorStuffInit, 0
136+
cglobal IsSpectatorArray
137+
section .bss
138+
IsSpectatorArray RESD 8

src/high_res_crash.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
; limit the height of the sidebar to max 1052 (equals 1920*1200 -> 19 icons). The game goes out of bounds with more icons and starts to corrupt memory
55
cextern InfoPanel
6-
gint BottomInfoPanel, 0 ; Gets set in sidebar.c
6+
cextern BottomInfoPanel ; Gets set in sidebar.c
77

88
hack 0x005F2766
99
cmp eax, 1052

0 commit comments

Comments
 (0)