@@ -2949,6 +2949,61 @@ type PalInfo struct {
29492949 selectable bool
29502950}
29512951
2952+ func readMovelistFiles (is IniSection ) map [int ]string {
2953+ ret := make (map [int ]string )
2954+ if v := decodeShiftJIS (is ["movelist" ]); v != "" {
2955+ ret [0 ] = v
2956+ }
2957+ if v := decodeShiftJIS (is ["movelist0" ]); v != "" {
2958+ if _ , ok := ret [0 ]; ! ok {
2959+ ret [0 ] = v
2960+ }
2961+ }
2962+ for k , v := range is {
2963+ kl := strings .ToLower (k )
2964+ if kl == "movelist" || kl == "movelist0" || ! strings .HasPrefix (kl , "movelist" ) {
2965+ continue
2966+ }
2967+ idx := kl [len ("movelist" ):]
2968+ if idx == "" || ! IsInt (idx ) {
2969+ continue
2970+ }
2971+ n := int (Atoi (idx ))
2972+ if n < 0 {
2973+ continue
2974+ }
2975+ if ml := decodeShiftJIS (v ); ml != "" {
2976+ ret [n ] = ml
2977+ }
2978+ }
2979+ if len (ret ) == 0 {
2980+ return nil
2981+ }
2982+ return ret
2983+ }
2984+
2985+ func loadMovelistFiles (def string , files map [int ]string ) map [int ]string {
2986+ if len (files ) == 0 {
2987+ return nil
2988+ }
2989+ ret := make (map [int ]string , len (files ))
2990+ for idx , file := range files {
2991+ idx , file := idx , file
2992+ LoadFile (& file , []string {def , "" , "data/" }, "" , func (filename string ) error {
2993+ txt , err := LoadText (filename )
2994+ if err != nil {
2995+ return err
2996+ }
2997+ ret [idx ] = txt
2998+ return nil
2999+ })
3000+ }
3001+ if len (ret ) == 0 {
3002+ return nil
3003+ }
3004+ return ret
3005+ }
3006+
29523007type CharGlobalInfo struct {
29533008 def string
29543009 name string
@@ -2977,6 +3032,7 @@ type CharGlobalInfo struct {
29773032 callFuncs map [string ]BytecodeFunction
29783033 hitPauseToggleFlagCount int32
29793034 quotes [MaxQuotes ]string
3035+ movelists map [int ]string
29803036 portraitscale float32
29813037 constants map [string ]float32
29823038 remapPreset map [string ]RemapPreset
@@ -3002,6 +3058,7 @@ func newCharGlobalInfo() CharGlobalInfo {
30023058 palInfo : make (map [int ]PalInfo , sys .cfg .Config .PaletteMax ),
30033059 fnt : make (map [int ]* Fnt ),
30043060 quotes : [MaxQuotes ]string {},
3061+ movelists : make (map [int ]string ),
30053062 remapPreset : make (map [string ]RemapPreset ),
30063063 portraitscale : 1 ,
30073064 }
@@ -3232,6 +3289,7 @@ type Char struct {
32323289 ownpal bool
32333290 ownProjectile bool
32343291 winquote int32
3292+ movelist int32
32353293 memberNo int
32363294 selectNo int
32373295 inheritJuggle int32
@@ -3329,6 +3387,7 @@ func (c *Char) init(n int, idx int) {
33293387 facing : 1 ,
33303388 minus : 3 ,
33313389 winquote : - 1 ,
3390+ movelist : 0 ,
33323391 clsnBaseScale : [2 ]float32 {1 , 1 },
33333392 clsnScaleMul : [2 ]float32 {1 , 1 },
33343393 clsnScale : [2 ]float32 {1 , 1 },
@@ -3454,6 +3513,7 @@ func (c *Char) prepareNextRound() {
34543513 //c.updateSizeBox()
34553514 c .oldPos , c .interPos = c .pos , c .pos
34563515 if c .helperIndex == 0 {
3516+ c .movelist = 0
34573517 if sys .roundsExisted [c .playerNo & 1 ] > 0 { // TODO: Why do we need this branch?
34583518 c .palfx .clear ()
34593519 } else {
@@ -3546,6 +3606,7 @@ func (c *Char) resetModifyPlayer() {
35463606 c .powerMax = gi .data .power
35473607 c .dizzyPointsMax = gi .data .dizzypoints
35483608 c .guardPointsMax = gi .data .guardpoints
3609+ c .movelist = 0
35493610 // c.teamside already assigned by loadCharacter()
35503611}
35513612
@@ -3578,6 +3639,7 @@ func (c *Char) load(def string) error {
35783639
35793640 lines , lnidx := SplitAndTrim (str , "\n " ), 0
35803641 cns , sprite , anim , sound := "" , "" , "" , ""
3642+ var movelistFiles map [int ]string
35813643 info , files , keymap , mapArray := true , true , true , true
35823644 lanInfo , lanFiles , lanKeymap , lanMapArray := true , true , true , true
35833645 shaders := true
@@ -3676,6 +3738,7 @@ func (c *Char) load(def string) error {
36763738 sprite = decodeShiftJIS (is ["sprite" ])
36773739 anim = decodeShiftJIS (is ["anim" ])
36783740 sound = decodeShiftJIS (is ["sound" ])
3741+ movelistFiles = readMovelistFiles (is )
36793742 for i := 0 ; i < sys .cfg .Config .PaletteMax ; i ++ {
36803743 pal := gi .palInfo [i ]
36813744 pal .filename = decodeShiftJIS (is [fmt .Sprintf ("pal%v" , i + 1 )])
@@ -3764,6 +3827,9 @@ func (c *Char) load(def string) error {
37643827 // Reset maps in order to upload the freshly loaded defaults
37653828 c .mapReset (nil )
37663829
3830+ // Load movelists from the loaded character DEF
3831+ gi .movelists = loadMovelistFiles (def , movelistFiles )
3832+
37673833 // Set constants to defaults
37683834 c .initConstants ()
37693835
0 commit comments