go back to 0x0.0001 increments for xp

I foresee the 32K limit being a bigger problem than the math in vertmeter, although I will probably need to go patch vertmeter up too
This commit is contained in:
Kistaro Windrider 2024-12-29 23:39:56 -08:00
parent 78b200272e
commit afa1f22170
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -485,14 +485,15 @@ function ship_m:die()
local sz4 = self.size * 4 local sz4 = self.size * 4
local cx, cy, xp, z = self.x + sz4, self.y + sz4, self.xp or 0, 0 local cx, cy, xp, z = self.x + sz4, self.y + sz4, self.xp or 0, 0
boom(cx, cy, 3*sz4, self.boss) boom(cx, cy, 3*sz4, self.boss)
if xp > 499 then if xp > 0x0.01f3 then -- dec 499
-- spawn a huge gem with all -- spawn a huge gem with all
-- overage XP, min 100 -- overage XP, min 100
spawn_xp_at(cx, cy, 0, xp-399) spawn_xp_at(cx, cy, 0, xp-0x0.18f)
xp = 399 xp = 0x0.18f -- dec 399
z += 1 z += 1
end end
for gsz in all{100, 25, 5, 1} do -- 100, 25, 5, 1
for gsz in all{0x0.0064, 0x0.0019, 0x0.0005, 0x0.0001} do
while xp >= gsz do while xp >= gsz do
spawn_xp_at(cx, cy, z, gsz) spawn_xp_at(cx, cy, z, gsz)
xp -= gsz xp -= gsz
@ -950,9 +951,9 @@ player = mknew(ship_m.new{
shield = 2, -- regenerates shield = 2, -- regenerates
maxshield = 2, maxshield = 2,
-- xp; watch out for 16-bit range limits -- xp in increments of 0x0.0001
xp = 0, xp = 0,
xptarget = 4, xptarget = 0x0.0004,
level = 1, level = 1,
-- gun -- gun
@ -1010,7 +1011,7 @@ frownie = mknew(ship_m.new{
sparkodds = 8, sparkodds = 8,
hp = 0.5, -- enemy ships need no max hp hp = 0.5, -- enemy ships need no max hp
xp = 1, xp = 0x0.0001,
-- position -- position
x=60, -- x and y are for upper left corner x=60, -- x and y are for upper left corner
@ -1032,7 +1033,7 @@ frownie = mknew(ship_m.new{
blocky = mknew(frownie.new{ blocky = mknew(frownie.new{
sprite = 10, sprite = 10,
hp = 1.5, hp = 1.5,
xp = 2, xp = 0x0.0002,
hurt = { hurt = {
x_off = 0, x_off = 0,
y_off = 0, y_off = 0,
@ -1052,7 +1053,7 @@ blocky = mknew(frownie.new{
spewy = mknew(frownie.new{ spewy = mknew(frownie.new{
sprite=26, sprite=26,
xp = 3, xp = 0x0.0003,
hurt = { hurt = {
x_off=0, x_off=0,
y_off=1, y_off=1,
@ -1073,7 +1074,7 @@ spewy = mknew(frownie.new{
chasey = mknew(ship_m.new{ chasey = mknew(ship_m.new{
sprite = 5, sprite = 5,
xp = 4, xp = 0x0.0004,
size = 1, size = 1,
hurt = { hurt = {
x_off = 1, x_off = 1,
@ -1108,7 +1109,7 @@ end
xl_chasey=mknew(chasey.new{ xl_chasey=mknew(chasey.new{
size=2, size=2,
xp = 10, xp = 0x0.000a,
maxspd=1.25, maxspd=1.25,
hurt = { hurt = {
x_off = 2, x_off = 2,
@ -1606,7 +1607,7 @@ function spawn_xp_at(x, y, off, amt)
x += rnd(off+off)-off x += rnd(off+off)-off
y += rnd(off+off)-off y += rnd(off+off)-off
xp_gem.new{ xp_gem.new{
qsprite=amt == 1 and 32 or amt == 5 and 33 or amt == 25 and 34 or 35, qsprite=amt == 0x0.0001 and 32 or amt == 0x0.0005 and 33 or amt == 0x0.0019 and 34 or 35,
val = amt, val = amt,
}:spawn_at(mid(x, 0, 124),mid(y,-4,125)) }:spawn_at(mid(x, 0, 124),mid(y,-4,125))
end end