• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

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

Commit MetaInfo

Revision611d1fedf1bc004f2ca8d1868820cec0074fce9d (tree)
Time2013-12-31 06:27:25
AuthorSUEHIRO <supersuehiro@user...>
CommiterSUEHIRO

Log Message

ステートコントローラーのzoomに対応

Change Summary

Incremental Difference

--- a/ssz/char.ssz
+++ b/ssz/char.ssz
@@ -65,10 +65,9 @@ void drawClsn()
6565 {
6666 public ^&.act.Action anim;
6767 public int priority = 0;
68- public float x = 0.0, y = 0.0, cscl = 1.0;
68+ public float x = 0.0, y = 0.0;
6969 public float xscl = 1.0, yscl = 1.0, angle = 0.0, axscl = 1.0, ayscl = 1.0;
70- public bool aset = false, oVer = false;
71- public short bright = 256;
70+ public bool aset = false, oVer = false, screen = false, bright = false;
7271 public int salpha = -1, dalpha = 0;
7372 public ^&.com.PalFX fx;
7473 }
@@ -86,9 +85,9 @@ void drawClsn()
8685
8786 public void addAnimList(
8887 %^&.AnimSprite al=, ^&.act.Action a, int p,
89- float x, float y, float cs, float xs, float ys,
88+ float x, float y, bool scr, float xs, float ys,
9089 float an, bool as, bool oVer, float ax, float ay,
91- int sa, int da, int b, ^&.com.PalFX fx, int sc, int salp, float so)
90+ int sa, int da, bool b, ^&.com.PalFX fx, int sc, int salp, float so)
9291 {
9392 ^&.AnimSprite newSprite()
9493 {
@@ -98,7 +97,7 @@ public void addAnimList(
9897 as~priority = `p;
9998 as~x = `x;
10099 as~y = `y;
101- as~cscl = `cs;
100+ as~screen = `scr;
102101 as~xscl = `xs;
103102 as~yscl = `ys;
104103 as~angle = `an;
@@ -137,7 +136,7 @@ public void addAnimList(
137136 }
138137 }
139138
140-public void drawAnimList(%^&.AnimSprite al=, float x, float y)
139+public void drawAnimList(%^&.AnimSprite al=, float x, float y, float scl)
141140 {
142141 loop{index i = 0; while; do:
143142 if(#al[i]~anim > 0) al[i]~[void(as=){
@@ -145,19 +144,34 @@ public void drawAnimList(%^&.AnimSprite al=, float x, float y)
145144 as.anim~ani.dalpha = as.dalpha;
146145 branch{
147146 int ob = .com.brightness;
148- .com.brightness = as.bright;
149- float cs = as.cscl;
147+ if(as.bright) .com.brightness = 256;
148+ float cs = as.screen ? 1.0 : scl, px, py;
150149 cond as.angle != 0.0:
150+ branch{
151+ cond as.screen:
152+ px = as.x;
153+ py = as.y;
154+ else:
155+ px = .com.xoffset-(x-as.x)*cs;
156+ py =
157+ .com.zoffset+.com.yoffset-.stage.envShake.getOffset()-(y-as.y)*cs;
158+ }
151159 as.anim~ani.angleDraw(
152- .com.xoffset-(x-as.x)*cs,
153- .com.zoffset+.com.yoffset-.stage.envShake.getOffset()-(y-as.y)*cs,
154- cs*as.xscl, cs*as.yscl, as.angle*(.m.PI/180.0),
160+ px, py, cs*as.xscl, cs*as.yscl, as.angle*(.m.PI/180.0),
155161 as.aset, as.axscl, as.ayscl, as.fx, as.oVer);
156162 else:
163+ branch{
164+ cond as.screen:
165+ px = as.x;
166+ py = as.y;
167+ else:
168+ px = .com.xoffset/cs - (x-as.x);
169+ py =
170+ (.com.zoffset+.com.yoffset-.stage.envShake.getOffset())/cs
171+ - (y-as.y);
172+ }
157173 as.anim~ani.draw(
158- .com.scrrect=, .com.xoffset/cs - (x-as.x),
159- (.com.zoffset+.com.yoffset-.stage.envShake.getOffset())/cs
160- - (y-as.y), cs, cs, as.xscl, as.xscl,
174+ .com.scrrect=, px, py, cs, cs, as.xscl, as.xscl,
161175 as.yscl, 0.0, (float).com.GameWidth/2.0, as.fx, as.oVer);
162176 break:
163177 .com.brightness = ob;
@@ -203,7 +217,7 @@ public void addShadowList(^&.AnimSprite as, int sc, float so, int alpha)
203217 }
204218 }
205219
206-public void drawShadowList(float x, float y)
220+public void drawShadowList(float x, float y, float scl)
207221 {
208222 loop{index i = 0; while; do:
209223 if(#.shadows[i]~as~anim == 0 || #.shadows[i]~as~anim~ani.spr == 0){
@@ -239,12 +253,11 @@ public void drawShadowList(float x, float y)
239253 & (int)0xffffff;
240254 }
241255 float syscl = .stg~sdw.yscale;
242- float cs = ss.as~cscl;
243256 ss.as~anim~ani.shadowDraw(
244- .com.xoffset-(x-ss.as~x)*cs,
257+ .com.xoffset-(x-ss.as~x)*scl,
245258 .com.zoffset + .com.yoffset - .stage.envShake.getOffset()
246- - (y+ss.as~y*syscl-ss.offsety)*cs,
247- cs*ss.as~xscl, cs*-ss.as~yscl, syscl, ss.as~angle*(.m.PI/180.0),
259+ - (y+ss.as~y*syscl-ss.offsety)*scl,
260+ scl*ss.as~xscl, scl*-ss.as~yscl, syscl, ss.as~angle*(.m.PI/180.0),
248261 ss.as~aset, ss.as~axscl, ss.as~ayscl, .stage.bgPalFX, ss.as~oVer,
249262 (uint)color, intensity);
250263 }];
@@ -253,7 +266,7 @@ public void drawShadowList(float x, float y)
253266 while i < #.shadows:}
254267 }
255268
256-public void drawReflection(float x, float y)
269+public void drawReflection(float x, float y, float scl)
257270 {
258271 loop{index i = 0; while; do:
259272 if(#.shadows[i]~as~anim == 0 || #.shadows[i]~as~anim~ani.frames == 0){
@@ -275,20 +288,19 @@ public void drawReflection(float x, float y)
275288 ss.as~anim~ani.salpha = 0;
276289 }
277290 branch{
278- float cs = ss.as~cscl;
279291 cond ss.as~angle != 0.0:
280292 ss.as~anim~ani.angleDraw(
281- .com.xoffset-(x-ss.as~x)*cs,
293+ .com.xoffset-(x-ss.as~x)*scl,
282294 .com.zoffset + .com.yoffset - .stage.envShake.getOffset()
283- - (y+ss.as~y-ss.offsety)*cs,
284- cs*ss.as~xscl, cs*-ss.as~yscl, ss.as~angle*(.m.PI/180.0),
295+ - (y+ss.as~y-ss.offsety)*scl,
296+ scl*ss.as~xscl, scl*-ss.as~yscl, ss.as~angle*(.m.PI/180.0),
285297 ss.as~aset, ss.as~axscl, ss.as~ayscl, ss.as~fx, ss.as~oVer);
286298 else:
287299 ss.as~anim~ani.draw(
288- .com.scrrect=, .com.xoffset/cs - (x-ss.as~x),
289- (.com.zoffset+.com.yoffset-.stage.envShake.getOffset())/cs
300+ .com.scrrect=, .com.xoffset/scl - (x-ss.as~x),
301+ (.com.zoffset+.com.yoffset-.stage.envShake.getOffset())/scl
290302 - (y+ss.as~y-ss.offsety),
291- cs, cs, ss.as~xscl, ss.as~xscl, -ss.as~yscl, 0.0,
303+ scl, scl, ss.as~xscl, ss.as~xscl, -ss.as~yscl, 0.0,
292304 (float).com.GameWidth/2.0, ss.as~fx, ss.as~oVer);
293305 }
294306 }];
@@ -466,7 +478,7 @@ public void drawReflection(float x, float y)
466478 public void recAndAddAL(
467479 &.act.Action a=, int p,
468480 float x, float y, float xs, float ys, float an, bool as,
469- bool oVer, float ax, float ay, bool rec, int br, ^&.com.PalFX cfx)
481+ bool oVer, float ax, float ay, bool rec, bool br, ^&.com.PalFX cfx)
470482 {
471483 if(
472484 `time == 0 || !.m.inRange!int?(1, 32767, `timegap)
@@ -485,7 +497,7 @@ public void drawReflection(float x, float y)
485497 pfxi = i/`framegap - 1;
486498 .addAnimList(
487499 .anims=, `imgs[`imgidx-i&63].anim, p-2,
488- `imgs[`imgidx-i&63].x, `imgs[`imgidx-i&63].y, .com.scale,
500+ `imgs[`imgidx-i&63].x, `imgs[`imgidx-i&63].y, false,
489501 `imgs[`imgidx-i&63].xscl, `imgs[`imgidx-i&63].yscl,
490502 `imgs[`imgidx-i&63].angle, `imgs[`imgidx-i&63].aset,
491503 `imgs[`imgidx-i&63].oVer,
@@ -2021,11 +2033,9 @@ public &Projectile
20212033 }
20222034 }
20232035 if(#`ani > 0 && #`ani~ani.spr > 0){
2024- int br =
2025- 256 >> (int)(
2026- .super > 0 && .superdarken != 0 && playerNo != .superplayer);
2036+ bool br = playerNo == .superplayer;
20272037 .addAnimList(
2028- .anims=, `ani, `sprpriority, `x, `y, .com.scale,
2038+ .anims=, `ani, `sprpriority, `x, `y, false,
20292039 (float)`facing*`scalex, `scaley, 0.0, false, oVer, 1.0, 1.0, -1, 0,
20302040 br, `palfx,
20312041 `shadowr<<16 | (`shadowg&255)<<8 | (`shadowb&255), 256, 0.0);
@@ -3156,8 +3166,7 @@ public &Char
31563166 float ys = `sysfvar[.fYSCALE];
31573167 if(#`ani > 0) branch{
31583168 int sp = `sprpriority;
3159- int br = 256 >> (int)(
3160- .super > 0 && .superdarken != 0 && `playerno != .superplayer);
3169+ bool br = `playerno == .superplayer;
31613170 float an;
31623171 branch{
31633172 cond `ls(.lsANGLEDRAW):
@@ -3177,7 +3186,7 @@ public &Char
31773186 .anims=, `ani, sp,
31783187 x - (float)(
31793188 (int)(`stVal.hb.hitshaketime > 0 && (`stVal.time&1) != 0) * `facing),
3180- y, .com.scale, xs, ys, an, `angleset, `mver0() != 1,
3189+ y, false, xs, ys, an, `angleset, `mver0() != 1,
31813190 `sysfvar[.fANGLESCALEX], `sysfvar[.fANGLESCALEY],
31823191 `ls(.lsTRANS) ? `sysivar[.iALPHAS] : -1,
31833192 `sysivar[.iALPHAD], br, `getPalfx(),
@@ -5528,17 +5537,16 @@ public void Explod::update(bool oVer, int playerNo)
55285537 ret;
55295538 }
55305539 }
5531- float scl = 1.0, cscl = .com.scale, xofs = 0.0, yofs = 0.0;
5540+ float scl = 1.0;
5541+ bool screen = false;
55325542 if(`bindtime != 0) branch{
55335543 cond `postype >= 4:
5534- cscl = 1.0;
5544+ screen = true;
55355545 `x =
5536- .com.camerax + `offsetx + (
5546+ `offsetx + (
55375547 `postype == 4
55385548 ? -(float).com.GameWidth/2.0 : (float).com.GameWidth/2.0);
5539- xofs = -.com.xoffset;
5540- `y = .com.cameray + `offsety - .com.zoffset;
5541- yofs = -.com.yoffset + .stage.envShake.getOffset();
5549+ `y = `offsety;
55425550 else:
55435551 {
55445552 ^&.Char bc = .players.get(`bindid);
@@ -5591,11 +5599,10 @@ public void Explod::update(bool oVer, int playerNo)
55915599 pfx~remap.new(0);
55925600 }
55935601 .addAnimList(
5594- a=, `ani, `sprpriority, `x+xofs, `y+yofs, cscl,
5602+ a=, `ani, `sprpriority, `x, `y, screen,
55955603 (float)`facing*`scalex*scl, (float)`vfacing*`scaley*scl,
55965604 0.0, false, oVer, 1.0, 1.0, `alphas < 0 ? -1 : `alphas,
5597- `alphad, 256 >> (int)(
5598- .super > 0 && .superdarken != 0 && playerNo != .superplayer),
5605+ `alphad, playerNo == .superplayer,
55995606 pfx, `shadowr<<16 | (`shadowg&255)<<8 | (`shadowb&255),
56005607 `alphas < 0 ? 256 : `alphas, 0.0);
56015608 }];
@@ -6674,6 +6681,9 @@ public float action(
66746681 .stage.bgPalFX~step();
66756682 .stage.envShake.next();
66766683 if(.envcol_time > 0) .envcol_time--;
6684+ .com.drawscale = 0.0/0.0;
6685+ .com.zoomposx = 0.0;
6686+ .com.zoomposy = 0.0;
66776687 branch{
66786688 cond .super > 0:
66796689 .super--;
@@ -6724,9 +6734,9 @@ public float action(
67246734 {
67256735 if(#.superanim > 0){
67266736 .addAnimList(
6727- .topanims=, .superanim, 5, .superposx, .superposy, .com.scale,
6737+ .topanims=, .superanim, 5, .superposx, .superposy, false,
67286738 (float).superfacing, 1.0, 0.0, false,
6729- .chars[.superplayer]<>~mver0() != 1, 1.0, 1.0, -1, 0, 256,
6739+ .chars[.superplayer]<>~mver0() != 1, 1.0, 1.0, -1, 0, true,
67306740 .superpmap, 0, 0, 0.0);
67316741 if(.superanim~ani.loopend) .superanim.new(0);
67326742 }
@@ -7164,8 +7174,8 @@ public void draw(float x, float y, float scl)
71647174 .stg~bgDraw(false, bgx, bgy, scl);
71657175 comm:
71667176 if(!.gs(.gsGLOBALNOSHADOW)){
7167- if(.stg~reflection > 0) .drawReflection(x, y);
7168- .drawShadowList(x, y);
7177+ if(.stg~reflection > 0) .drawReflection(x, y, scl*.stg~ztopscale);
7178+ .drawShadowList(x, y, scl*.stg~ztopscale);
71697179 }
71707180 {
71717181 float off = .stage.envShake.getOffset();
@@ -7230,7 +7240,7 @@ public void draw(float x, float y, float scl)
72307240 .fight~ro.draw(0, .ko, winner);
72317241 }
72327242 if(.envcol_time == 0 || .envcol_under != 0){
7233- .drawAnimList(.anims=, x, y);
7243+ .drawAnimList(.anims=, x, y, scl*.stg~ztopscale);
72347244 }
72357245 if(.envcol_time == 0 && !.gs(.gsNOFG)) .stg~bgDraw(true, bgx, bgy, scl);
72367246 if(.envcol_time != 0 && .envcol_under == 0){
@@ -7238,7 +7248,7 @@ public void draw(float x, float y, float scl)
72387248 }
72397249 .fight~draw(1, lpl, names, .gs(.gsNOBARDISPLAY), facefx, .superplayer);
72407250 .fight~ro.draw(1, .ko, winner);
7241- .drawAnimList(.topanims=, x, y);
7251+ .drawAnimList(.topanims=, x, y, scl*.stg~ztopscale);
72427252 .fight~draw(2, lpl, names, .gs(.gsNOBARDISPLAY), facefx, .superplayer);
72437253 .fight~ro.draw(2, .ko, winner);
72447254 void fade(.com.scrrect.self rect=, int alpha)
--- a/ssz/common.ssz
+++ b/ssz/common.ssz
@@ -142,7 +142,8 @@ public float scrxmin = 0.0, scrxmax = 0.0;
142142 public float zoffset = 0.0;
143143 public float yoffset = 0.0;
144144 public float xoffset = 0.0;
145-public float scale = 1.0;
145+public float scale = 1.0, drawscale = 0.0/0.0;
146+public float zoomposx = 0.0, zoomposy = 0.0;
146147 public float turbo = Speed;
147148 public int gametime = 0, time = 0;
148149 public int intro = 20;
--- a/ssz/fighting.ssz
+++ b/ssz/fighting.ssz
@@ -214,7 +214,7 @@ void game()
214214 if(lastChar >= '\x20' && lastChar < '\x7f') `line .= lastChar;
215215 }
216216 }
217- float x = 0.0, y = 0.0, l = 0.0, r = 0.0;
217+ float x = 0.0, y = 0.0, l = 0.0, r = 0.0, bl = 0.0, br = 0.0;
218218 float scl = 1.0, sclmul = 1.0;
219219 float newx = x, newy = y;
220220 int oldp1wins, oldp2wins, olddraws;
@@ -255,6 +255,25 @@ void game()
255255 .com.xmin = -((float).com.GameWidth/2.0)/.com.scale + .com.screenleft;
256256 .com.xmax = ((float).com.GameWidth/2.0)/.com.scale - .com.screenright;
257257 }
258+ float xbound(float scl, float x)
259+ {
260+ ret
261+ .m.max!float?(
262+ `bl-(float).com.GameWidth/2.0 + ((float).com.GameWidth/2.0)/scl)<,
263+ .m.min!float?(
264+ `br+(float).com.GameWidth/2.0 - ((float).com.GameWidth/2.0)/scl, x);
265+ }
266+ float ybound(float scl, float y)
267+ {
268+ float tmp = .m.max!float?(0.0, 240.0 - .com.screenZoffset);
269+ ret
270+ .m.min!float?(0.0)<,
271+ .m.min!float?(tmp*(1.0/scl - 1.0))<,
272+ .m.max!float?(
273+ .com.boundhigh-240.0 + .m.max!float?(
274+ (float).com.GameHeight/scl, tmp + .com.screenZoffset/scl),
275+ y + 240.0*(1.0 - .m.min!float?(1.0, scl)));
276+ }
258277 loop{
259278 int stagetime;
260279 ^&.sha.Share share;
@@ -404,10 +423,10 @@ void game()
404423 while i < stagetime:
405424 }
406425 if(.com.round == 1) .snd.bgm~play(.chr.stg~bgmusic);
407- float bl =
426+ bl =
408427 (float)(.chr.stg~cam.boundleft - .chr.stg~cam.startx)
409428 * .chr.stg~localscl;
410- float br =
429+ br =
411430 (float)(.chr.stg~cam.boundright - .chr.stg~cam.startx)
412431 * .chr.stg~localscl;
413432 .com.boundhigh =
@@ -529,20 +548,10 @@ void game()
529548 : .m.max!float?(0.0)<, .m.min!float?(((float).com.GameWidth/2.0)/scl)<,
530549 .m.max!float?(-(l-(newx-x)), r-(newx-x));
531550 x =
532- .m.max!float?(
533- bl-(float).com.GameWidth/2.0 + ((float).com.GameWidth/2.0)/scl)<,
534- .m.min!float?(
535- br+(float).com.GameWidth/2.0 - ((float).com.GameWidth/2.0)/scl)<,
551+ xbound(scl)<,
536552 .m.min!float?(x + l + tmp)<, .m.max!float?(x + r - tmp)<, newx;
537553 if(!.com.zoom) x = .m.ceil(x*4.0 - 0.5)/4.0;
538- tmp = .m.max!float?(0.0, 240.0 - .com.screenZoffset);
539- y =
540- .m.min!float?(0.0)<,
541- .m.min!float?(tmp*(1.0/scl - 1.0))<,
542- .m.max!float?(
543- .com.boundhigh-240.0 + .m.max!float?(
544- (float).com.GameHeight/scl, tmp + .com.screenZoffset/scl),
545- newy + 240.0*(1.0 - .m.min!float?(1.0, scl)));
554+ y = ybound(scl, newy);
546555 if(
547556 .com.tickFrame() && (.chr.super <= 0 || .chr.superpausebg == 0)
548557 && (.chr.pause <= 0 || .chr.pausebg == 0))
@@ -559,7 +568,18 @@ void game()
559568 break, do;
560569 }
561570 if(.se.fskip) while;
562- .chr.draw(x, y, scl);
571+ {
572+ float dx = x, dy = y, dscl = scl;
573+ if(
574+ !.m.isnan(.com.drawscale)
575+ && !.m.isnan(.com.zoomposx)&& !.m.isnan(.com.zoomposy))
576+ {
577+ dscl = .m.max!float?(minscl, .com.drawscale);
578+ dx = xbound(dscl, x + .com.zoomposx * (dscl - scl) / dscl);
579+ dy = y + .com.zoomposy;
580+ }
581+ .chr.draw(dx, dy, dscl);
582+ }
563583 drawDebug();
564584 /?/*.cfg.OpenGL:
565585 .sdl.GlSwapBuffers(::);
--- a/ssz/stage.ssz
+++ b/ssz/stage.ssz
@@ -602,6 +602,14 @@ public &Stage
602602 float bgscl = `hires ? 0.5 : 1.0;
603603 float yofs = .envShake.getOffset();
604604 float posx = x, posy = y;
605+ branch{
606+ cond posy > 0.0:
607+ yofs += posy;
608+ posy = 0.0;
609+ cond posy < .com.boundhigh:
610+ yofs += posy - .com.boundhigh;
611+ posy = .com.boundhigh;
612+ }
605613 if(`cam.verticalfollow > 0.0) branch{
606614 float scl2 = `localscl * scl;
607615 cond yofs < 0.0:
--- a/ssz/statebuilder.ssz
+++ b/ssz/statebuilder.ssz
@@ -57,6 +57,7 @@ const ^/char kuuhaktokigou = " !=<>()|&+-*/%,[]^|:"\"\t\r\n;
5757 ForceFeedback,
5858 VictoryQuote,
5959 RemapPal,
60+ Zoom,
6061 Null
6162 }
6263 &StateCtrl
@@ -3219,6 +3220,8 @@ public &StateBuilder
32193220 if(!`tagOut(am=)) ret false;
32203221 case .CtrlTy::RemapPal:
32213222 if(!`remapPal(am=)) ret false;
3223+ case .CtrlTy::Zoom:
3224+ if(!`zoom(am=)) ret false;
32223225 default:
32233226 {
32243227 bool error = false;
@@ -7653,6 +7656,33 @@ public &StateBuilder
76537656 ret true;
76547657 }]);
76557658 }
7659+ bool zoom(&.tbl.NameTable!^/char? param=)
7660+ {
7661+ ret `stateSec(param=,[bool(){
7662+ `state.ctrlList[-1].task .= ".com.drawscale=.com.scale;";
7663+ if(!`stateParam(param=, "pos", [`paraF_t(data=){
7664+ if(
7665+ !`argExpression(
7666+ `state.ctrlList[-1].task=, data=,
7667+ ".com.zoomposx=", ";", 1)) ret false;
7668+ if(.s.equ(",")<, `tokenizer(data=)){
7669+ if(
7670+ !`fullExpression(
7671+ `state.ctrlList[-1].task=, data=,
7672+ ".com.zoomposy=", ";", 1)) ret false;
7673+ }
7674+ ret true;
7675+ }])) ret false;
7676+ if(!`stateParam(param=, "scale", [`paraF_t(data=){
7677+ if(
7678+ !`fullExpression(
7679+ `state.ctrlList[-1].task=, data=,
7680+ ".com.drawscale=", ";", 1)) ret false;
7681+ ret true;
7682+ }])) ret false;
7683+ ret true;
7684+ }]);
7685+ }
76567686 ^/char stateBulid(%char buf=, ^/char def, ^/char st=)
76577687 {:<-
76587688 public bool statedef(^/char sec, ^/char name, ^/char data)
@@ -7851,6 +7881,8 @@ public &StateBuilder
78517881 `state.ctrlList[-1].typ = .CtrlTy::VictoryQuote;
78527882 cond .s.equ(s, "remappal"):
78537883 `state.ctrlList[-1].typ = .CtrlTy::RemapPal;
7884+ cond .s.equ(s, "zoom"):
7885+ `state.ctrlList[-1].typ = .CtrlTy::Zoom;
78547886 cond .s.equ(s, "null"):
78557887 `state.ctrlList[-1].typ = .CtrlTy::Null;
78567888 else: