author | ecalot
<ecalot> 2004-10-19 06:04:45 UTC |
committer | ecalot
<ecalot> 2004-10-19 06:04:45 UTC |
parent | cca6536792cb49dd4124f1efe85177453b459e77 |
FP/src/Makefile | +19 | -2 |
FP/src/conf/awk/res_conf_files.awk | +1 | -1 |
FP/src/conf/awk/res_conf_mods.awk | +1 | -1 |
FP/src/conf/awk/res_conf_resources.awk | +1 | -1 |
FP/src/conf/awk/res_conf_types.awk | +1 | -1 |
FP/src/conf/awk/states_conf_static.awk | +6 | -2 |
FP/src/conf/tiles.conf | +70 | -0 |
FP/src/include/map_defs.h | +1 | -1 |
FP/src/include/tiles.h | +41 | -0 |
FP/src/include/tiles_conf.h | +16 | -0 |
FP/src/res/tiles.c | +49 | -0 |
stuff/FP-Attic/states_conf_properties.awk | +1 | -1 |
diff --git a/FP/src/Makefile b/FP/src/Makefile index 72fd49c..da60767 100644 --- a/FP/src/Makefile +++ b/FP/src/Makefile @@ -58,6 +58,8 @@ GENERATEDRESHEADERS = include/res_conf_parts.h include/res_conf_files.h\ include/res_conf_resources.h GENERATEDSTAHEADERS = include/states_conf_static.h include/states_conf_properties.h +GENERATEDTILHEADERS = include/tiles_conf_types.h include/tiles_conf_groups.h + #Use this to temporary remove an option OPTIONS = $(INCLUDE) $(DEFINES) $(RELEASE) LINKEROPTIONS = $(LINKERRELEASE) @@ -88,7 +90,7 @@ checksdl: checkawk: $(INFO) Checking AWK... - @$(AWK) + @which $(AWK)>/dev/null checksed: $(INFO) Checking Sed... @@ -181,9 +183,14 @@ config.o: res/config.c include/resources.h include/res_conf.h $(CC) -c res/config.c $(OPTIONS) states.o: ker/states.c include/states.h include/states_conf.h include/resources.h include/res_conf.h - $(INFO) Compiling kernel states module... + $(INFO) compiling kernel states module... $(CC) -c ker/states.c $(OPTIONS) +tiles.o: res/tiles.c include/tiles.h include/tiles_conf.h + $(INFO) compiling resource tile classification module... + $(CC) -c res/tiles.c $(OPTIONS) + + #AWK scripts: header generation include/res_conf.h: $(GENERATEDRESHEADERS) @@ -217,3 +224,13 @@ include/states_conf_properties.h: conf/statesproperties.conf conf/awk/states_con $(INFO) Creating states condition properties configuration file... $(GREP) conf/statesproperties.conf|$(AWK) -f conf/awk/states_conf_properties.awk >include/states_conf_properties.h +include/tiles_conf.h: $(GENERATEDTILHEADERS) + +include/tiles_conf_types.h: conf/tiles.conf conf/awk/tiles_conf_types.awk + $(INFO) Creating tile list configuration file... + $(GREP) conf/tiles.conf|$(AWK) -f conf/awk/tiles_conf_types.awk>include/tiles_conf_types.h + +include/tiles_conf_groups.h: conf/tiles.conf conf/awk/tiles_conf_groups.awk + $(INFO) Creating tile groups configuration file... + $(GREP) conf/tiles.conf|$(AWK) -f conf/awk/tiles_conf_groups.awk >include/tiles_conf_groups.h + diff --git a/FP/src/conf/awk/res_conf_files.awk b/FP/src/conf/awk/res_conf_files.awk index 41d4cca..85b40e6 100644 --- a/FP/src/conf/awk/res_conf_files.awk +++ b/FP/src/conf/awk/res_conf_files.awk @@ -32,7 +32,7 @@ BEGIN { res=0 } -{ +/^([ ]*[^# ].*)$/ { printf "#define RES_FILE_%s %d\n",$1,res for (i = 2; i <= NF; i++) { filelist=(filelist coma $i) diff --git a/FP/src/conf/awk/res_conf_mods.awk b/FP/src/conf/awk/res_conf_mods.awk index 1dc74ff..51495b0 100644 --- a/FP/src/conf/awk/res_conf_mods.awk +++ b/FP/src/conf/awk/res_conf_mods.awk @@ -28,7 +28,7 @@ # DO NOT remove this copyright notice # -{ +/^([ ]*[^# ].*)$/ { printf "#define RES_MODS_%s %s\n",$1,$2 } diff --git a/FP/src/conf/awk/res_conf_resources.awk b/FP/src/conf/awk/res_conf_resources.awk index d6ba579..d1c3044 100644 --- a/FP/src/conf/awk/res_conf_resources.awk +++ b/FP/src/conf/awk/res_conf_resources.awk @@ -35,7 +35,7 @@ BEGIN { items=0 } -{ +/^([ ]*[^# ].*)$/ { oldres=res if (substr($2,1,2)=="OF") { if ((items!=0)&&(NF!=items)) { diff --git a/FP/src/conf/awk/res_conf_types.awk b/FP/src/conf/awk/res_conf_types.awk index ef21d8e..33ffde7 100644 --- a/FP/src/conf/awk/res_conf_types.awk +++ b/FP/src/conf/awk/res_conf_types.awk @@ -32,7 +32,7 @@ BEGIN { type=0 } -{ +/^([ ]*[^# ].*)$/ { printf "#define RES_TYPE_%s %d\n",$1,type++ } diff --git a/FP/src/conf/awk/states_conf_static.awk b/FP/src/conf/awk/states_conf_static.awk index f73481d..28c702b 100644 --- a/FP/src/conf/awk/states_conf_static.awk +++ b/FP/src/conf/awk/states_conf_static.awk @@ -47,9 +47,10 @@ BEGIN { close(tmp) currentAnimation=0 latestLevel=-1 + first=0 } -{ +/^([ ]*[^# ].*)$/ { if ( $1 == "-" ) { if ($2=="-") { if ($3=="-") { @@ -108,7 +109,7 @@ BEGIN { listType=$3 } } else { - if (conditions) { + if (first) { actionArray[currentAction,"description"]=rememberAction actionArray[currentAction,"isFirstInState"]=currentState actionArray[currentAction,"animationStart"]=startAnimation @@ -120,6 +121,8 @@ BEGIN { actionArray[currentAction,"lastComma"]="," currentAction++ currentState="" + } else { + first=1 } startAnimation=currentAnimation @@ -134,6 +137,7 @@ BEGIN { } } else { listType="" + priorState=currentState #TODO fix that!!! currentState=tolower($1) stateList[currentState]=currentAction } diff --git a/FP/src/conf/tiles.conf b/FP/src/conf/tiles.conf new file mode 100644 index 0000000..fdc7849 --- /dev/null +++ b/FP/src/conf/tiles.conf @@ -0,0 +1,70 @@ +# Princed V3 - Prince of Persia Level Editor for PC Version +# Copyright (C) 2003 Princed Development Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# The authors of this program may be contacted at http://forum.princed.com.ar + +# tiles.conf: FreePrince : Tiles list +# \xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf +# Copyright 2004, 2003 Princed Development Team +# Created: 15 Aug 2004 +# +# Author: Enrique Calot <ecalot.cod@princed.com.ar> +# +# Note: +# DO NOT remove this copyright notice +# + +tile EMPTY 0 free +dangerous +tile FLOOR 1 free +walkable +tile SPIKES 2 spike +walkable dangerous +tile PILLAR 3 none + +tile GATE 4 gate +gates + +tile BTN_STUCK 5 none +tile BTN_DROP 6 event +tile TAPESTRY 7 tapest +tile BP_BOTTOM 8 none +tile BP_TOP 9 none +tile POTION 10 potion +tile LOOSE 11 none +tile TAPESTRY_TOP 12 ttop +tile MIRROR 13 none +tile DEBRIS 14 none +tile BTN_RAISE 15 event +tile EXIT_LEFT 16 none +gates + +tile EXIT_RIGHT 17 none +tile CHOPPER 18 chomp +tile TORCH 19 none +tile WALL 20 wall +tile SKELETON 21 none +tile SWORD 22 none +tile BALCONY_LEFT 23 none +tile BALCONY_RIGHT 24 none +tile LATTICE_PILLAR 25 none +tile LATTICE_SUPPORT 26 none +tile LATTICE_SMALL 27 none +tile LATTICE_LEFT 28 none +tile LATTICE_RIGHT 29 none +tile TORCH_DEBRIS 30 none +tile NULL 31 none diff --git a/FP/src/include/map_defs.h b/FP/src/include/map_defs.h index bcea63a..1f35e8b 100644 --- a/FP/src/include/map_defs.h +++ b/FP/src/include/map_defs.h @@ -98,7 +98,7 @@ Len Offs BlockName & Description #define T_BTN_DROP 0x06 /* 00110 event */ #define T_TAPESTRY 0x07 /* 00111 tapest */ #define T_BP_BOTTOM 0x08 /* 01000 none */ -#define T_BP_TOP 0x09 /* 01001 none */ +#define T_BP_TOP 0x09 /* 01001 none */ #define T_POTION 0x0A /* 01010 potion */ #define T_LOOSE 0x0B /* 01011 none */ #define T_TAPESTRY_TOP 0x0C /* 01100 ttop */ diff --git a/FP/src/include/tiles.h b/FP/src/include/tiles.h new file mode 100644 index 0000000..25bba9e --- /dev/null +++ b/FP/src/include/tiles.h @@ -0,0 +1,41 @@ +/* Princed V3 - Prince of Persia Level Editor for PC Version + Copyright (C) 2003 Princed Development Team + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + The authors of this program may be contacted at http://forum.princed.com.ar +*/ + +/* +tiles.h: FreePrince : Tile functions +\xaf\xaf\xaf\xaf\xaf\xaf + Copyright 2004 Princed Development Team + Created: 19 Oct 2004 + + Author: Enrique Calot <ecalot.cod@princed.com.ar> + + Note: + DO NOT remove this copyright notice +*/ + +#ifndef _TILES_H_ +#define _TILES_H_ + +#include "tiles_conf.h" + +int isInGroup(unsigned char tile,short group); + +#endif + diff --git a/FP/src/include/tiles_conf.h b/FP/src/include/tiles_conf.h new file mode 100644 index 0000000..a7e735c --- /dev/null +++ b/FP/src/include/tiles_conf.h @@ -0,0 +1,16 @@ +/* This file includes the autogenerated configuration headers + * please do not edit the included files, edit the .conf + * files instead and run make to rebuild the headers + */ + + +#ifndef _TILES_CONF_ +#define _TILES_CONF_ + +/* tile types */ +#include "tiles_conf_types.h" +/* tile groups */ +#include "tiles_conf_groups.h" + +#endif + diff --git a/FP/src/res/tiles.c b/FP/src/res/tiles.c new file mode 100644 index 0000000..39ab8bf --- /dev/null +++ b/FP/src/res/tiles.c @@ -0,0 +1,49 @@ +/* Princed V3 - Prince of Persia Level Editor for PC Version + Copyright (C) 2003 Princed Development Team + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + The authors of this program may be contacted at http://forum.princed.com.ar +*/ + +/* +tiles.c: FreePrince : Tile functions +\xaf\xaf\xaf\xaf\xaf\xaf\xaf + Copyright 2004 Princed Development Team + Created: 19 Oct 2004 + + Author: Enrique Calot <ecalot.cod@princed.com.ar> + + Note: + DO NOT remove this copyright notice +*/ + +#ifndef _TILES_H_ +#define _TILES_H_ + +#include "tiles_conf.h" + +int isInGroup(unsigned char tile,short group) { + static unsigned char tileList[]=TILES_GROUP_LIST; + unsigned char* i=tileList+group; + tile=tile&0x1F; /* get the last 5 bits and clear the beginning */ + tile++; + + while ((*i)&&(*i!=tile)) i++; + return *i; /* returns non-zero if true and zero if false */ +} + +#endif + diff --git a/stuff/FP-Attic/states_conf_properties.awk b/stuff/FP-Attic/states_conf_properties.awk index 9af08bb..1ee6ca6 100644 --- a/stuff/FP-Attic/states_conf_properties.awk +++ b/stuff/FP-Attic/states_conf_properties.awk @@ -28,7 +28,7 @@ # DO NOT remove this copyright notice # -{ +/^([ ]*[^# ].*)$/ { printf("#define STATES_COND_%s %d\n",$1,$2) }