This is an automated email from the git hooks/post-receive script. jmtd pushed a commit to annotated tag chocolate-doom-0.1.0 in repository chocolate-doom.
commit 91d265dfdf7c358d4917c1bc8b5050183848bba3 Author: Simon Howard <[email protected]> Date: Mon Oct 3 13:21:11 2005 +0000 Weapons mapping code Subversion-branch: /trunk/chocolate-doom Subversion-revision: 158 --- src/deh_weapon.c | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/src/deh_weapon.c b/src/deh_weapon.c index d1db4ba..62ea61f 100644 --- a/src/deh_weapon.c +++ b/src/deh_weapon.c @@ -1,7 +1,7 @@ // Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // -// $Id: deh_weapon.c 157 2005-10-03 11:08:16Z fraggle $ +// $Id: deh_weapon.c 158 2005-10-03 13:21:11Z fraggle $ // // Copyright(C) 2005 Simon Howard // @@ -21,6 +21,9 @@ // 02111-1307, USA. // // $Log$ +// Revision 1.4 2005/10/03 13:21:11 fraggle +// Weapons mapping code +// // Revision 1.3 2005/10/03 11:08:16 fraggle // Replace end of section functions with NULLs as they arent currently being // used for anything. @@ -38,12 +41,16 @@ // //----------------------------------------------------------------------------- +#include <stdlib.h> +#include <string.h> + #include "doomdef.h" #include "doomtype.h" #include "d_items.h" #include "deh_defs.h" +#include "deh_main.h" #include "deh_mapping.h" DEH_BEGIN_MAPPING(weapon_mapping, weaponinfo_t) @@ -57,11 +64,37 @@ DEH_END_MAPPING static void *DEH_WeaponStart(deh_context_t *context, char *line) { - return NULL; + int weapon_number = 0; + + sscanf(line, "Weapon %i", &weapon_number); + + if (weapon_number < 0 || weapon_number >= NUMWEAPONS) + return NULL; + + return &weaponinfo[weapon_number]; } static void DEH_WeaponParseLine(deh_context_t *context, char *line, void *tag) { + char *variable_name, *value; + weaponinfo_t *weapon; + int ivalue; + + if (tag == NULL) + return; + + weapon = (weaponinfo_t *) tag; + + if (!DEH_ParseAssignment(line, &variable_name, &value)) + { + // Failed to parse + + return; + } + + ivalue = atoi(value); + + DEH_SetMapping(&weapon_mapping, weapon, variable_name, ivalue); } deh_section_t deh_section_weapon = -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/chocolate-doom.git _______________________________________________ Pkg-games-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits

