Skip to content

Commit 99a11ea

Browse files
authored
Merge pull request #3795 from rakieldev/newstuff
feat(motif): select screen slot indicator
2 parents 6fa1179 + 897b25b commit 99a11ea

4 files changed

Lines changed: 132 additions & 0 deletions

File tree

external/script/main.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,6 +1430,10 @@ function main.f_addChar(line, playable, loading, slot)
14301430
table.insert(main.t_selGrid, {['chars'] = {row}, ['slot'] = 1})
14311431
else
14321432
table.insert(main.t_selGrid[#main.t_selGrid].chars, row)
1433+
-- marks all chars using this slot
1434+
for _, idx in ipairs(main.t_selGrid[#main.t_selGrid].chars) do
1435+
main.t_selChars[idx].hasSlot = true
1436+
end
14331437
end
14341438
for _, v in ipairs({'next', 'previous', 'select'}) do
14351439
if main.t_selChars[row][v] ~= nil then

external/script/start.lua

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,18 @@ local function drawPortraitRandom(randomCfg)
797797
return false
798798
end
799799

800+
local function drawPortraitSlot(slotCfg)
801+
if not slotCfg then
802+
return false
803+
end
804+
local spr = slotCfg.spr
805+
if slotCfg.anim >= 0 or (spr and spr[1] >= 0 and spr[2] >= 0) then
806+
main.f_animPosDraw(slotCfg.AnimData)
807+
return true
808+
end
809+
return false
810+
end
811+
800812
local function hasPortraitAnim(params)
801813
return params ~= nil and params.AnimData ~= nil and ((params.anim or -1) ~= -1 or (params.spr ~= nil and params.spr[1] ~= -1))
802814
end
@@ -896,6 +908,29 @@ function start.f_drawPortraits(t_portraits, side, t, subname, last, iconDone)
896908
end
897909
end
898910
end
911+
-- draw slot indicator
912+
for m = 1, #t_portraits do
913+
local pn = 2 * (m - 1) + side
914+
local pData = f_getMotifP(t, pn, side)
915+
916+
local baseFace = pData
917+
if subname and subname ~= '' then
918+
baseFace = baseFace[subname]
919+
end
920+
if t_portraits[m].ref ~= nil then
921+
local charInfo = main.t_selChars[t_portraits[m].ref + 1]
922+
if charInfo and charInfo.hasSlot then
923+
-- face2 slot
924+
if pData.face2.slot then
925+
drawPortraitSlot(pData.face2.slot)
926+
end
927+
-- primary face slot
928+
if baseFace.slot then
929+
drawPortraitSlot(baseFace.slot)
930+
end
931+
end
932+
end
933+
end
899934
-- face2 layer (if present)
900935
drawPortraitLayer(t_portraits, side, t, 'face2', last, 'face2_data')
901936
-- primary face layer
@@ -2505,6 +2540,16 @@ function start.updateDrawList()
25052540
end
25062541
end
25072542
table.insert(drawList, item)
2543+
local grid = main.t_selGrid[cellIndex]
2544+
local hasMultipleChars = grid ~= nil and #grid.chars > 1
2545+
-- draw slot indicator
2546+
if hasMultipleChars and hasPortraitAnim(motif.select_info.cell.slot) then
2547+
local icon = getTransforms(motif.select_info.cell.slot)
2548+
icon.anim = motif.select_info.cell.slot.AnimData
2549+
icon.x = motif.select_info.pos[1] + t.x + motif.select_info.cell.slot.offset[1]
2550+
icon.y = motif.select_info.pos[2] + t.y + motif.select_info.cell.slot.offset[2]
2551+
table.insert(drawList, icon)
2552+
end
25082553
end
25092554
end
25102555
end

src/motif.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ type FaceProperties struct {
417417
} `ini:"done"`
418418
Random AnimationProperties `ini:"random"` // only used by [Select Info]
419419
Loading AnimationProperties `ini:"loading"` // only used by [Select Info] and [VS Screen]
420+
Slot AnimationProperties `ini:"slot"` // only used by [Select Info]
420421
Velocity [2]float32 `ini:"velocity"`
421422
MaxDist [2]float32 `ini:"maxdist"`
422423
Accel [2]float32 `ini:"accel"`
@@ -691,6 +692,7 @@ type SelectInfoProperties struct {
691692
SwitchTime int32 `ini:"switchtime"`
692693
} `ini:"random"`
693694
MapCell map[string]*CellOverrideProperties `ini:"map:^[0-9*]+-[0-9*]+$" lua:""`
695+
Slot AnimationProperties `ini:"slot"`
694696
} `ini:"cell"`
695697
P1 PlayerSelectProperties `ini:"p1"`
696698
P2 PlayerSelectProperties `ini:"p2"`
@@ -2662,6 +2664,10 @@ func (m *Motif) applyPostParsePosAdjustments() {
26622664
// Face.Random and Face2.Random
26632665
offsetAnims(ps.Face.Pos[0], ps.Face.Pos[1], ps.Face.Random.AnimData)
26642666
offsetAnims(ps.Face2.Pos[0], ps.Face2.Pos[1], ps.Face2.Random.AnimData)
2667+
2668+
// Face.Slot and Face2.Slot
2669+
offsetAnims(ps.Face.Pos[0], ps.Face.Pos[1], ps.Face.Slot.AnimData)
2670+
offsetAnims(ps.Face2.Pos[0], ps.Face2.Pos[1], ps.Face2.Slot.AnimData)
26652671
}
26662672

26672673
// Select Screen: Players

src/resources/defaultMotif.ini

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,22 @@ Welcome to I.K.E.M.E.N GO engine! (%s - %s)
717717
;cell.<col>-<row>.focallength = 2048
718718
;cell.<col>-<row>.skip = 0
719719

720+
; If defined draws a sprite or anim from the screenpack on cells using the slot parameter in select.def.
721+
cell.slot.anim = -1
722+
cell.slot.spr = -1, 0
723+
cell.slot.offset = 0, 0
724+
cell.slot.facing = 1
725+
cell.slot.scale = 1.0, 1.0
726+
cell.slot.xshear = 0
727+
cell.slot.angle = 0
728+
cell.slot.xangle = 0
729+
cell.slot.yangle = 0
730+
cell.slot.projection = orthographic
731+
cell.slot.focallength = 2048
732+
cell.slot.layerno = 0
733+
cell.slot.window =
734+
cell.slot.localcoord = 320, 240
735+
720736
; All cursor parameters can be specified for player 1-8.
721737
; p3-p8 assignments defaults to p1 and p2 values, if not specified
722738
p1.cursor.startcell = 0, 0
@@ -891,6 +907,22 @@ Welcome to I.K.E.M.E.N GO engine! (%s - %s)
891907
p1.face.random.window =
892908
p1.face.random.localcoord = 320, 240
893909

910+
; If defined draws a sprite or anim from the screenpack on chars using the slot parameter in select.def.
911+
p1.face.slot.anim = -1
912+
p1.face.slot.spr = -1, 1
913+
p1.face.slot.offset = 0, 0
914+
p1.face.slot.facing = 1
915+
p1.face.slot.scale = 1.0, 1.0
916+
p1.face.slot.xshear = 0
917+
p1.face.slot.angle = 0
918+
p1.face.slot.xangle = 0
919+
p1.face.slot.yangle = 0
920+
p1.face.slot.projection = orthographic
921+
p1.face.slot.focallength = 2048
922+
p1.face.slot.layerno = 0
923+
p1.face.slot.window =
924+
p1.face.slot.localcoord = 320, 240
925+
894926
; If defined draws a sprite or anim from the screenpack during char assets boot loading
895927
p1.face.loading.anim = -1
896928
p1.face.loading.spr = -1, 1
@@ -981,6 +1013,21 @@ Welcome to I.K.E.M.E.N GO engine! (%s - %s)
9811013
p1.face2.random.window =
9821014
p1.face2.random.localcoord = 320, 240
9831015

1016+
p1.face2.slot.anim = -1
1017+
p1.face2.slot.spr = -1, 1
1018+
p1.face2.slot.offset = 0, 0
1019+
p1.face2.slot.facing = 1
1020+
p1.face2.slot.scale = 1.0, 1.0
1021+
p1.face2.slot.xshear = 0
1022+
p1.face2.slot.angle = 0
1023+
p1.face2.slot.xangle = 0
1024+
p1.face2.slot.yangle = 0
1025+
p1.face2.slot.projection = orthographic
1026+
p1.face2.slot.focallength = 2048
1027+
p1.face2.slot.layerno = 0
1028+
p1.face2.slot.window =
1029+
p1.face2.slot.localcoord = 320, 240
1030+
9841031
p1.face2.loading.anim = -1
9851032
p1.face2.loading.spr = -1, 1
9861033
p1.face2.loading.offset = 0, 0
@@ -1465,6 +1512,21 @@ Welcome to I.K.E.M.E.N GO engine! (%s - %s)
14651512
p2.face.random.window =
14661513
p2.face.random.localcoord = 320, 240
14671514

1515+
p2.face.slot.anim = -1
1516+
p2.face.slot.spr = -1, 1
1517+
p2.face.slot.offset = 0, 0
1518+
p2.face.slot.facing = 1
1519+
p2.face.slot.scale = 1.0, 1.0
1520+
p2.face.slot.xshear = 0
1521+
p2.face.slot.angle = 0
1522+
p2.face.slot.xangle = 0
1523+
p2.face.slot.yangle = 0
1524+
p2.face.slot.projection = orthographic
1525+
p2.face.slot.focallength = 2048
1526+
p2.face.slot.layerno = 0
1527+
p2.face.slot.window =
1528+
p2.face.slot.localcoord = 320, 240
1529+
14681530
p2.face.loading.anim = -1
14691531
p2.face.loading.spr = -1, 1
14701532
p2.face.loading.offset = 0, 0
@@ -1546,6 +1608,21 @@ Welcome to I.K.E.M.E.N GO engine! (%s - %s)
15461608
p2.face2.random.window =
15471609
p2.face2.random.localcoord = 320, 240
15481610

1611+
p2.face2.slot.anim = -1
1612+
p2.face2.slot.spr = -1, 1
1613+
p2.face2.slot.offset = 0, 0
1614+
p2.face2.slot.facing = 1
1615+
p2.face2.slot.scale = 1.0, 1.0
1616+
p2.face2.slot.xshear = 0
1617+
p2.face2.slot.angle = 0
1618+
p2.face2.slot.xangle = 0
1619+
p2.face2.slot.yangle = 0
1620+
p2.face2.slot.projection = orthographic
1621+
p2.face2.slot.focallength = 2048
1622+
p2.face2.slot.layerno = 0
1623+
p2.face2.slot.window =
1624+
p2.face2.slot.localcoord = 320, 240
1625+
15491626
p2.face2.loading.anim = -1
15501627
p2.face2.loading.spr = -1, 1
15511628
p2.face2.loading.offset = 0, 0

0 commit comments

Comments
 (0)