• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Go で書き直した Ikemen


Commit MetaInfo

修订版c280b2034f8c088f8b3e0691631a03d4132767a5 (tree)
时间2018-12-14 20:33:57
作者neatunsou <sisiy4excite@gmai...>
Commiterneatunsou

Log Message

SFFのバージョンが2.0だとパレットのアルファ透明度を反映させないようにした
ポートレイトのサイズをlocalcoordに合わせるようにした
ついでにポートレイトのサイズを指定できるようにした

更改概述

差异

--- a/src/char.go
+++ b/src/char.go
@@ -1367,6 +1367,7 @@ type CharGlobalInfo struct {
13671367 pctime, pcid int32
13681368 unhittable int32
13691369 quotes [MaxQuotes]string
1370+ portraitscale float32
13701371 }
13711372
13721373 func (cgi *CharGlobalInfo) clearPCTime() {
@@ -1657,6 +1658,8 @@ func (c *Char) load(def string) error {
16571658 gi.nameLow = strings.ToLower(c.name)
16581659 is.ReadI32("localcoord", &c.localcoord)
16591660 c.localscl = 320 / float32(c.localcoord)
1661+ gi.portraitscale = c.localscl
1662+ is.ReadF32("portraitscale", &gi.portraitscale)
16601663 }
16611664 case "files":
16621665 if files {
--- a/src/common.go
+++ b/src/common.go
@@ -562,7 +562,7 @@ func (l *Layout) Read(pre string, is IniSection) {
562562 l.layerno = I32ToI16(Min(2, ln))
563563 is.ReadF32(pre+"scale", &l.scale[0], &l.scale[1])
564564 }
565-func (l *Layout) DrawSprite(x, y float32, ln int16, s *Sprite, fx *PalFX) {
565+func (l *Layout) DrawSprite(x, y float32, ln int16, s *Sprite, fx *PalFX, fscale float32) {
566566 if l.layerno == ln && s != nil {
567567 if l.facing < 0 {
568568 x += sys.lifebarFontScale
@@ -575,7 +575,7 @@ func (l *Layout) DrawSprite(x, y float32, ln int16, s *Sprite, fx *PalFX) {
575575 pal = fx.getFxPal(pal, false)
576576 }
577577 s.Draw(x+l.offset[0], y+l.offset[1],
578- l.scale[0]*float32(l.facing), l.scale[1]*float32(l.vfacing), pal)
578+ l.scale[0]*float32(l.facing)*fscale, l.scale[1]*float32(l.vfacing)*fscale, pal)
579579 }
580580 }
581581 func (l *Layout) DrawAnim(r *[4]int32, x, y, scl float32, ln int16,
--- a/src/image.go
+++ b/src/image.go
@@ -1077,6 +1077,9 @@ func loadSff(filename string, char bool) (*Sff, error) {
10771077 if err := read(rgba[:]); err != nil {
10781078 return nil, err
10791079 }
1080+ if s.header.Ver2 == 0 {
1081+ rgba[3] = 255
1082+ }
10801083 pal[i] = uint32(rgba[3])<<24 | uint32(rgba[2])<<16 | uint32(rgba[1])<<8 | uint32(rgba[0])
10811084 }
10821085 idx = i
--- a/src/lifebar.go
+++ b/src/lifebar.go
@@ -268,10 +268,12 @@ type LifeBarFace struct {
268268 teammate_face []*Sprite
269269 teammate_face_lay Layout
270270 numko int32
271+ scale float32
272+ teammate_scale []float32
271273 }
272274
273275 func newLifeBarFace() *LifeBarFace {
274- return &LifeBarFace{face_spr: [2]int32{-1}, teammate_face_spr: [2]int32{-1}}
276+ return &LifeBarFace{face_spr: [2]int32{-1}, teammate_face_spr: [2]int32{-1}, scale: 1}
275277 }
276278 func readLifeBarFace(pre string, is IniSection,
277279 sff *Sff, at AnimationTable) *LifeBarFace {
@@ -309,7 +311,7 @@ func (f *LifeBarFace) draw(layerno int16, fx *PalFX, superplayer bool) {
309311 sys.brightness = 256
310312 }
311313 f.face_lay.DrawSprite(float32(f.pos[0]), float32(f.pos[1]), layerno,
312- f.face, fx)
314+ f.face, fx, f.scale)
313315 sys.brightness = ob
314316 i := int32(len(f.teammate_face)) - 1
315317 x := float32(f.teammate_pos[0] + f.teammate_spacing[0]*(i-1))
@@ -317,7 +319,7 @@ func (f *LifeBarFace) draw(layerno int16, fx *PalFX, superplayer bool) {
317319 for ; i >= 0; i-- {
318320 if i != f.numko {
319321 f.teammate_bg.Draw(x, y, layerno)
320- f.teammate_face_lay.DrawSprite(x, y, layerno, f.teammate_face[i], nil)
322+ f.teammate_face_lay.DrawSprite(x, y, layerno, f.teammate_face[i], nil, f.teammate_scale[i])
321323 if i < f.numko {
322324 f.teammate_ko.Draw(x, y, layerno)
323325 }
@@ -653,6 +655,7 @@ type LifeBarRound struct {
653655 cur int32
654656 wt, swt, dt [2]int32
655657 fnt []*Fnt
658+ timerActive bool
656659 }
657660
658661 func newLifeBarRound(snd *Snd, fnt []*Fnt) *LifeBarRound {
@@ -666,7 +669,12 @@ func readLifeBarRound(is IniSection,
666669 r := newLifeBarRound(snd, fnt)
667670 var tmp int32
668671 is.ReadI32("pos", &r.pos[0], &r.pos[1])
669- is.ReadI32("match.wins", &r.match_wins)
672+ tmp = Atoi(sys.cmdFlags["-rounds"])
673+ if tmp > 0 {
674+ r.match_wins = tmp
675+ } else {
676+ is.ReadI32("match.wins", &r.match_wins)
677+ }
670678 is.ReadI32("match.maxdrawgames", &r.match_maxdrawgames)
671679 if is.ReadI32("start.waittime", &tmp) {
672680 r.start_waittime = Max(1, tmp)
@@ -712,6 +720,8 @@ func readLifeBarRound(is IniSection,
712720 func (r *LifeBarRound) callFight() {
713721 r.fight.Reset()
714722 r.cur, r.wt[0], r.swt[0], r.dt[0] = 1, r.fight_time, r.fight_sndtime, 0
723+ sys.timerCount = append(sys.timerCount, sys.gameTime)
724+ r.timerActive = true
715725 }
716726 func (r *LifeBarRound) act() bool {
717727 if sys.intro > r.ctrl_time {
@@ -764,6 +774,14 @@ func (r *LifeBarRound) act() bool {
764774 r.wt[0]--
765775 }
766776 } else if r.cur == 2 && (sys.finish != FT_NotYet || sys.time == 0) {
777+ if r.timerActive {
778+ if sys.gameTime-sys.timerCount[sys.round-1] > 0 {
779+ sys.timerCount[sys.round-1] = sys.gameTime - sys.timerCount[sys.round-1]
780+ } else {
781+ sys.timerCount[sys.round-1] = 0
782+ }
783+ r.timerActive = false
784+ }
767785 f := func(ats *AnimTextSnd, t int) {
768786 if r.swt[t] == 0 {
769787 r.snd.play(ats.snd)
@@ -965,6 +983,8 @@ func loadLifebar(deffile string) (*Lifebar, error) {
965983 }
966984 }
967985 }
986+ case "fonts":
987+ is.ReadF32("scale", &sys.lifebarFontScale)
968988 case "lifebar":
969989 if l.hb[0][0] == nil {
970990 l.hb[0][0] = readHealthBar("p1.", is, sff, at)
--- a/src/script.go
+++ b/src/script.go
@@ -5,6 +5,8 @@ import (
55 "runtime"
66 "strings"
77
8+ "math/rand"
9+
810 "github.com/go-gl/glfw/v3.2/glfw"
911 "github.com/yuin/gopher-lua"
1012 )
@@ -239,6 +241,10 @@ func scriptCommonInit(l *lua.LState) {
239241 sys.match = int32(numArg(l, 1))
240242 return 0
241243 })
244+ luaRegister(l, "setLifeShare", func(l *lua.LState) int {
245+ sys.teamLifeShare = boolArg(l, 1)
246+ return 0
247+ })
242248 }
243249
244250 // System Script
@@ -343,7 +349,16 @@ func systemScriptInit(l *lua.LState) {
343349 if !ok {
344350 userDataError(l, 1, a)
345351 }
346- a.SetTile(int32(numArg(l, 2)), int32(numArg(l, 3)))
352+ var sx, sy int32 = 0, 0
353+ if l.GetTop() >= 4 {
354+ sx = int32(numArg(l, 4))
355+ if l.GetTop() >= 5 {
356+ sy = int32(numArg(l, 5))
357+ } else {
358+ sy = sx
359+ }
360+ }
361+ a.SetTile(int32(numArg(l, 2)), int32(numArg(l, 3)), sx, sy)
347362 return 0
348363 })
349364 luaRegister(l, "animSetColorKey", func(*lua.LState) int {
@@ -395,6 +410,14 @@ func systemScriptInit(l *lua.LState) {
395410 a.Draw()
396411 return 0
397412 })
413+ luaRegister(l, "animReset", func(*lua.LState) int {
414+ a, ok := toUserData(l, 1).(*Anim)
415+ if !ok {
416+ userDataError(l, 1, a)
417+ }
418+ a.ResetFrames()
419+ return 0
420+ })
398421 luaRegister(l, "enterNetPlay", func(*lua.LState) int {
399422 if sys.netInput != nil {
400423 l.RaiseError("すでに通信中です。")
@@ -594,6 +617,10 @@ func systemScriptInit(l *lua.LState) {
594617 if !sys.frameSkip {
595618 c := sys.sel.GetChar(n)
596619 if c != nil && c.lportrait != nil {
620+ if c.portrait_scale != 1 {
621+ xscl *= c.portrait_scale
622+ yscl *= c.portrait_scale
623+ }
597624 c.lportrait.Draw(x, y, xscl, yscl, c.lportrait.Pal)
598625 }
599626 }
@@ -613,8 +640,8 @@ func systemScriptInit(l *lua.LState) {
613640 if c != nil {
614641 if c.sportrait != nil {
615642 c.sportrait.Draw(x+float32(i)*sys.sel.cellsize[0],
616- y+float32(j)*sys.sel.cellsize[1], sys.sel.cellscale[0],
617- sys.sel.cellscale[1], c.sportrait.Pal)
643+ y+float32(j)*sys.sel.cellsize[1], sys.sel.cellscale[0]*c.portrait_scale,
644+ sys.sel.cellscale[1]*c.portrait_scale, c.sportrait.Pal)
618645 } else if c.def == "randomselect" && sys.sel.randomspr != nil {
619646 sys.sel.randomspr.Draw(x+float32(i)*sys.sel.cellsize[0],
620647 y+float32(j)*sys.sel.cellsize[1], sys.sel.randomscl[0],
@@ -697,6 +724,8 @@ func systemScriptInit(l *lua.LState) {
697724 return 0
698725 })
699726 luaRegister(l, "game", func(l *lua.LState) int {
727+ tbl := l.NewTable()
728+ tbl_chars := l.NewTable()
700729 load := func() error {
701730 sys.loader.runTread()
702731 for sys.loader.state != LS_Complete {
@@ -712,7 +741,10 @@ func systemScriptInit(l *lua.LState) {
712741 fa := sys.lifebar.fa[sys.tmode[i&1]][i]
713742 fa.face = sys.cgi[i].sff.getOwnPalSprite(
714743 int16(fa.face_spr[0]), int16(fa.face_spr[1]))
744+
745+ fa.scale = sys.cgi[i].portraitscale
715746 }
747+
716748 }
717749 runtime.GC()
718750 return nil
@@ -791,6 +823,29 @@ func systemScriptInit(l *lua.LState) {
791823 if w1 != w2 {
792824 winp = Btoi(w1) + Btoi(w2)*2
793825 }
826+ tbl_roundNo := l.NewTable()
827+ for _, p := range sys.chars {
828+ if len(p) > 0 {
829+ tmp := l.NewTable()
830+ tmp.RawSetString("name", lua.LString(p[0].name))
831+ tmp.RawSetString("memberNo", lua.LNumber(p[0].memberNo))
832+ tmp.RawSetString("selectNo", lua.LNumber(p[0].selectNo))
833+ tmp.RawSetString("life", lua.LNumber(p[0].life))
834+ tmp.RawSetString("lifeMax", lua.LNumber(p[0].lifeMax))
835+ tmp.RawSetString("winquote", lua.LNumber(p[0].winquote))
836+ tmp.RawSetString("aiLevel", lua.LNumber(p[0].aiLevel()))
837+ tmp.RawSetString("palno", lua.LNumber(p[0].palno()))
838+ tmp.RawSetString("win", lua.LBool(p[0].win()))
839+ tmp.RawSetString("winKO", lua.LBool(p[0].winKO()))
840+ tmp.RawSetString("winTime", lua.LBool(p[0].winTime()))
841+ tmp.RawSetString("winPerfect", lua.LBool(p[0].winPerfect()))
842+ tmp.RawSetString("drawgame", lua.LBool(p[0].drawgame()))
843+ tmp.RawSetString("ko", lua.LBool(p[0].scf(SCF_ko)))
844+ tmp.RawSetString("ko_round_middle", lua.LBool(p[0].scf(SCF_ko_round_middle)))
845+ tbl_roundNo.RawSetInt(p[0].playerNo+1, tmp)
846+ }
847+ }
848+ tbl_chars.RawSetInt(int(sys.round-1), tbl_roundNo)
794849 }
795850 return winp, nil
796851 }
@@ -817,10 +872,259 @@ func systemScriptInit(l *lua.LState) {
817872 sys.loader.reset()
818873 }
819874 if winp != -2 {
875+ time := int32(0)
876+ tbl_time := l.NewTable()
877+ for k, v := range sys.timerCount {
878+ tbl_time.RawSetInt(k+1, lua.LNumber(v))
879+ time = time + v
880+ }
881+ tbl.RawSetString("chars", tbl_chars)
882+ tbl.RawSetString("time_rounds", tbl_time)
883+ tbl.RawSetString("time", lua.LNumber(time))
884+ tbl.RawSetString("roundTime", lua.LNumber(sys.roundTime))
885+ tbl.RawSetString("winTeam", lua.LNumber(sys.winTeam))
886+ tbl.RawSetString("lastRound", lua.LNumber(sys.round-1))
887+ tbl.RawSetString("draws", lua.LNumber(sys.draws))
888+ tbl.RawSetString("P1wins", lua.LNumber(sys.wins[0]))
889+ tbl.RawSetString("P2wins", lua.LNumber(sys.wins[1]))
890+ tbl.RawSetString("P1tmode", lua.LNumber(sys.tmode[0]))
891+ tbl.RawSetString("P2tmode", lua.LNumber(sys.tmode[1]))
892+ sys.timerCount = []int32{}
820893 l.Push(lua.LNumber(winp))
821- return 1
894+ l.Push(tbl)
895+ return 2
896+ }
897+ }
898+ })
899+ luaRegister(l, "getCharVar", func(*lua.LState) int {
900+ for _, p := range sys.chars {
901+ if len(p) > 0 && p[0].playerNo+1 == int(numArg(l, 1)) {
902+ if strArg(l, 2) == "varGet" {
903+ l.Push(lua.LNumber(p[0].varGet(int32(numArg(l, 3))).ToI()))
904+ } else if strArg(l, 2) == "fvarGet" {
905+ l.Push(lua.LNumber(p[0].fvarGet(int32(numArg(l, 3))).ToI()))
906+ } else if strArg(l, 2) == "sysVarGet" {
907+ l.Push(lua.LNumber(p[0].sysVarGet(int32(numArg(l, 3))).ToI()))
908+ } else if strArg(l, 2) == "sysFvarGet" {
909+ l.Push(lua.LNumber(p[0].sysFvarGet(int32(numArg(l, 3))).ToI()))
910+ }
911+ break
912+ }
913+ }
914+ return 1
915+ })
916+ luaRegister(l, "getCharVictoryQuote", func(*lua.LState) int {
917+ v := int(-1)
918+ for _, p := range sys.chars {
919+ if len(p) > 0 && p[0].playerNo+1 == int(numArg(l, 1)) {
920+ if l.GetTop() >= 2 {
921+ v = int(numArg(l, 2))
922+ } else {
923+ v = int(p[0].winquote)
924+ }
925+ if v < 0 || v >= MaxQuotes {
926+ t := []string{}
927+ for i, q := range sys.cgi[p[0].playerNo].quotes {
928+ if sys.cgi[p[0].playerNo].quotes[i] != "" {
929+ t = append(t, q)
930+ }
931+ }
932+ if len(t) > 0 {
933+ v = rand.Int() % len(t)
934+ } else {
935+ v = -1
936+ }
937+ }
938+ if len(sys.cgi[p[0].playerNo].quotes) == MaxQuotes && v != -1 {
939+ l.Push(lua.LString(sys.cgi[p[0].playerNo].quotes[v]))
940+ } else {
941+ l.Push(lua.LString(""))
942+ }
943+ break
944+ }
945+ }
946+ return 1
947+ })
948+ luaRegister(l, "getCommandLineFlags", func(*lua.LState) int {
949+ tbl := l.NewTable()
950+ for k, v := range sys.cmdFlags {
951+ tbl.RawSetString(k, lua.LString(v))
952+ }
953+ l.Push(tbl)
954+ return 1
955+ })
956+ luaRegister(l, "getCommandLineValue", func(*lua.LState) int {
957+ l.Push(lua.LString(sys.cmdFlags[strArg(l, 1)]))
958+ return 1
959+ })
960+ luaRegister(l, "setPortrait", func(*lua.LState) int {
961+ p := int(numArg(l, 3))
962+ if p == 1 {
963+ sys.sel.lportrait = [...]int16{int16(numArg(l, 1)), int16(numArg(l, 2))}
964+ } else if p == 2 {
965+ sys.sel.sportrait = [...]int16{int16(numArg(l, 1)), int16(numArg(l, 2))}
966+ } else if p == 3 {
967+ sys.sel.vsportrait = [...]int16{int16(numArg(l, 1)), int16(numArg(l, 2))}
968+ } else if p == 4 {
969+ sys.sel.vportrait = [...]int16{int16(numArg(l, 1)), int16(numArg(l, 2))}
970+ }
971+ return 0
972+ })
973+ luaRegister(l, "drawSmallPortrait", func(l *lua.LState) int {
974+ n, x, y := int(numArg(l, 1)), float32(numArg(l, 2)), float32(numArg(l, 3))
975+ var xscl, yscl float32 = 1, 1
976+ if l.GetTop() >= 4 {
977+ xscl = float32(numArg(l, 4))
978+ if l.GetTop() >= 5 {
979+ yscl = float32(numArg(l, 5))
980+ }
981+ }
982+ if !sys.frameSkip {
983+ c := sys.sel.GetChar(n)
984+ if c != nil && c.sportrait != nil {
985+ if c.portrait_scale != 1 {
986+ xscl *= c.portrait_scale
987+ yscl *= c.portrait_scale
988+ }
989+ c.sportrait.Draw(x, y, xscl, yscl, c.sportrait.Pal)
990+ }
991+ }
992+ return 0
993+ })
994+ luaRegister(l, "drawVersusPortrait", func(l *lua.LState) int {
995+ n, x, y := int(numArg(l, 1)), float32(numArg(l, 2)), float32(numArg(l, 3))
996+ var xscl, yscl float32 = 1, 1
997+ if l.GetTop() >= 4 {
998+ xscl = float32(numArg(l, 4))
999+ if l.GetTop() >= 5 {
1000+ yscl = float32(numArg(l, 5))
1001+ }
1002+ }
1003+ if !sys.frameSkip {
1004+ c := sys.sel.GetChar(n)
1005+ if c != nil && c.vsportrait != nil {
1006+ if c.portrait_scale != 1 {
1007+ xscl *= c.portrait_scale
1008+ yscl *= c.portrait_scale
1009+ }
1010+ c.vsportrait.Draw(x, y, xscl, yscl, c.vsportrait.Pal)
1011+ }
1012+ }
1013+ return 0
1014+ })
1015+ luaRegister(l, "drawVictoryPortrait", func(l *lua.LState) int {
1016+ n, x, y := int(numArg(l, 1)), float32(numArg(l, 2)), float32(numArg(l, 3))
1017+ var xscl, yscl float32 = 1, 1
1018+ if l.GetTop() >= 4 {
1019+ xscl = float32(numArg(l, 4))
1020+ if l.GetTop() >= 5 {
1021+ yscl = float32(numArg(l, 5))
1022+ }
1023+ }
1024+ if !sys.frameSkip {
1025+ c := sys.sel.GetChar(n)
1026+ if c != nil && c.vportrait != nil {
1027+ if c.portrait_scale != 1 {
1028+ xscl *= c.portrait_scale
1029+ yscl *= c.portrait_scale
1030+ }
1031+ c.vportrait.Draw(x, y, xscl, yscl, c.vportrait.Pal)
8221032 }
8231033 }
1034+ return 0
1035+ })
1036+ luaRegister(l, "getCharIntro", func(*lua.LState) int {
1037+ c := sys.sel.GetChar(int(numArg(l, 1)))
1038+ l.Push(lua.LString(c.intro_storyboard))
1039+ return 1
1040+ })
1041+ luaRegister(l, "getCharEnding", func(*lua.LState) int {
1042+ c := sys.sel.GetChar(int(numArg(l, 1)))
1043+ l.Push(lua.LString(c.ending_storyboard))
1044+ return 1
1045+ })
1046+ luaRegister(l, "getCharPalettes", func(*lua.LState) int {
1047+ c := sys.sel.GetChar(int(numArg(l, 1)))
1048+ tbl := l.NewTable()
1049+ var pal []int32
1050+ if sys.aiRandomColor {
1051+ pal = c.pal
1052+ } else {
1053+ pal = c.pal_defaults
1054+ }
1055+ if len(pal) > 0 {
1056+ for k, v := range pal {
1057+ tbl.RawSetInt(k+1, lua.LNumber(v))
1058+ }
1059+ } else {
1060+ tbl.RawSetInt(1, lua.LNumber(1))
1061+ }
1062+ l.Push(tbl)
1063+ return 1
1064+ })
1065+ luaRegister(l, "getCharRandomPalette", func(*lua.LState) int {
1066+ c := sys.sel.GetChar(int(numArg(l, 1)))
1067+ if len(c.pal) > 0 {
1068+ n := rand.Int() % len(c.pal)
1069+ l.Push(lua.LNumber(c.pal[n]))
1070+ } else {
1071+ l.Push(lua.LNumber(1))
1072+ }
1073+ return 1
1074+ })
1075+ luaRegister(l, "getStageInfo", func(*lua.LState) int {
1076+ a, b, c, d := sys.sel.GetStageInfo(int(numArg(l, 1)))
1077+ l.Push(lua.LString(a))
1078+ l.Push(lua.LString(b))
1079+ l.Push(lua.LString(c))
1080+ l.Push(lua.LString(d))
1081+ return 4
1082+ })
1083+ luaRegister(l, "getKey", func(*lua.LState) int {
1084+ s := ""
1085+ if sys.keyInput != glfw.KeyUnknown {
1086+ s = KeyToString(sys.keyInput)
1087+ }
1088+ l.Push(lua.LString(s))
1089+ return 1
1090+ })
1091+ luaRegister(l, "getKeyText", func(*lua.LState) int {
1092+ s := ""
1093+ if sys.keyInput != glfw.KeyUnknown {
1094+ if sys.keyInput == glfw.KeyInsert {
1095+ s, _ = sys.window.GetClipboardString()
1096+ } else {
1097+ s = sys.keyString
1098+ }
1099+ }
1100+ l.Push(lua.LString(s))
1101+ return 1
1102+ })
1103+ luaRegister(l, "resetKey", func(*lua.LState) int {
1104+ sys.keyInput = glfw.KeyUnknown
1105+ sys.keyString = ""
1106+ return 0
1107+ })
1108+ luaRegister(l, "getSpriteInfo", func(*lua.LState) int {
1109+ var s *Sprite
1110+ var err error
1111+ def := strArg(l, 1)
1112+ err = LoadFile(&def, "", func(file string) error {
1113+ s, err = loadFromSff(file, int16(numArg(l, 2)), int16(numArg(l, 3)))
1114+ return err
1115+ })
1116+ if err != nil {
1117+ l.Push(lua.LNumber(0))
1118+ l.Push(lua.LNumber(0))
1119+ l.Push(lua.LNumber(0))
1120+ l.Push(lua.LNumber(0))
1121+ return 4
1122+ }
1123+ l.Push(lua.LNumber(s.Size[0]))
1124+ l.Push(lua.LNumber(s.Size[1]))
1125+ l.Push(lua.LNumber(s.Offset[0]))
1126+ l.Push(lua.LNumber(s.Offset[1]))
1127+ return 4
8241128 })
8251129 }
8261130
@@ -1806,5 +2110,9 @@ func debugScriptInit(l *lua.LState, file string) error {
18062110 }
18072111 return 0
18082112 })
2113+ luaRegister(l, "getAllowDebugKeys", func(*lua.LState) int {
2114+ l.Push(lua.LBool(sys.allowDebugKeys))
2115+ return 1
2116+ })
18092117 return l.DoFile(file)
18102118 }
--- a/src/system.go
+++ b/src/system.go
@@ -1668,6 +1668,7 @@ type SelectChar struct {
16681668 def, name, sprite, intro_storyboard, ending_storyboard string
16691669 pal_defaults []int32
16701670 pal []int32
1671+ portrait_scale float32
16711672 sportrait, lportrait, vsportrait, vportrait *Sprite
16721673 }
16731674 type SelectStage struct {
@@ -1781,6 +1782,13 @@ func (s *Select) addCahr(def string) {
17811782 sc.name, _, _ = is.getText("name")
17821783 }
17831784 sc.pal_defaults = is.readI32CsvForStage("pal.defaults")
1785+ ok = is.ReadF32("localcoord", &sc.portrait_scale)
1786+ if !ok {
1787+ sc.portrait_scale = 1
1788+ } else {
1789+ sc.portrait_scale = (320 / sc.portrait_scale)
1790+ }
1791+ is.ReadF32("portraitscale", &sc.portrait_scale)
17841792 }
17851793 case "files":
17861794 if files {
@@ -1989,13 +1997,14 @@ func (l *Loader) loadChar(pn int) int {
19891997 if pn < len(sys.lifebar.fa[sys.tmode[pn&1]]) &&
19901998 sys.tmode[pn&1] == TM_Turns && sys.round == 1 {
19911999 fa := sys.lifebar.fa[sys.tmode[pn&1]][pn]
1992- fa.numko, fa.teammate_face = 0, make([]*Sprite, nsel)
2000+ fa.numko, fa.teammate_face, fa.teammate_scale = 0, make([]*Sprite, nsel), make([]float32, nsel)
19932001 for i, ci := range idx {
19942002 sprite := sys.sel.charlist[ci].sprite
19952003 LoadFile(&sprite, sys.sel.charlist[ci].def, func(file string) error {
19962004 var err error
19972005 fa.teammate_face[i], err = loadFromSff(file,
19982006 int16(fa.teammate_face_spr[0]), int16(fa.teammate_face_spr[1]))
2007+ fa.teammate_scale[i] = sys.sel.charlist[ci].portrait_scale
19992008 return err
20002009 })
20012010 }