Go で書き直した Ikemen
Revisão | 72a56b9d103b64c74e5232544867925793d88a1b (tree) |
---|---|
Hora | 2019-02-25 20:13:41 |
Autor | neatunsou <sisiy4excite@gmai...> |
Commiter | neatunsou |
ProjectileがPauseで止まらないのを修正
Explod、Projectile、Helperのremappalが機能するようにした
localcoordが違うキャラにKOされた時吹っ飛び量がおかしいのを修正
Superpauseのデフォルトanim番号が実際は100だったので修正
スクリーンパックが描画されない不具合を修正
@@ -2220,6 +2220,7 @@ const ( | ||
2220 | 2220 | helper_pausemovetime |
2221 | 2221 | helper_supermovetime |
2222 | 2222 | helper_redirectid |
2223 | + helper_remappal | |
2223 | 2224 | ) |
2224 | 2225 | |
2225 | 2226 | func (sc helper) Run(c *Char, _ []int32) bool { |
@@ -2230,6 +2231,7 @@ func (sc helper) Run(c *Char, _ []int32) bool { | ||
2230 | 2231 | var f, st int32 = 1, 0 |
2231 | 2232 | op := false |
2232 | 2233 | var x, y float32 = 0, 0 |
2234 | + rp := [...]int32{-1, 0} | |
2233 | 2235 | StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool { |
2234 | 2236 | if h == nil { |
2235 | 2237 | if id == helper_redirectid { |
@@ -2301,6 +2303,11 @@ func (sc helper) Run(c *Char, _ []int32) bool { | ||
2301 | 2303 | h.pauseMovetime = exp[0].evalI(c) |
2302 | 2304 | case helper_supermovetime: |
2303 | 2305 | h.superMovetime = exp[0].evalI(c) |
2306 | + case helper_remappal: | |
2307 | + rp[0] = exp[0].evalI(c) | |
2308 | + if len(exp) > 1 { | |
2309 | + rp[1] = exp[1].evalI(c) | |
2310 | + } | |
2304 | 2311 | } |
2305 | 2312 | return true |
2306 | 2313 | }) |
@@ -2314,7 +2321,7 @@ func (sc helper) Run(c *Char, _ []int32) bool { | ||
2314 | 2321 | h.localscl = crun.localscl |
2315 | 2322 | h.localcoord = crun.localcoord |
2316 | 2323 | } |
2317 | - crun.helperInit(h, st, pt, x, y, f, op) | |
2324 | + crun.helperInit(h, st, pt, x, y, f, op, rp) | |
2318 | 2325 | return false |
2319 | 2326 | } |
2320 | 2327 |
@@ -4591,7 +4598,7 @@ func (sc superPause) Run(c *Char, _ []int32) bool { | ||
4591 | 4598 | crun := c |
4592 | 4599 | var t, mt int32 = 30, 0 |
4593 | 4600 | uh := true |
4594 | - sys.superanim, sys.superpmap.remap = crun.getAnim(30, true), nil | |
4601 | + sys.superanim, sys.superpmap.remap = crun.getAnim(100, true), nil | |
4595 | 4602 | sys.superpos, sys.superfacing = [...]float32{crun.pos[0] * crun.localscl, crun.pos[1] * crun.localscl}, crun.facing |
4596 | 4603 | sys.superpausebg, sys.superendcmdbuftime, sys.superdarken = true, 0, true |
4597 | 4604 | sys.superp2defmul = sys.super_TargetDefenceMul |
@@ -1124,17 +1124,17 @@ func (p *Projectile) setPos(pos [2]float32) { | ||
1124 | 1124 | p.pos, p.oldPos, p.newPos = pos, pos, pos |
1125 | 1125 | } |
1126 | 1126 | func (p *Projectile) paused(playerNo int) bool { |
1127 | - if !sys.chars[playerNo][0].pause() { | |
1128 | - if sys.super > 0 { | |
1129 | - if p.supermovetime == 0 { | |
1130 | - return true | |
1131 | - } | |
1132 | - } else if sys.pause > 0 { | |
1133 | - if p.pausemovetime == 0 { | |
1134 | - return true | |
1135 | - } | |
1127 | + //if !sys.chars[playerNo][0].pause() { | |
1128 | + if sys.super > 0 { | |
1129 | + if p.supermovetime == 0 { | |
1130 | + return true | |
1131 | + } | |
1132 | + } else if sys.pause > 0 { | |
1133 | + if p.pausemovetime == 0 { | |
1134 | + return true | |
1136 | 1135 | } |
1137 | 1136 | } |
1137 | + //} | |
1138 | 1138 | return false |
1139 | 1139 | } |
1140 | 1140 | func (p *Projectile) update(playerNo int) { |
@@ -2854,7 +2854,7 @@ func (c *Char) helperPos(pt PosType, pos [2]float32, facing int32, | ||
2854 | 2854 | return |
2855 | 2855 | } |
2856 | 2856 | func (c *Char) helperInit(h *Char, st int32, pt PosType, x, y float32, |
2857 | - facing int32, ownpal bool) { | |
2857 | + facing int32, ownpal bool, rp [2]int32) { | |
2858 | 2858 | p := c.helperPos(pt, [...]float32{x, y}, facing, &h.facing, h.localscl, false) |
2859 | 2859 | h.setX(p[0]) |
2860 | 2860 | h.setY(p[1]) |
@@ -2864,6 +2864,7 @@ func (c *Char) helperInit(h *Char, st int32, pt PosType, x, y float32, | ||
2864 | 2864 | tmp := c.getPalfx().remap |
2865 | 2865 | h.palfx.remap = make([]int, len(tmp)) |
2866 | 2866 | copy(h.palfx.remap, tmp) |
2867 | + c.forceRemapPal(h.palfx, rp) | |
2867 | 2868 | } |
2868 | 2869 | h.changeStateEx(st, c.playerNo, 0, 1) |
2869 | 2870 | } |
@@ -2905,7 +2906,7 @@ func (c *Char) insertExplodEx(i int, rp [2]int32) { | ||
2905 | 2906 | copy(remap, e.palfx.remap) |
2906 | 2907 | e.palfx = newPalFX() |
2907 | 2908 | e.palfx.remap = remap |
2908 | - c.remapPal(e.palfx, [...]int32{1, 1}, rp) | |
2909 | + c.forceRemapPal(e.palfx, rp) | |
2909 | 2910 | } |
2910 | 2911 | if e.ontop { |
2911 | 2912 | td := &sys.topexplDrawlist[c.playerNo] |
@@ -3115,7 +3116,7 @@ func (c *Char) projInit(p *Projectile, pt PosType, x, y float32, | ||
3115 | 3116 | copy(remap, p.palfx.remap) |
3116 | 3117 | p.palfx = newPalFX() |
3117 | 3118 | p.palfx.remap = remap |
3118 | - c.remapPal(p.palfx, [...]int32{1, 1}, [...]int32{rpg, rpn}) | |
3119 | + c.forceRemapPal(p.palfx, [...]int32{rpg, rpn}) | |
3119 | 3120 | } |
3120 | 3121 | } |
3121 | 3122 | func (c *Char) setHitdefDefault(hd *HitDef, proj bool) { |
@@ -3794,6 +3795,22 @@ func (c *Char) remapPal(pfx *PalFX, src [2]int32, dst [2]int32) { | ||
3794 | 3795 | c.gi().sff.palList.SwapPalMap(&pfx.remap) |
3795 | 3796 | } |
3796 | 3797 | } |
3798 | +func (c *Char) forceRemapPal(pfx *PalFX, dst [2]int32) { | |
3799 | + if dst[0] < 0 || dst[1] < 0 { | |
3800 | + return | |
3801 | + } | |
3802 | + di, ok := c.gi().sff.palList.PalTable[[...]int16{int16(dst[0]), | |
3803 | + int16(dst[1])}] | |
3804 | + if !ok { | |
3805 | + return | |
3806 | + } | |
3807 | + if pfx.remap == nil { | |
3808 | + pfx.remap = c.gi().sff.palList.GetPalMap() | |
3809 | + } | |
3810 | + for i := range pfx.remap { | |
3811 | + pfx.remap[i] = di | |
3812 | + } | |
3813 | +} | |
3797 | 3814 | func (c *Char) inGuardState() bool { |
3798 | 3815 | return c.ss.no == 120 || (c.ss.no >= 130 && c.ss.no <= 132) || |
3799 | 3816 | c.ss.no == 140 || (c.ss.no >= 150 && c.ss.no <= 155) |
@@ -5039,12 +5056,12 @@ func (cl *CharList) clsn(getter *Char, proj bool) { | ||
5039 | 5056 | } |
5040 | 5057 | if getter.ss.stateType == ST_A { |
5041 | 5058 | if getter.ghv.xvel < 0 { |
5042 | - getter.ghv.xvel -= 2 / c.localscl * getter.localscl | |
5059 | + getter.ghv.xvel -= 2 * getter.localscl | |
5043 | 5060 | } |
5044 | 5061 | if getter.ghv.yvel <= 0 { |
5045 | - getter.ghv.yvel -= 2 / c.localscl * getter.localscl | |
5046 | - if getter.ghv.yvel > -3 { | |
5047 | - getter.ghv.yvel = -3 / c.localscl * getter.localscl | |
5062 | + getter.ghv.yvel -= 2 * getter.localscl | |
5063 | + if getter.ghv.yvel > -3*getter.localscl { | |
5064 | + getter.ghv.yvel = -3 * getter.localscl | |
5048 | 5065 | } |
5049 | 5066 | } |
5050 | 5067 | } else { |
@@ -5052,12 +5069,12 @@ func (cl *CharList) clsn(getter *Char, proj bool) { | ||
5052 | 5069 | getter.ghv.xvel *= 0.66 |
5053 | 5070 | } |
5054 | 5071 | if getter.ghv.xvel < 0 { |
5055 | - getter.ghv.xvel -= 2.5 / c.localscl * getter.localscl | |
5072 | + getter.ghv.xvel -= 2.5 * getter.localscl | |
5056 | 5073 | } |
5057 | 5074 | if getter.ghv.yvel <= 0 { |
5058 | - getter.ghv.yvel -= 2 / c.localscl * getter.localscl | |
5059 | - if getter.ghv.yvel > -6 { | |
5060 | - getter.ghv.yvel = -6 / c.localscl * getter.localscl | |
5075 | + getter.ghv.yvel -= 2 * getter.localscl | |
5076 | + if getter.ghv.yvel > -6*getter.localscl { | |
5077 | + getter.ghv.yvel = -6 * getter.localscl | |
5061 | 5078 | } |
5062 | 5079 | } |
5063 | 5080 | } |
@@ -3471,6 +3471,10 @@ func (c *Compiler) helper(is IniSection, sc *StateControllerBase, | ||
3471 | 3471 | helper_supermovetime, VT_Int, 1, false); err != nil { |
3472 | 3472 | return err |
3473 | 3473 | } |
3474 | + if err := c.paramValue(is, sc, "remappal", | |
3475 | + helper_remappal, VT_Int, 2, false); err != nil { | |
3476 | + return err | |
3477 | + } | |
3474 | 3478 | return nil |
3475 | 3479 | }) |
3476 | 3480 | return *ret, err |
@@ -132,8 +132,6 @@ func RenderInit() { | ||
132 | 132 | mugenShader = link(vertObj, fragObj) |
133 | 133 | posattLocation = gl.GetAttribLocationARB(mugenShader, gl.Str("position\x00")) |
134 | 134 | uvattLocation = gl.GetAttribLocationARB(mugenShader, gl.Str("uv\x00")) |
135 | - gl.EnableVertexAttribArrayARB(uint32(posattLocation)) | |
136 | - gl.EnableVertexAttribArrayARB(uint32(uvattLocation)) | |
137 | 135 | uniformA = gl.GetUniformLocationARB(mugenShader, gl.Str("a\x00")) |
138 | 136 | uniformPal = gl.GetUniformLocationARB(mugenShader, gl.Str("pal\x00")) |
139 | 137 | uniformMsk = gl.GetUniformLocationARB(mugenShader, gl.Str("msk\x00")) |
@@ -169,6 +167,8 @@ func drawQuads(x1, y1, x2, y2, x3, y3, x4, y4 float32, renderMode int32) { | ||
169 | 167 | case 2: |
170 | 168 | gl.Uniform4fARB(uniformX1x2x4x3, x1, x2, x4, x3) |
171 | 169 | } |
170 | + gl.EnableVertexAttribArrayARB(uint32(posattLocation)) | |
171 | + gl.EnableVertexAttribArrayARB(uint32(uvattLocation)) | |
172 | 172 | gl.VertexAttribPointerARB(uint32(posattLocation), 2, gl.FLOAT, false, 0, unsafe.Pointer(&vertexPosition[0])) |
173 | 173 | gl.VertexAttribPointerARB(uint32(uvattLocation), 2, gl.FLOAT, false, 0, unsafe.Pointer(&vertexUv[0])) |
174 | 174 |