Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/Assets/Lua/Genesis/Castlevania Bloodlines.lua
2 views
1
-------------------------------
2
----Castlevania Blood Lines----
3
-------------------------------
4
5
--Author Pasky13
6
7
---------------
8
----Toggles----
9
---------------
10
local draw_ehp = true -- Set to false to turn off HP display for enemies
11
local draw_php = true -- Set to false to turn off HP display for 1P
12
local draw_pproj = true --Set to false to turn off player projectiles
13
14
local draw_ph = true -- Set to false to turn off player hitboxes
15
local draw_eh = true -- Set to false to turn off enemie hitboxes
16
17
local infhp = true --Set to false to turn off infinite HP for the player
18
19
20
local playerbase = 0xB300
21
local face = 0x2C
22
local php = 0x9C11
23
local weapon = 0xB480
24
local spear = 0x9CA7
25
local enemybase = 0xB380
26
27
local xcord = 0x18
28
local ycord = 0x1C
29
30
31
32
33
local function playerhitbox()
34
35
-------------------------
36
----Vulnerability box----
37
-------------------------
38
local facing = mainmemory.read_u8(playerbase+face)
39
local x = mainmemory.read_u16_be(playerbase+0x18)
40
local y = mainmemory.read_u16_be(playerbase+0x1C)
41
local xoff = mainmemory.read_s16_be(playerbase+0x34)
42
local yoff = mainmemory.read_s16_be(playerbase+0x36)
43
local xrad = mainmemory.read_u16_be(playerbase+0x38)
44
local yrad = mainmemory.read_u16_be(playerbase+0x3A)
45
46
gui.drawBox(x+xoff,y+yoff,x+xoff+xrad,y+yoff+yrad,0xF00000FF,0x300000FF)
47
48
49
---------------------
50
----weapon hitbox----
51
---------------------
52
facing = mainmemory.read_u8(playerbase+face)
53
54
x = mainmemory.read_u16_be(weapon+0x18)
55
y = mainmemory.read_u16_be(weapon+0x1C)
56
xoff = mainmemory.read_s16_be(weapon+0x34)
57
yoff = mainmemory.read_s16_be(weapon+0x36)
58
xrad = mainmemory.read_u16_be(weapon+0x38)
59
yrad = mainmemory.read_u16_be(weapon+0x3A)
60
61
if mainmemory.read_u8(weapon+0x01) == 1 and mainmemory.read_u8(weapon+0x28) > 0 then
62
gui.drawBox(x+xoff,y+yoff,x+xoff+xrad,y+yoff+yrad,0xFFFFFFFF,0x40FFFFFF)
63
end
64
65
end
66
67
local function player_projectiles()
68
69
local start = 0xC900
70
local base
71
local x
72
local y
73
local xoff
74
local yoff
75
local xrad
76
local yrad
77
local facing
78
local ehp
79
local oend = 32
80
local active = false
81
82
for i = 0,oend,1 do
83
active = false
84
base = start + (i * 0x80)
85
86
x = mainmemory.read_u16_be(base + xcord)
87
y = mainmemory.read_u16_be(base + ycord)
88
89
if mainmemory.read_u8(base+1) == 1 then
90
active = true
91
end
92
93
if y < 224 and y > 0 and x < 320 and x > 0 and active == true and (mainmemory.read_u8(base+0x45)) > 0 and mainmemory.read_u8(base+0x4F) > 0 and mainmemory.read_u8(base+0x28) == 1 then
94
95
facing = mainmemory.read_u8(base+face)
96
x = mainmemory.read_u16_be(base+0x18)
97
y = mainmemory.read_u16_be(base+0x1C)
98
xoff = mainmemory.read_s16_be(base+0x34)
99
yoff = mainmemory.read_s16_be(base+0x36)
100
xrad = mainmemory.read_u16_be(base+0x38)
101
yrad = mainmemory.read_u16_be(base+0x3A)
102
103
gui.drawBox(x+xoff,y+yoff,x+xoff+xrad,y+yoff+yrad,0xFFFFFFFF,0x40FFFFFF)
104
105
gui.text((x-8) * xmult,(y+10) * ymult,"DMG: " .. mainmemory.read_u8(base+0x45))
106
end
107
108
end
109
end
110
111
local function playerinfo()
112
local x = mainmemory.read_u16_be(playerbase+xcord)
113
local y = mainmemory.read_u16_be(playerbase+ycord)
114
local hp = mainmemory.read_u8(php)
115
116
if draw_php == true then
117
gui.text((x-12) * xmult,y * ymult,"HP: " .. hp)
118
end
119
120
if draw_ph == true then
121
playerhitbox()
122
end
123
124
if draw_pproj == true then
125
player_projectiles()
126
end
127
128
end
129
130
local function enemyinfo()
131
132
local base
133
local x
134
local y
135
local xoff
136
local yoff
137
local xrad
138
local yrad
139
local facing
140
local ehp
141
local oend = 44
142
local active = false
143
144
for i = 0,oend,1 do
145
146
active = false
147
base = enemybase + (i * 0x80)
148
149
x = mainmemory.read_u16_be(base + xcord)
150
y = mainmemory.read_u16_be(base + ycord)
151
152
if mainmemory.read_u8(base+1) == 1 then
153
active = true
154
end
155
156
local ehp = mainmemory.read_u8(base+0x55)
157
158
if base ~= weapon then
159
160
if y < 224 and y > 0 and x < 320 and x > 0 and active == true then
161
162
if draw_ehp == true and ehp > 0 then
163
gui.text((x-10) * xmult,y * ymult,"HP: " .. ehp)
164
end
165
166
--------------------
167
----Enemy Hitbox----
168
--------------------
169
170
if draw_eh == true then
171
facing = mainmemory.read_u8(base+face)
172
x = mainmemory.read_u16_be(base+0x18)
173
y = mainmemory.read_u16_be(base+0x1C)
174
xoff = mainmemory.read_s16_be(base+0x34)
175
yoff = mainmemory.read_s16_be(base+0x36)
176
xrad = mainmemory.read_u16_be(base+0x38)
177
yrad = mainmemory.read_u16_be(base+0x3A)
178
gui.drawBox(x+xoff,y+yoff,x+xoff+xrad,y+yoff+yrad,0xFFFF0000,0x40FF0000)
179
end
180
181
end
182
end
183
184
end
185
186
end
187
188
189
190
local function infinitehp()
191
memory.writebyte(php,80)
192
end
193
194
local function scaler()
195
xmult = client.screenwidth() / 320
196
ymult = client.screenheight() / 224
197
end
198
199
while true do
200
scaler()
201
playerinfo()
202
enemyinfo()
203
if infhp == true then
204
infinitehp()
205
end
206
emu.frameadvance()
207
end
208
209