@@ -15,6 +15,18 @@ local CHAR_HEIGHT = 16
15
15
local NEGATIVE_MAXIMUM = 1 << 63
16
16
local POSITIVE_MAXIMUM = ~NEGATIVE_MAXIMUM
17
17
local MAP_CLICK_BLOCK = " P1 Fire" -- prevent this input while clicking on map buttons
18
+
19
+ -- Map colors (0xAARRGGBB or "name" or false)
20
+ local ENEMY_COLOR = 0xFFFF0000
21
+ local ENEMY_WAIT_COLOR = 0xFFCC0000
22
+ local CORPSE_COLOR = false -- 0x80CC0000
23
+ local MISSILE_COLOR = 0xFFFF8000
24
+ local PLAYER_COLOR = 0xFF0080FF
25
+ local COUNTITEM_COLOR = false -- 0xA0FFFFFF
26
+ local ITEM_COLOR = false -- 0xA0FFFFFF
27
+ local MISC_COLOR = false -- 0xFFFFFFFF
28
+ local INERT_COLOR = false -- 0x80808080
29
+
18
30
-- shortcuts
19
31
local rl = memory .read_u32_le
20
32
local rw = memory .read_u16_le
@@ -27,8 +39,14 @@ local box = gui.drawBox
27
39
local drawline = gui .drawLine
28
40
-- local text = gui.pixelText -- INSANELY SLOW
29
41
42
+ local PlayerOffsets = dsda .player .offsets -- player member offsets in bytes
43
+ local MobjOffsets = dsda .mobj .offsets -- mobj member offsets in bytes
44
+ local LineOffsets = dsda .line .offsets -- line member offsets in bytes
45
+ local MobjType = dsda .mobjtype
46
+ local SpriteNumber = dsda .doom .spritenum
47
+ local MobjFlags = dsda .mobjflags
48
+
30
49
-- TOP LEVEL VARIABLES
31
- local LastWheel = 0
32
50
local Zoom = 1
33
51
local Init = true
34
52
-- tables
@@ -54,11 +72,6 @@ local LastMouse = {
54
72
wheel = 0
55
73
}
56
74
-- forward declarations
57
- local PlayerOffsets = dsda .player .offsets -- player member offsets in bytes
58
- local MobjOffsets = dsda .mobj .offsets -- mobj member offsets in bytes
59
- local LineOffsets = dsda .line .offsets -- line member offsets in bytes
60
- local MobjType = dsda .mobjtype
61
- local SpriteNumber = dsda .doom .spritenum
62
75
local Lines = {}
63
76
64
77
-- gui.defaultPixelFont("fceux")
@@ -141,6 +154,21 @@ local function get_line_count(str)
141
154
return lines , longest
142
155
end
143
156
157
+ local function get_mobj_color (mobj )
158
+ local flags = mobj .flags
159
+ if flags & (MobjFlags .PICKUP | MobjFlags .FRIEND ) ~= 0 then return PLAYER_COLOR end
160
+ if flags & (MobjFlags .COUNTKILL | MobjFlags .SKULLFLY ) ~= 0 then
161
+ if flags & MobjFlags .CORPSE ~= 0 and flags & MobjFlags .RESSURECTED == 0 then return CORPSE_COLOR end
162
+ if flags & MobjFlags .AMBUSH ~= 0 or mobj .target == 0 then return ENEMY_WAIT_COLOR end
163
+ return ENEMY_COLOR
164
+ end
165
+ if flags & MobjFlags .COUNTITEM ~= 0 then return COUNTITEM_COLOR end
166
+ if flags & MobjFlags .SPECIAL ~= 0 then return ITEM_COLOR end
167
+ if flags & MobjFlags .MISSILE ~= 0 then return MISSILE_COLOR end
168
+ if flags & MobjFlags .SHOOTABLE ~= 0 then return MISC_COLOR end
169
+ return INERT_COLOR
170
+ end
171
+
144
172
local function iterate_players ()
145
173
local playercount = 0
146
174
local total_killcount = 0
@@ -170,25 +198,27 @@ local function iterate()
170
198
if Init then return end
171
199
172
200
for addr , mobj in pairs (dsda .mobj .items ) do
173
- local pos = { x = mapify_x (mobj .x ), y = mapify_y (- mobj .y ) }
174
- local radius = math.floor ((mobj .radius >> 16 ) * Zoom )
175
- -- local sprite = SpriteNumber[mobj.sprite]
176
- local type = MobjType [mobj .type ]
177
- local color = " white"
178
-
179
- if mobj .health <= 0 then color = " red" end
180
- --[[ --
181
- local z = mobj.z
182
- local index = mobj.index
183
- local tics = mobj.tics
184
- --]] --
185
- if in_range (pos .x , 0 , client .screenwidth ())
186
- and in_range (pos .y , 0 , client .screenheight ())
187
- and type
188
- and not string.find (type , " MISC" )
189
- then
190
- text (pos .x , pos .y , string.format (" %s" , type ), color )
191
- box (pos .x - radius , pos .y - radius , pos .x + radius , pos .y + radius , color )
201
+ local color = get_mobj_color (mobj )
202
+ if color then -- not hidden
203
+ local pos = { x = mapify_x (mobj .x ), y = mapify_y (- mobj .y ) }
204
+
205
+ if in_range (pos .x , 0 , client .screenwidth ())
206
+ and in_range (pos .y , 0 , client .screenheight ())
207
+ then
208
+ local type = mobj .type
209
+ local radius = math.floor ((mobj .radius >> 16 ) * Zoom )
210
+ --[[ --
211
+ local z = mobj.z
212
+ local index = mobj.index
213
+ local tics = mobj.tics
214
+ local health = mobj.health
215
+ local sprite = SpriteNumber[mobj.sprite]
216
+ --]] --
217
+
218
+ type = MobjType [type ]
219
+ text (pos .x , pos .y , string.format (" %s" , type ), color )
220
+ box (pos .x - radius , pos .y - radius , pos .x + radius , pos .y + radius , color )
221
+ end
192
222
end
193
223
end
194
224
0 commit comments