• R/O
  • SSH
  • HTTPS

jsporkhack: コミット


コミットメタ情報

リビジョン38 (tree)
日時2009-09-23 03:05:37
作者dplusplus

ログメッセージ

本家#478
Don't define special levels with MAZE anymore; just use LEVEL, and add "mazeleve
l" to level FLAGS.
LEVEL also takes now an optional parameter, just like MAZE used to, which is a f
ill character
used to fill the level with a grid, so you can use MAZEWALK on it.

変更サマリ

差分

--- JSporkHack/trunk/include/sp_lev.h (revision 37)
+++ JSporkHack/trunk/include/sp_lev.h (revision 38)
@@ -24,11 +24,8 @@
2424 #define ARBOREAL 16
2525 #define NOFLIPX 32
2626 #define NOFLIPY 64
27+#define MAZELEVEL 128
2728
28- /* special level types */
29-#define SP_LEV_ROOMS 1
30-#define SP_LEV_MAZE 2
31-
3229 /* max. # of random registers */
3330 #define MAX_REGISTERS 10
3431
@@ -115,7 +112,6 @@
115112 boolean smoothed, joined;
116113 xchar lit, walled;
117114 long flags;
118- char levtyp; /* SP_LEV_xxx */
119115 schar filling;
120116 long n_opcodes;
121117 } lev_init;
--- JSporkHack/trunk/src/sp_lev.c (revision 37)
+++ JSporkHack/trunk/src/sp_lev.c (revision 38)
@@ -2687,7 +2687,7 @@
26872687
26882688 (void) memset((genericptr_t)&SpLev_Map[0][0], 0, sizeof SpLev_Map);
26892689
2690- level.flags.is_maze_lev = lvl->init_lev.levtyp == SP_LEV_MAZE;
2690+ level.flags.is_maze_lev = 0;
26912691
26922692 if (lvl->init_lev.init_present) {
26932693 if (lvl->init_lev.lit < 0) lvl->init_lev.lit = rn2(2);
@@ -2719,6 +2719,7 @@
27192719 if (lvl->init_lev.flags & ARBOREAL) level.flags.arboreal = 1;
27202720 if (lvl->init_lev.flags & NOFLIPX) allow_flips &= ~1;
27212721 if (lvl->init_lev.flags & NOFLIPY) allow_flips &= ~2;
2722+ if (lvl->init_lev.flags & MAZELEVEL) level.flags.is_maze_lev = 1;
27222723
27232724 while (n_opcode < lvl->init_lev.n_opcodes && !exit_script) {
27242725 int opcode = lvl->opcodes[n_opcode].opcode;
--- JSporkHack/trunk/util/lev_comp.y (revision 37)
+++ JSporkHack/trunk/util/lev_comp.y (revision 38)
@@ -160,26 +160,25 @@
160160 }
161161 ;
162162
163-level_def : MAZE_ID ':' string ',' filling
163+level_def : LEVEL_ID ':' string opt_filling
164164 {
165- splev.init_lev.filling = (schar) $5;
166- splev.init_lev.levtyp = SP_LEV_MAZE;
167165 if (index($3, '.'))
168166 yyerror("Invalid dot ('.') in level name.");
169167 if ((int) strlen($3) > 8)
170168 yyerror("Level names limited to 8 characters.");
169+ n_plist = n_mlist = n_olist = 0;
171170 $$ = $3;
172- n_plist = n_mlist = n_olist = 0;
173171 }
174- | LEVEL_ID ':' string
172+ ;
173+
174+opt_filling : /* nothing */
175175 {
176- splev.init_lev.levtyp = SP_LEV_ROOMS;
177- if (index($3, '.'))
178- yyerror("Invalid dot ('.') in level name.");
179- if ((int) strlen($3) > 8)
180- yyerror("Level names limited to 8 characters.");
181- $$ = $3;
176+ /* really, nothing */
182177 }
178+ | ',' filling
179+ {
180+ splev.init_lev.filling = (schar) $2;
181+ }
183182 ;
184183
185184 lev_init : /* nothing */
--- JSporkHack/trunk/util/lev_comp.l (revision 37)
+++ JSporkHack/trunk/util/lev_comp.l (revision 38)
@@ -213,6 +213,7 @@
213213 noflipx { yylval.i=NOFLIPX; return FLAG_TYPE; }
214214 noflipy { yylval.i=NOFLIPY; return FLAG_TYPE; }
215215 noflip { yylval.i=(NOFLIPX + NOFLIPY); return FLAG_TYPE; }
216+mazelevel { yylval.i=MAZELEVEL; return FLAG_TYPE; }
216217 \[\ *[0-9]+\%\ *\] { yylval.i = atoi(yytext + 1); return PERCENT; }
217218 [0-9]+\% { yylval.i = atoi(yytext); return SPERCENT; }
218219 [+\-]?[0-9]+ { yylval.i=atoi(yytext); return INTEGER; }
旧リポジトリブラウザで表示