From 9aa9870cbe16be9e768e86c09f7c087c06be8732 Mon Sep 17 00:00:00 2001 From: danij Date: Sun, 16 Nov 2008 21:45:17 +0000 Subject: [PATCH] Added flags for Detail and Reflection definitions to govern when the definitions will be used (with IWAD, with PWAD etc), analogous to those for Detail textures. --- doomsday/engine/defs/flags.ded | 26 + doomsday/engine/portable/include/def_data.h | 1275 ++++++++++--------- doomsday/engine/portable/include/def_main.h | 4 +- doomsday/engine/portable/src/def_main.c | 55 +- doomsday/engine/portable/src/def_read.c | 364 +++--- 5 files changed, 893 insertions(+), 831 deletions(-) diff --git a/doomsday/engine/defs/flags.ded b/doomsday/engine/defs/flags.ded index 1d50894672..dd5b47c0a3 100644 --- a/doomsday/engine/defs/flags.ded +++ b/doomsday/engine/defs/flags.ded @@ -30,6 +30,32 @@ Flag { # Allow using decoration with external resources. ID = "dcf_ext"; Value = 0x4; } +# Reflections +Flag { # Reflection will not be used with IWAD resources. + ID = "rff_noiwad"; Value = 0x1; +} + +Flag { # Allow using reflection with PWAD resources. + ID = "rff_pwad"; Value = 0x2; +} + +Flag { # Allow using reflection with external resources. + ID = "rff_ext"; Value = 0x4; +} + +# Details +Flag { # DetailTex will not be used with IWAD resources. + ID = "dtf_noiwad"; Value = 0x1; +} + +Flag { # Allow using detailtex with PWAD resources. + ID = "dtf_pwad"; Value = 0x2; +} + +Flag { # Allow using detailtex with external resources. + ID = "dtf_ext"; Value = 0x4; +} + # Lights Flag { ID = "lgf_nohalo"; Value = 0x1; } Flag { ID = "lgf_dontturnhalo"; Value = 0x2; } diff --git a/doomsday/engine/portable/include/def_data.h b/doomsday/engine/portable/include/def_data.h index bf7298de67..4b96cdbfd9 100644 --- a/doomsday/engine/portable/include/def_data.h +++ b/doomsday/engine/portable/include/def_data.h @@ -48,650 +48,653 @@ extern "C" { #define DED_MAX_SUB_MODELS 8 - typedef char ded_stringid_t[DED_STRINGID_LEN + 1]; - typedef ded_stringid_t ded_string_t; - typedef ded_stringid_t ded_mobjid_t; - typedef ded_stringid_t ded_stateid_t; - typedef ded_stringid_t ded_soundid_t; - typedef ded_stringid_t ded_musicid_t; - typedef ded_stringid_t ded_funcid_t; - typedef char ded_func_t[DED_FUNC_LEN + 1]; - typedef int ded_flags_t; - typedef char *ded_anystring_t; - - typedef struct ded_count_s { - int num, max; - } ded_count_t; - - typedef struct { - char path[DED_PATH_LEN + 1]; - } ded_path_t; - - typedef struct { - char id[DED_SPRITEID_LEN + 1]; - } ded_sprid_t; - - typedef struct { - char str[DED_STRINGID_LEN + 1]; - } ded_str_t; - - typedef struct { - ded_flags_t id; // ID of this property - ded_flags_t flags; - ded_string_t name; - ded_string_t flagPrefix; - int map; - } ded_xgclass_property_t; - - typedef struct { - ded_stringid_t id; - ded_string_t name; - ded_count_t propertiesCount; - ded_xgclass_property_t *properties; - // The rest of the properties are retrieved at runtime - // by querying the game for the callbacks for the - // classes by "name"; - int (C_DECL *doFunc)(); - void (*initFunc)(linedef_t *line); - int traverse; - int travRef; - int travData; - int evTypeFlags; - } ded_xgclass_t; - - typedef struct { - ded_stringid_t id; - ded_string_t text; - int value; - } ded_flag_t; - - typedef struct { - ded_mobjid_t id; - int doomedNum; - ded_string_t name; - - ded_stateid_t spawnState; - ded_stateid_t seeState; - ded_stateid_t painState; - ded_stateid_t meleeState; - ded_stateid_t missileState; - ded_stateid_t crashState; - ded_stateid_t deathState; - ded_stateid_t xDeathState; - ded_stateid_t raiseState; - - ded_soundid_t seeSound; - ded_soundid_t attackSound; - ded_soundid_t painSound; - ded_soundid_t deathSound; - ded_soundid_t activeSound; - - int reactionTime; - int painChance; - int spawnHealth; - float speed; - float radius; - float height; - int mass; - int damage; - ded_flags_t flags[NUM_MOBJ_FLAGS]; - int misc[NUM_MOBJ_MISC]; - } ded_mobj_t; - - typedef struct { - ded_stateid_t id; // ID of this state. - ded_sprid_t sprite; - ded_flags_t flags; - int frame; - int tics; - ded_funcid_t action; - ded_stateid_t nextState; - int misc[NUM_STATE_MISC]; - ded_anystring_t execute; // Console command. - } ded_state_t; - - typedef struct ded_lightmap_s { - ded_stringid_t id; - unsigned int tex; // Runtime - } ded_lightmap_t; - - typedef struct ded_flaremap_s { - ded_stringid_t id; - unsigned int tex; // Runtime - boolean custom; // If true tex = custom flare else flaretexname - boolean disabled; /* As zero = automatic and flare ids - are unsigned we need an extra flag - to indicate when id == "-" */ - } ded_flaremap_t; - - typedef struct { - ded_stateid_t state; - char level[64]; - float offset[3]; /* Origin offset in world coords - Zero means automatic */ - float size; // Zero: automatic - float color[3]; // Red Green Blue (0,1) - float lightLevel[2]; // Min/max lightlevel for bias - ded_flags_t flags; - ded_lightmap_t up, down, sides; - ded_flaremap_t flare; - float haloRadius; // Halo radius (zero = no halo). - } ded_light_t; - - typedef struct { - ded_path_t filename; - ded_path_t skinFilename; // Optional; override model's skin. - ded_string_t frame; - int frameRange; - ded_flags_t flags; // ASCII string of the flags. - int skin; - int skinRange; - float offset[3]; // Offset XYZ within model. - float alpha; - float parm; // Custom parameter. - unsigned char selSkinBits[2]; // Mask and offset. - unsigned char selSkins[8]; - ded_string_t shinySkin; - float shiny; - float shinyColor[3]; - float shinyReact; - blendmode_t blendMode; // bm_* - } ded_submodel_t; - - typedef struct { - ded_stringid_t id; // Optional identifier for the definition. - ded_stateid_t state; - int off; - ded_sprid_t sprite; // Only used by autoscale. - int spriteFrame; // Only used by autoscale. - ded_flags_t group; - int selector; - ded_flags_t flags; - float interMark; - float interRange[2]; // 0-1 by default. - int skinTics; // Tics per skin in range. - float scale[3]; // Scale XYZ - float resize; - float offset[3]; // Offset XYZ - float shadowRadius; // Radius for shadow (0=auto). - ded_submodel_t sub[DED_MAX_SUB_MODELS]; - } ded_model_t; - - typedef struct { - ded_soundid_t id; // ID of this sound, refered to by others. - ded_string_t lumpName; /* Actual lump name of the sound - ("DS" not included). */ - ded_string_t name; // A tag name for the sound. - ded_soundid_t link; // Link to another sound. - int linkPitch; - int linkVolume; - int priority; // Priority classification. - int channels; // Max number of channels to occupy. - int group; // Exclusion group. - ded_flags_t flags; // Flags (like chg_pitch). - ded_path_t ext; // External sound file (WAV). - } ded_sound_t; - - typedef struct { - ded_musicid_t id; // ID of this piece of music. - ded_string_t lumpName; // Lump name. - ded_path_t path; // External file (not a normal MUS file). - int cdTrack; // 0 = no track. - } ded_music_t; - - typedef struct { - ded_flags_t flags; - ded_string_t texture; - float offset; - float colorLimit; - } ded_skylayer_t; - - typedef struct ded_skymodel_s { - ded_stringid_t id; - int layer; // Defaults to -1. - float frameInterval; // Seconds per frame. - float yaw; - float yawSpeed; // Angles per second. - float coordFactor[3]; - float rotate[2]; - ded_anystring_t execute; // Executed on every frame change. - float color[4]; // RGBA - } ded_skymodel_t; +typedef char ded_stringid_t[DED_STRINGID_LEN + 1]; +typedef ded_stringid_t ded_string_t; +typedef ded_stringid_t ded_mobjid_t; +typedef ded_stringid_t ded_stateid_t; +typedef ded_stringid_t ded_soundid_t; +typedef ded_stringid_t ded_musicid_t; +typedef ded_stringid_t ded_funcid_t; +typedef char ded_func_t[DED_FUNC_LEN + 1]; +typedef int ded_flags_t; +typedef char* ded_anystring_t; + +typedef struct ded_count_s { + int num, max; +} ded_count_t; + +typedef struct { + char path[DED_PATH_LEN + 1]; +} ded_path_t; + +typedef struct { + char id[DED_SPRITEID_LEN + 1]; +} ded_sprid_t; + +typedef struct { + char str[DED_STRINGID_LEN + 1]; +} ded_str_t; + +typedef struct { + ded_flags_t id; // ID of this property + ded_flags_t flags; + ded_string_t name; + ded_string_t flagPrefix; + int map; +} ded_xgclass_property_t; + +typedef struct { + ded_stringid_t id; + ded_string_t name; + ded_count_t propertiesCount; + ded_xgclass_property_t* properties; + // The rest of the properties are retrieved at runtime + // by querying the game for the callbacks for the + // classes by "name"; + int (C_DECL *doFunc)(); + void (*initFunc)(linedef_t* line); + int traverse; + int travRef; + int travData; + int evTypeFlags; +} ded_xgclass_t; + +typedef struct { + ded_stringid_t id; + ded_string_t text; + int value; +} ded_flag_t; + +typedef struct { + ded_mobjid_t id; + int doomedNum; + ded_string_t name; + + ded_stateid_t spawnState; + ded_stateid_t seeState; + ded_stateid_t painState; + ded_stateid_t meleeState; + ded_stateid_t missileState; + ded_stateid_t crashState; + ded_stateid_t deathState; + ded_stateid_t xDeathState; + ded_stateid_t raiseState; + + ded_soundid_t seeSound; + ded_soundid_t attackSound; + ded_soundid_t painSound; + ded_soundid_t deathSound; + ded_soundid_t activeSound; + + int reactionTime; + int painChance; + int spawnHealth; + float speed; + float radius; + float height; + int mass; + int damage; + ded_flags_t flags[NUM_MOBJ_FLAGS]; + int misc[NUM_MOBJ_MISC]; +} ded_mobj_t; + +typedef struct { + ded_stateid_t id; // ID of this state. + ded_sprid_t sprite; + ded_flags_t flags; + int frame; + int tics; + ded_funcid_t action; + ded_stateid_t nextState; + int misc[NUM_STATE_MISC]; + ded_anystring_t execute; // Console command. +} ded_state_t; + +typedef struct ded_lightmap_s { + ded_stringid_t id; + unsigned int tex; // Runtime +} ded_lightmap_t; + +typedef struct ded_flaremap_s { + ded_stringid_t id; + unsigned int tex; // Runtime + boolean custom; // If true tex = custom flare else flaretexname + boolean disabled; /* As zero = automatic and flare ids + are unsigned we need an extra flag + to indicate when id == "-" */ +} ded_flaremap_t; + +typedef struct { + ded_stateid_t state; + char uniqueMapID[64]; + float offset[3]; /* Origin offset in world coords + Zero means automatic */ + float size; // Zero: automatic + float color[3]; // Red Green Blue (0,1) + float lightLevel[2]; // Min/max lightlevel for bias + ded_flags_t flags; + ded_lightmap_t up, down, sides; + ded_flaremap_t flare; + float haloRadius; // Halo radius (zero = no halo). +} ded_light_t; + +typedef struct { + ded_path_t filename; + ded_path_t skinFilename; // Optional; override model's skin. + ded_string_t frame; + int frameRange; + ded_flags_t flags; // ASCII string of the flags. + int skin; + int skinRange; + float offset[3]; // Offset XYZ within model. + float alpha; + float parm; // Custom parameter. + unsigned char selSkinBits[2]; // Mask and offset. + unsigned char selSkins[8]; + ded_string_t shinySkin; + float shiny; + float shinyColor[3]; + float shinyReact; + blendmode_t blendMode; // bm_* +} ded_submodel_t; + +typedef struct { + ded_stringid_t id; // Optional identifier for the definition. + ded_stateid_t state; + int off; + ded_sprid_t sprite; // Only used by autoscale. + int spriteFrame; // Only used by autoscale. + ded_flags_t group; + int selector; + ded_flags_t flags; + float interMark; + float interRange[2]; // 0-1 by default. + int skinTics; // Tics per skin in range. + float scale[3]; // Scale XYZ + float resize; + float offset[3]; // Offset XYZ + float shadowRadius; // Radius for shadow (0=auto). + ded_submodel_t sub[DED_MAX_SUB_MODELS]; +} ded_model_t; + +typedef struct { + ded_soundid_t id; // ID of this sound, refered to by others. + ded_string_t lumpName; /* Actual lump name of the sound + ("DS" not included). */ + ded_string_t name; // A tag name for the sound. + ded_soundid_t link; // Link to another sound. + int linkPitch; + int linkVolume; + int priority; // Priority classification. + int channels; // Max number of channels to occupy. + int group; // Exclusion group. + ded_flags_t flags; // Flags (like chg_pitch). + ded_path_t ext; // External sound file (WAV). +} ded_sound_t; + +typedef struct { + ded_musicid_t id; // ID of this piece of music. + ded_string_t lumpName; // Lump name. + ded_path_t path; // External file (not a normal MUS file). + int cdTrack; // 0 = no track. +} ded_music_t; + +typedef struct { + ded_flags_t flags; + ded_string_t texture; + float offset; + float colorLimit; +} ded_skylayer_t; + +typedef struct ded_skymodel_s { + ded_stringid_t id; + int layer; // Defaults to -1. + float frameInterval; // Seconds per frame. + float yaw; + float yawSpeed; // Angles per second. + float coordFactor[3]; + float rotate[2]; + ded_anystring_t execute; // Executed on every frame change. + float color[4]; // RGBA +} ded_skymodel_t; #define NUM_SKY_LAYERS 2 #define NUM_SKY_MODELS 32 - typedef struct ded_mapinfo_s { - ded_stringid_t id; // ID of the map (e.g. E2M3 or MAP21). - char name[64]; // Name of the map. - ded_string_t author; // Author of the map. - ded_flags_t flags; // Flags. - ded_musicid_t music; // Music to play. - float parTime; // Par time, in seconds. - float fogColor[3]; // Fog color (RGB). - float fogStart; - float fogEnd; - float fogDensity; - float ambient; // Ambient light level. - float gravity; // 1 = normal. - float skyHeight; - float horizonOffset; - float skyColor[3]; // Color of sky-lit sectors. - ded_skylayer_t skyLayers[NUM_SKY_LAYERS]; - ded_skymodel_t skyModels[NUM_SKY_MODELS]; - ded_anystring_t execute; /* Executed during map setup - (savegames, too). */ - } ded_mapinfo_t; - - typedef struct { - ded_stringid_t id; - char *text; - } ded_text_t; - - typedef struct { - ded_stringid_t id; - ded_count_t texCount; - ded_str_t *textures; - ded_count_t flatCount; - ded_str_t *flats; - } ded_tenviron_t; - - typedef struct { - char *id; - char *text; - } ded_value_t; - - typedef struct { - ded_stringid_t id; - ded_stringid_t before; - ded_stringid_t after; - char *script; - } ded_finale_t; - - typedef struct { - int id; - char comment[64]; - ded_flags_t flags[3]; - ded_flags_t lineClass; - ded_flags_t actType; - int actCount; - float actTime; - int actTag; - int aparm[9]; - //ded_stringid_t aparm_str[3]; // aparms 4, 6, 9 - ded_stringid_t aparm9; - float tickerStart; - float tickerEnd; - int tickerInterval; - ded_soundid_t actSound; - ded_soundid_t deactSound; - int evChain; - int actChain; - int deactChain; - int actLineType; - int deactLineType; - ded_flags_t wallSection; - ded_stringid_t actMaterial; - ded_stringid_t deactMaterial; - char actMsg[128]; - char deactMsg[128]; - float materialMoveAngle; - float materialMoveSpeed; - int iparm[20]; - char iparmStr[20][64]; - float fparm[20]; - char sparm[5][128]; - } ded_linetype_t; - - typedef struct { - int id; - char comment[64]; - ded_flags_t flags; - int actTag; - int chain[5]; - ded_flags_t chainFlags[5]; - float start[5]; - float end[5]; - float interval[5][2]; - int count[5]; - ded_soundid_t ambientSound; - float soundInterval[2]; // min,max - float materialMoveAngle[2]; // floor, ceil - float materialMoveSpeed[2]; // floor, ceil - float windAngle; - float windSpeed; - float verticalWind; - float gravity; - float friction; - ded_func_t lightFunc; - int lightInterval[2]; - ded_func_t colFunc[3]; // RGB - int colInterval[3][2]; - ded_func_t floorFunc; - float floorMul, floorOff; - int floorInterval[2]; - ded_func_t ceilFunc; - float ceilMul, ceilOff; - int ceilInterval[2]; - } ded_sectortype_t; - - typedef struct { - ded_string_t texture; // Name of a texture. - ded_string_t flat; // Name of a flat. - ded_path_t detailLump; // The lump with the detail texture. - boolean isExternal; // True, if detailLump is external. - float scale; - float strength; - float maxDist; - } ded_detailtexture_t; - - // Embedded sound information. - typedef struct ded_embsound_s { - ded_string_t name; - int id; // Figured out at runtime. - float volume; - } ded_embsound_t; - - typedef struct { - ded_flags_t type; - int tics; - float variance; // Stage variance (time). - float color[4]; // RGBA - float radius; - float radiusVariance; - ded_flags_t flags; - float bounce; - float resistance; // Air resistance. - float gravity; - float vectorForce[3]; - float spin[2]; // Yaw and pitch. - float spinResistance[2]; // Yaw and pitch. - int model; - ded_string_t frameName; // For model particles. - ded_string_t endFrameName; - short frame, endFrame; - ded_embsound_t sound, hitSound; - } ded_ptcstage_t; - - typedef struct ded_ptcgen_s { - struct ded_ptcgen_s *stateNext; // List of generators for a state. - ded_stateid_t state; // Triggered by this state (if mobj-gen). - ded_string_t materialName; - materialgroup_t materialGroup; - ded_mobjid_t type; // Triggered by this type of mobjs. - ded_mobjid_t type2; // Also triggered by this type. - int typeNum; - int type2Num; - ded_mobjid_t damage; // Triggered by mobj damage of this type. - int damageNum; - ded_string_t map; // Triggered by this map (or empty string). - ded_flags_t flags; - float speed; // Particle spawn velocity. - float speedVariance; // Spawn speed variance (0-1). - float vector[3]; // Particle launch vector. - float vectorVariance; // Launch vector variance (0-1). 1=totally random. - float initVectorVariance; // Initial launch vector variance (0-1). - float center[3]; // Offset to the mobj (relat. to source). - int subModel; // Model source: origin submodel #. - float spawnRadius; - float spawnRadiusMin; // Spawn uncertainty box. - float maxDist; // Max visibility for particles. - int spawnAge; // How long until spawning stops? - int maxAge; // How long until generator dies? - int particles; // Maximum number of particles. - float spawnRate; // Particles spawned per tic. - float spawnRateVariance; - int preSim; // Tics to pre-simulate when spawned. - int altStart; - float altStartVariance; // Probability for alt start. - float force; // Radial strength of the sphere force. - float forceRadius; // Radius of the sphere force. - float forceAxis[3]; /* Rotation axis of the sphere force - (+ speed). */ - float forceOrigin[3]; // Offset for the force sphere. - ded_ptcstage_t *stages; - ded_count_t stageCount; - } ded_ptcgen_t; - - typedef struct ded_decorlight_s { - float pos[2]; // Coordinates on the surface. - float elevation; // Distance from the surface. - float color[3]; // Light color. - float radius; // Dynamic light radius (-1 = no light). - float haloRadius; // Halo radius (zero = no halo). - int patternOffset[2]; - int patternSkip[2]; - float lightLevels[2]; // Fade by sector lightlevel. - int flareTexture; - ded_lightmap_t up, down, sides; - ded_flaremap_t flare; // Overrides flare_texture - } ded_decorlight_t; - - // There is a fixed number of light decorations in each decoration. +typedef struct ded_mapinfo_s { + ded_stringid_t id; // ID of the map (e.g. E2M3 or MAP21). + char name[64]; // Name of the map. + ded_string_t author; // Author of the map. + ded_flags_t flags; // Flags. + ded_musicid_t music; // Music to play. + float parTime; // Par time, in seconds. + float fogColor[3]; // Fog color (RGB). + float fogStart; + float fogEnd; + float fogDensity; + float ambient; // Ambient light level. + float gravity; // 1 = normal. + float skyHeight; + float horizonOffset; + float skyColor[3]; // Color of sky-lit sectors. + ded_skylayer_t skyLayers[NUM_SKY_LAYERS]; + ded_skymodel_t skyModels[NUM_SKY_MODELS]; + ded_anystring_t execute; // Executed during map setup (savegames, too). +} ded_mapinfo_t; + +typedef struct { + ded_stringid_t id; + char* text; +} ded_text_t; + +typedef struct { + ded_stringid_t id; + ded_count_t texCount; + ded_str_t* textures; + ded_count_t flatCount; + ded_str_t* flats; +} ded_tenviron_t; + +typedef struct { + char* id; + char* text; +} ded_value_t; + +typedef struct { + ded_stringid_t id; + ded_stringid_t before; + ded_stringid_t after; + char* script; +} ded_finale_t; + +typedef struct { + int id; + char comment[64]; + ded_flags_t flags[3]; + ded_flags_t lineClass; + ded_flags_t actType; + int actCount; + float actTime; + int actTag; + int aparm[9]; + //ded_stringid_t aparm_str[3]; // aparms 4, 6, 9 + ded_stringid_t aparm9; + float tickerStart; + float tickerEnd; + int tickerInterval; + ded_soundid_t actSound; + ded_soundid_t deactSound; + int evChain; + int actChain; + int deactChain; + int actLineType; + int deactLineType; + ded_flags_t wallSection; + ded_stringid_t actMaterial; + ded_stringid_t deactMaterial; + char actMsg[128]; + char deactMsg[128]; + float materialMoveAngle; + float materialMoveSpeed; + int iparm[20]; + char iparmStr[20][64]; + float fparm[20]; + char sparm[5][128]; +} ded_linetype_t; + +typedef struct { + int id; + char comment[64]; + ded_flags_t flags; + int actTag; + int chain[5]; + ded_flags_t chainFlags[5]; + float start[5]; + float end[5]; + float interval[5][2]; + int count[5]; + ded_soundid_t ambientSound; + float soundInterval[2]; // min,max + float materialMoveAngle[2]; // floor, ceil + float materialMoveSpeed[2]; // floor, ceil + float windAngle; + float windSpeed; + float verticalWind; + float gravity; + float friction; + ded_func_t lightFunc; + int lightInterval[2]; + ded_func_t colFunc[3]; // RGB + int colInterval[3][2]; + ded_func_t floorFunc; + float floorMul, floorOff; + int floorInterval[2]; + ded_func_t ceilFunc; + float ceilMul, ceilOff; + int ceilInterval[2]; +} ded_sectortype_t; + +typedef struct { + ded_string_t materialName1; + materialgroup_t materialGroup1; + ded_string_t materialName2; + materialgroup_t materialGroup2; + ded_flags_t flags; + ded_path_t detailLump; // The lump with the detail texture. + boolean isExternal; // True, if detailLump is external. + float scale; + float strength; + float maxDist; +} ded_detailtexture_t; + +// Embedded sound information. +typedef struct ded_embsound_s { + ded_string_t name; + int id; // Figured out at runtime. + float volume; +} ded_embsound_t; + +typedef struct { + ded_flags_t type; + int tics; + float variance; // Stage variance (time). + float color[4]; // RGBA + float radius; + float radiusVariance; + ded_flags_t flags; + float bounce; + float resistance; // Air resistance. + float gravity; + float vectorForce[3]; + float spin[2]; // Yaw and pitch. + float spinResistance[2]; // Yaw and pitch. + int model; + ded_string_t frameName; // For model particles. + ded_string_t endFrameName; + short frame, endFrame; + ded_embsound_t sound, hitSound; +} ded_ptcstage_t; + +typedef struct ded_ptcgen_s { + struct ded_ptcgen_s* stateNext; // List of generators for a state. + ded_stateid_t state; // Triggered by this state (if mobj-gen). + ded_string_t materialName; + materialgroup_t materialGroup; + ded_mobjid_t type; // Triggered by this type of mobjs. + ded_mobjid_t type2; // Also triggered by this type. + int typeNum; + int type2Num; + ded_mobjid_t damage; // Triggered by mobj damage of this type. + int damageNum; + ded_string_t map; // Triggered by this map (or empty string). + ded_flags_t flags; + float speed; // Particle spawn velocity. + float speedVariance; // Spawn speed variance (0-1). + float vector[3]; // Particle launch vector. + float vectorVariance; // Launch vector variance (0-1). 1=totally random. + float initVectorVariance; // Initial launch vector variance (0-1). + float center[3]; // Offset to the mobj (relat. to source). + int subModel; // Model source: origin submodel #. + float spawnRadius; + float spawnRadiusMin; // Spawn uncertainty box. + float maxDist; // Max visibility for particles. + int spawnAge; // How long until spawning stops? + int maxAge; // How long until generator dies? + int particles; // Maximum number of particles. + float spawnRate; // Particles spawned per tic. + float spawnRateVariance; + int preSim; // Tics to pre-simulate when spawned. + int altStart; + float altStartVariance; // Probability for alt start. + float force; // Radial strength of the sphere force. + float forceRadius; // Radius of the sphere force. + float forceAxis[3]; /* Rotation axis of the sphere force + (+ speed). */ + float forceOrigin[3]; // Offset for the force sphere. + ded_ptcstage_t* stages; + ded_count_t stageCount; +} ded_ptcgen_t; + +typedef struct ded_decorlight_s { + float pos[2]; // Coordinates on the surface. + float elevation; // Distance from the surface. + float color[3]; // Light color. + float radius; // Dynamic light radius (-1 = no light). + float haloRadius; // Halo radius (zero = no halo). + int patternOffset[2]; + int patternSkip[2]; + float lightLevels[2]; // Fade by sector lightlevel. + int flareTexture; + ded_lightmap_t up, down, sides; + ded_flaremap_t flare; // Overrides flare_texture +} ded_decorlight_t; + +// There is a fixed number of light decorations in each decoration. #define DED_DECOR_NUM_LIGHTS 16 - typedef struct ded_decormodel_s { - float pos[2]; // Coordinates on the surface. - float elevation; // Distance from the surface. - int patternOffset[2]; - int patternSkip[2]; - float lightLevels[2]; // Fade by sector lightlevel. - ded_stringid_t id; - float frameInterval; // Seconds per frame. - } ded_decormodel_t; - - // There is a fixed number of model decorations in each decoration. +typedef struct ded_decormodel_s { + float pos[2]; // Coordinates on the surface. + float elevation; // Distance from the surface. + int patternOffset[2]; + int patternSkip[2]; + float lightLevels[2]; // Fade by sector lightlevel. + ded_stringid_t id; + float frameInterval; // Seconds per frame. +} ded_decormodel_t; + +// There is a fixed number of model decorations in each decoration. #define DED_DECOR_NUM_MODELS 8 - typedef struct ded_decor_s { - ded_string_t materialName; - materialgroup_t materialGroup; - int glow; - ded_flags_t flags; - ded_decorlight_t lights[DED_DECOR_NUM_LIGHTS]; - ded_decormodel_t models[DED_DECOR_NUM_MODELS]; - } ded_decor_t; - - typedef struct ded_reflection_s { - ded_string_t materialName; - materialgroup_t materialGroup; - blendmode_t blendMode; // Blend mode flags (bm_*). - float shininess; - float minColor[3]; - ded_path_t shinyMap; - ded_path_t maskMap; - float maskWidth; - float maskHeight; - - // Runtime data for handling the textures. This is a bit - // convoluted. The goal is to load each map texture only - // once. The 'use' pointers point to the first - // ded_reflection_t that uses the same map as this one. - unsigned int shinyTex; - unsigned int maskTex; - struct ded_reflection_s *useShiny; - struct ded_reflection_s *useMask; - } ded_reflection_t; - - typedef struct ded_group_member_s { - char name[9]; - int type; - float tics; - float randomTics; - } ded_group_member_t; - - typedef struct ded_group_s { - ded_flags_t flags; - ded_count_t count; - ded_group_member_t *members; - } ded_group_t; - - // The ded_t structure encapsulates all the data one definition file - // can contain. This is only an internal representation of the data. - // An ASCII version is written and read by DED_Write() and DED_Read() - // routines. - - // It is VERY important not to sort the data arrays in any way: the - // index numbers are important. The Game DLL must be recompiled with the - // new constants if the order of the array items changes. - - typedef struct ded_s { - int version; // DED version number. - char modelPath[256]; // Directories for searching MD2s. - ded_flags_t modelFlags; // Default values for models. - float modelScale; - float modelOffset; - - struct ded_counts_s { - ded_count_t flags; - ded_count_t mobjs; - ded_count_t states; - ded_count_t sprites; - ded_count_t lights; - ded_count_t models; - ded_count_t sounds; - ded_count_t music; - ded_count_t mapInfo; - ded_count_t text; - ded_count_t textureEnv; - ded_count_t values; - ded_count_t details; - ded_count_t ptcGens; - ded_count_t finales; - ded_count_t decorations; - ded_count_t reflections; - ded_count_t groups; - ded_count_t lineTypes; - ded_count_t sectorTypes; - ded_count_t xgClasses; - } count; - - // Flag values (for all types of data). - ded_flag_t *flags; - - // Map object information. - ded_mobj_t *mobjs; - - // States. - ded_state_t *states; - - // Sprites. - ded_sprid_t *sprites; - - // Lights. - ded_light_t *lights; - - // Models. - ded_model_t *models; - - // Sounds. - ded_sound_t *sounds; - - // Music. - ded_music_t *music; - - // Map information. - ded_mapinfo_t *mapInfo; - - // Text. - ded_text_t *text; - - // Aural environments for textures. - ded_tenviron_t *textureEnv; - - // Free-from string values. - ded_value_t *values; - - // Detail texture assignments. - ded_detailtexture_t *details; - - // Particle generators. - ded_ptcgen_t *ptcGens; - - // Finales. - ded_finale_t *finales; - - // Decorations. - ded_decor_t *decorations; - - // Reflections. - ded_reflection_t *reflections; - - // Texture groups. - ded_group_t *groups; - - // XG line types. - ded_linetype_t *lineTypes; - - // XG sector types. - ded_sectortype_t *sectorTypes; - - // XG Classes - ded_xgclass_t *xgClasses; - } ded_t; - - // Routines for managing DED files. - void DED_Init(ded_t *ded); - void DED_Destroy(ded_t *ded); - int DED_Read(ded_t *ded, const char *sPathName); - int DED_ReadLump(ded_t *ded, int lump); - - int DED_AddFlag(ded_t *ded, char *name, char *text, int value); - int DED_AddMobj(ded_t *ded, char *idstr); - int DED_AddState(ded_t *ded, char *id); - int DED_AddSprite(ded_t *ded, const char *name); - int DED_AddLight(ded_t *ded, const char *stateid); - int DED_AddModel(ded_t *ded, char *spr); - int DED_AddSound(ded_t *ded, char *id); - int DED_AddMusic(ded_t *ded, char *id); - int DED_AddMapInfo(ded_t *ded, char *str); - int DED_AddText(ded_t *ded, char *id); - int DED_AddTextureEnv(ded_t *ded, char *id); - int DED_AddValue(ded_t *ded, const char *id); - int DED_AddDetail(ded_t *ded, const char *lumpname); - int DED_AddPtcGen(ded_t *ded, const char *state); - int DED_AddPtcGenStage(ded_ptcgen_t *gen); - int DED_AddFinale(ded_t *ded); - int DED_AddDecoration(ded_t *ded); - int DED_AddReflection(ded_t *ded); - int DED_AddGroup(ded_t *ded); - int DED_AddGroupMember(ded_group_t *grp); - int DED_AddSectorType(ded_t *ded, int id); - int DED_AddLineType(ded_t *ded, int id); - int DED_AddXGClass(ded_t *ded); - int DED_AddXGClassProperty(ded_xgclass_t *xgc); - - void DED_RemoveFlag(ded_t *ded, int index); - void DED_RemoveMobj(ded_t *ded, int index); - void DED_RemoveState(ded_t *ded, int index); - void DED_RemoveSprite(ded_t *ded, int index); - void DED_RemoveLight(ded_t *ded, int index); - void DED_RemoveModel(ded_t *ded, int index); - void DED_RemoveSound(ded_t *ded, int index); - void DED_RemoveMusic(ded_t *ded, int index); - void DED_RemoveMapInfo(ded_t *ded, int index); - void DED_RemoveText(ded_t *ded, int index); - void DED_RemoveTextureEnv(ded_t *ded, int index); - void DED_RemoveValue(ded_t *ded, int index); - void DED_RemoveDetail(ded_t *ded, int index); - void DED_RemovePtcGen(ded_t *ded, int index); - void DED_RemoveFinale(ded_t *ded, int index); - void DED_RemoveDecoration(ded_t *ded, int index); - void DED_RemoveReflection(ded_t *ded, int index); - void DED_RemoveGroup(ded_t *ded, int index); - void DED_RemoveSectorType(ded_t *ded, int index); - void DED_RemoveLineType(ded_t *ded, int index); - void DED_RemoveXGClass(ded_t *ded, int index); - - void *DED_NewEntries(void **ptr, ded_count_t *cnt, - size_t elemSize, int count); - void *DED_NewEntry(void **ptr, ded_count_t *cnt, size_t elemSize); - void DED_DelEntry(int index, void **ptr, ded_count_t *cnt, - size_t elemSize); - void DED_DelArray(void **ptr, ded_count_t *cnt); - void DED_ZCount(ded_count_t *c); - - extern char dedReadError[]; +typedef struct ded_decor_s { + ded_string_t materialName; + materialgroup_t materialGroup; + int glow; + ded_flags_t flags; + ded_decorlight_t lights[DED_DECOR_NUM_LIGHTS]; + ded_decormodel_t models[DED_DECOR_NUM_MODELS]; +} ded_decor_t; + +typedef struct ded_reflection_s { + ded_string_t materialName; + materialgroup_t materialGroup; + ded_flags_t flags; + blendmode_t blendMode; // Blend mode flags (bm_*). + float shininess; + float minColor[3]; + ded_path_t shinyMap; + ded_path_t maskMap; + float maskWidth; + float maskHeight; + + // Runtime data for handling the textures. This is a bit + // convoluted. The goal is to load each map texture only + // once. The 'use' pointers point to the first + // ded_reflection_t that uses the same map as this one. + unsigned int shinyTex; + unsigned int maskTex; + struct ded_reflection_s* useShiny; + struct ded_reflection_s* useMask; +} ded_reflection_t; + +typedef struct ded_group_member_s { + char name[9]; + int type; + float tics; + float randomTics; +} ded_group_member_t; + +typedef struct ded_group_s { + ded_flags_t flags; + ded_count_t count; + ded_group_member_t* members; +} ded_group_t; + +// The ded_t structure encapsulates all the data one definition file +// can contain. This is only an internal representation of the data. +// An ASCII version is written and read by DED_Write() and DED_Read() +// routines. + +// It is VERY important not to sort the data arrays in any way: the +// index numbers are important. The Game DLL must be recompiled with the +// new constants if the order of the array items changes. + +typedef struct ded_s { + int version; // DED version number. + char modelPath[256]; // Directories for searching MD2s. + ded_flags_t modelFlags; // Default values for models. + float modelScale; + float modelOffset; + + struct ded_counts_s { + ded_count_t flags; + ded_count_t mobjs; + ded_count_t states; + ded_count_t sprites; + ded_count_t lights; + ded_count_t models; + ded_count_t sounds; + ded_count_t music; + ded_count_t mapInfo; + ded_count_t text; + ded_count_t textureEnv; + ded_count_t values; + ded_count_t details; + ded_count_t ptcGens; + ded_count_t finales; + ded_count_t decorations; + ded_count_t reflections; + ded_count_t groups; + ded_count_t lineTypes; + ded_count_t sectorTypes; + ded_count_t xgClasses; + } count; + + // Flag values (for all types of data). + ded_flag_t* flags; + + // Map object information. + ded_mobj_t* mobjs; + + // States. + ded_state_t* states; + + // Sprites. + ded_sprid_t* sprites; + + // Lights. + ded_light_t* lights; + + // Models. + ded_model_t* models; + + // Sounds. + ded_sound_t* sounds; + + // Music. + ded_music_t* music; + + // Map information. + ded_mapinfo_t* mapInfo; + + // Text. + ded_text_t* text; + + // Aural environments for textures. + ded_tenviron_t* textureEnv; + + // Free-from string values. + ded_value_t* values; + + // Detail texture assignments. + ded_detailtexture_t* details; + + // Particle generators. + ded_ptcgen_t* ptcGens; + + // Finales. + ded_finale_t* finales; + + // Decorations. + ded_decor_t* decorations; + + // Reflections. + ded_reflection_t* reflections; + + // Texture groups. + ded_group_t* groups; + + // XG line types. + ded_linetype_t* lineTypes; + + // XG sector types. + ded_sectortype_t* sectorTypes; + + // XG Classes + ded_xgclass_t* xgClasses; +} ded_t; + +// Routines for managing DED files. +void DED_Init(ded_t* ded); +void DED_Destroy(ded_t* ded); +int DED_Read(ded_t* ded, const char* sPathName); +int DED_ReadLump(ded_t* ded, int lump); + +int DED_AddFlag(ded_t* ded, char* name, char* text, int value); +int DED_AddMobj(ded_t* ded, char* idStr); +int DED_AddState(ded_t* ded, char* id); +int DED_AddSprite(ded_t* ded, const char* name); +int DED_AddLight(ded_t* ded, const char* stateID); +int DED_AddModel(ded_t* ded, char* spr); +int DED_AddSound(ded_t* ded, char* id); +int DED_AddMusic(ded_t* ded, char* id); +int DED_AddMapInfo(ded_t* ded, char* str); +int DED_AddText(ded_t* ded, char* id); +int DED_AddTextureEnv(ded_t* ded, char* id); +int DED_AddValue(ded_t *ded, const char* id); +int DED_AddDetail(ded_t* ded, const char* lumpname); +int DED_AddPtcGen(ded_t* ded, const char* state); +int DED_AddPtcGenStage(ded_ptcgen_t* gen); +int DED_AddFinale(ded_t* ded); +int DED_AddDecoration(ded_t* ded); +int DED_AddReflection(ded_t* ded); +int DED_AddGroup(ded_t* ded); +int DED_AddGroupMember(ded_group_t* grp); +int DED_AddSectorType(ded_t* ded, int id); +int DED_AddLineType(ded_t* ded, int id); +int DED_AddXGClass(ded_t* ded); +int DED_AddXGClassProperty(ded_xgclass_t* xgc); + +void DED_RemoveFlag(ded_t* ded, int index); +void DED_RemoveMobj(ded_t* ded, int index); +void DED_RemoveState(ded_t* ded, int index); +void DED_RemoveSprite(ded_t* ded, int index); +void DED_RemoveLight(ded_t* ded, int index); +void DED_RemoveModel(ded_t* ded, int index); +void DED_RemoveSound(ded_t* ded, int index); +void DED_RemoveMusic(ded_t* ded, int index); +void DED_RemoveMapInfo(ded_t* ded, int index); +void DED_RemoveText(ded_t* ded, int index); +void DED_RemoveTextureEnv(ded_t* ded, int index); +void DED_RemoveValue(ded_t* ded, int index); +void DED_RemoveDetail(ded_t* ded, int index); +void DED_RemovePtcGen(ded_t* ded, int index); +void DED_RemoveFinale(ded_t* ded, int index); +void DED_RemoveDecoration(ded_t* ded, int index); +void DED_RemoveReflection(ded_t* ded, int index); +void DED_RemoveGroup(ded_t* ded, int index); +void DED_RemoveSectorType(ded_t* ded, int index); +void DED_RemoveLineType(ded_t* ded, int index); +void DED_RemoveXGClass(ded_t* ded, int index); + +void* DED_NewEntries(void** ptr, ded_count_t* cnt, + size_t elemSize, int count); +void* DED_NewEntry(void** ptr, ded_count_t* cnt, size_t elemSize); +void DED_DelEntry(int index, void** ptr, ded_count_t* cnt, + size_t elemSize); +void DED_DelArray(void** ptr, ded_count_t* cnt); +void DED_ZCount(ded_count_t* c); + +extern char dedReadError[]; #ifdef __cplusplus } diff --git a/doomsday/engine/portable/include/def_main.h b/doomsday/engine/portable/include/def_main.h index 409d6998e9..f7bd99fd59 100644 --- a/doomsday/engine/portable/include/def_main.h +++ b/doomsday/engine/portable/include/def_main.h @@ -85,8 +85,8 @@ int Def_EvalFlags(char* ptr); ded_mapinfo_t* Def_GetMapInfo(const char* mapID); ded_light_t* Def_GetLightDef(int spr, int frame); ded_decor_t* Def_GetDecoration(struct material_s* mat, boolean hasExt); -ded_reflection_t* Def_GetReflection(struct material_s* mat); -ded_detailtexture_t* Def_GetDetailTex(struct material_s* mat); +ded_reflection_t* Def_GetReflection(struct material_s* mat, boolean hasExt); +ded_detailtexture_t* Def_GetDetailTex(struct material_s* mat, boolean hasExt); int Def_Get(int type, char* id, void* out); boolean Def_SameStateSequence(state_t* snew, state_t* sold); void Def_LightMapLoaded(const char* id, uint texture); diff --git a/doomsday/engine/portable/src/def_main.c b/doomsday/engine/portable/src/def_main.c index bec4133e44..6ab29ae5be 100644 --- a/doomsday/engine/portable/src/def_main.c +++ b/doomsday/engine/portable/src/def_main.c @@ -424,13 +424,7 @@ ded_decor_t* Def_GetDecoration(struct material_s* mat, boolean hasExt) return 0; } -/** - * Currently reflections cannot specify any conditions when it is - * appropriate to use them: if a high-resolution texture or a custom patch - * overrides the texture that the reflection was meant to be used with, - * nothing is done to react to the situation. - */ -ded_reflection_t* Def_GetReflection(struct material_s* mat) +ded_reflection_t* Def_GetReflection(struct material_s* mat, boolean hasExt) { int i; ded_reflection_t* def; @@ -443,17 +437,16 @@ ded_reflection_t* Def_GetReflection(struct material_s* mat) def->materialGroup)); if(mat == defMat) { - // It would be great to have a unified system that would - // determine whether effects such as decorations and - // reflections are allowed for a certain resource... - return def; + // Is this suitable? + if(R_IsAllowedReflection(def, mat, hasExt)) + return def; } } return NULL; } -ded_detailtexture_t* Def_GetDetailTex(struct material_s* mat) +ded_detailtexture_t* Def_GetDetailTex(struct material_s* mat, boolean hasExt) { int i; ded_detailtexture_t* def; @@ -462,17 +455,24 @@ ded_detailtexture_t* Def_GetDetailTex(struct material_s* mat) for(i = defs.count.details.num - 1, def = defs.details + i; i >= 0; i--, def--) { - material_t* defMat; - - defMat = R_GetMaterialByNum( - R_MaterialNumForName(def->texture, MG_TEXTURES)); - if(!(defMat == mat)) - defMat = R_GetMaterialByNum( - R_MaterialNumForName(def->flat, MG_FLATS)); + material_t* defMat = + R_GetMaterialByNum(R_MaterialNumForName(def->materialName1, + def->materialGroup1)); + if(mat == defMat) + { + // Is this sutiable? + if(R_IsAllowedDetailTex(def, mat, hasExt)) + return def; + } - if(defMat == mat) + defMat = + R_GetMaterialByNum(R_MaterialNumForName(def->materialName2, + def->materialGroup2)); + if(mat == defMat) { - return def; + // Is this sutiable? + if(R_IsAllowedDetailTex(def, mat, hasExt)) + return def; } } @@ -887,7 +887,7 @@ void Def_Read(void) if(k < 0) { // It's probably a bias light definition, then? - if(!defs.lights[i].level[0]) + if(!defs.lights[i].uniqueMapID[0]) { Con_Message("Def_Read: Lights: Undefined state '%s'.\n", defs.lights[i].state); @@ -1102,8 +1102,15 @@ void Def_PostInit(void) { ded_detailtexture_t* def = &defs.details[i]; - if(R_MaterialCheckNumForName(def->texture, MG_TEXTURES) || - R_MaterialCheckNumForName(def->flat, MG_FLATS)) + if(!strnicmp(def->materialName1, "FIRELAV2", 8) || + !strnicmp(def->materialName2, "FIRELAV3", 8) || + !strnicmp(def->materialName2, "FIRELAVA", 8)) + { + int n = 3; + n++; + } + if(R_MaterialCheckNumForName(def->materialName1, def->materialGroup1) || + R_MaterialCheckNumForName(def->materialName2, def->materialGroup2)) { R_CreateDetailTexture(def); } diff --git a/doomsday/engine/portable/src/def_read.c b/doomsday/engine/portable/src/def_read.c index 987f63058e..fe898b8b70 100644 --- a/doomsday/engine/portable/src/def_read.c +++ b/doomsday/engine/portable/src/def_read.c @@ -70,10 +70,10 @@ #define READSTR(X) if(!ReadString(X, sizeof(X))) { \ SetError("Syntax error in string value."); \ - retval = false; goto ded_end_read; } + retVal = false; goto ded_end_read; } #define MISSING_SC_ERROR SetError("Missing semicolon."); \ - retval = false; goto ded_end_read; + retVal = false; goto ded_end_read; #define CHECKSC if(source->version <= 5) { ReadToken(); if(!ISTOKEN(";")) { MISSING_SC_ERROR; } } @@ -82,12 +82,12 @@ #define ISLABEL(X) (!stricmp(label, X)) -#define READLABEL if(!ReadLabel(label)) { retval = false; goto ded_end_read; } \ +#define READLABEL if(!ReadLabel(label)) { retVal = false; goto ded_end_read; } \ if(ISLABEL("}")) break; -#define READLABEL_NOBREAK if(!ReadLabel(label)) { retval = false; goto ded_end_read; } +#define READLABEL_NOBREAK if(!ReadLabel(label)) { retVal = false; goto ded_end_read; } -#define FAILURE retval = false; goto ded_end_read; +#define FAILURE retVal = false; goto ded_end_read; #define READBYTE(X) if(!ReadByte(&X)) { FAILURE } #define READINT(X) if(!ReadInt(&X, false)) { FAILURE } #define READUINT(X) if(!ReadInt(&X, true)) { FAILURE } @@ -111,7 +111,7 @@ #define RV_FLAGS(lab, X, P) if(ISLABEL(lab)) { READFLAGS(X, P); } else #define RV_BLENDMODE(lab, X) if(ISLABEL(lab)) { READBLENDMODE(X); } else #define RV_ANYSTR(lab, X) if(ISLABEL(lab)) { if(!ReadAnyString(&X)) { FAILURE } } else -#define RV_END { SetError2("Unknown label.", label); retval = false; goto ded_end_read; } +#define RV_END { SetError2("Unknown label.", label); retVal = false; goto ded_end_read; } #define RV_XGIPARM(lab, S, I, IP) if(ISLABEL(lab)) { \ if(xgClassLinks[l->lineClass].iparm[IP].flagPrefix && \ @@ -124,12 +124,12 @@ // TYPES ------------------------------------------------------------------- typedef struct dedsource_s { - char *buffer; - char *pos; - boolean atEnd; - int lineNumber; - const char *fileName; - int version; // v6 does not require semicolons. + char* buffer; + char* pos; + boolean atEnd; + int lineNumber; + const char* fileName; + int version; // v6 does not require semicolons. } dedsource_t; // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- @@ -141,41 +141,42 @@ typedef struct dedsource_s { // EXTERNAL DATA DECLARATIONS ---------------------------------------------- // the actual classes are game-side -extern xgclass_t *xgClassLinks; +extern xgclass_t* xgClassLinks; // PUBLIC DATA DEFINITIONS ------------------------------------------------- -char dedReadError[512]; +char dedReadError[512]; // PRIVATE DATA DEFINITIONS ------------------------------------------------ static dedsource_t sourceStack[MAX_RECUR_DEPTH]; -static dedsource_t *source; // Points to the current source. +static dedsource_t* source; // Points to the current source. -static char token[128]; -static char unreadToken[128]; +static char token[128]; +static char unreadToken[128]; // CODE -------------------------------------------------------------------- -static char *sdup(const char *str) +static char* sdup(const char* str) { - char *newstr; + char* newstr; if(!str) return NULL; + newstr = M_Malloc(strlen(str) + 1); strcpy(newstr, str); return newstr; } -static void SetError(char *str) +static void SetError(char* str) { sprintf(dedReadError, "Error in %s:\n Line %i: %s", source ? source->fileName : "?", source ? source->lineNumber : 0, str); } -static void SetError2(char *str, char *more) +static void SetError2(char* str, char* more) { sprintf(dedReadError, "Error in %s:\n Line %i: %s (%s)", source ? source->fileName : "?", source ? source->lineNumber : 0, @@ -188,7 +189,7 @@ static void SetError2(char *str, char *more) */ static int FGetC(void) { - int ch = (unsigned char) *source->pos; + int ch = (unsigned char) *source->pos; if(ch) source->pos++; @@ -198,6 +199,7 @@ static int FGetC(void) source->lineNumber++; if(ch == '\r') return FGetC(); + return ch; } @@ -212,6 +214,7 @@ static int FUngetC(int ch) source->lineNumber--; if(source->pos > source->buffer) source->pos--; + return ch; } @@ -220,16 +223,17 @@ static int FUngetC(int ch) */ static void SkipComment(void) { - int ch = FGetC(); - boolean seq = false; + int ch = FGetC(); + boolean seq = false; if(ch == '\n') - return; // Comment ends right away. - if(ch != '>') // Single-line comment? + return; // Comment ends right away. + + if(ch != '>') // Single-line comment? { while(FGetC() != '\n' && !source->atEnd); } - else // Multiline comment? + else // Multiline comment? { while(!source->atEnd) { @@ -240,6 +244,7 @@ static void SkipComment(void) break; seq = false; } + if(ch == '<') seq = true; } @@ -248,8 +253,8 @@ static void SkipComment(void) static int ReadToken(void) { - int ch; - char *out = token; + int ch; + char* out = token; // Has a token been unread? if(unreadToken[0]) @@ -288,14 +293,14 @@ static int ReadToken(void) ch = FGetC(); *out++ = ch; } - *(out - 1) = 0; // End token. + *(out - 1) = 0; // End token. // Put the last read character back in the stream. FUngetC(ch); return true; } -static void UnreadToken(const char *token) +static void UnreadToken(const char* token) { // The next time ReadToken() is called, this is returned. strcpy(unreadToken, token); @@ -305,13 +310,13 @@ static void UnreadToken(const char *token) * Current pos in the file is at the first ". * Does not expand escape sequences, only checks for \". * - * @return @c true, if successful. + * @return @c true, if successful. */ -static int ReadStringEx(char *dest, int maxlen, boolean inside, +static int ReadStringEx(char* dest, int maxlen, boolean inside, boolean doubleq) { - char *ptr = dest; - int ch, esc = false, newl = false; + char* ptr = dest; + int ch, esc = false, newl = false; if(!inside) { @@ -319,9 +324,10 @@ static int ReadStringEx(char *dest, int maxlen, boolean inside, if(!ISTOKEN("\"")) return false; } + // Start reading the characters. ch = FGetC(); - while(esc || ch != '"') // The string-end-character. + while(esc || ch != '"') // The string-end-character. { if(source->atEnd) return false; @@ -366,12 +372,14 @@ static int ReadStringEx(char *dest, int maxlen, boolean inside, // Read the next character, please. ch = FGetC(); } + // End the string in a null. *ptr = 0; + return true; } -static int ReadString(char *dest, int maxlen) +static int ReadString(char* dest, int maxlen) { return ReadStringEx(dest, maxlen, false, false); } @@ -379,9 +387,9 @@ static int ReadString(char *dest, int maxlen) /** * Read a string of (pretty much) any length. */ -static int ReadAnyString(char **dest) +static int ReadAnyString(char** dest) { - char buffer[0x20000]; + char buffer[0x20000]; if(!ReadString(buffer, sizeof(buffer))) return false; @@ -396,12 +404,13 @@ static int ReadAnyString(char **dest) // Make a copy. *dest = M_Malloc(strlen(buffer) + 1); strcpy(*dest, buffer); + return true; } -static int ReadNByteVector(unsigned char *dest, int max) +static int ReadNByteVector(unsigned char* dest, int max) { - int i; + int i; FINDBEGIN; for(i = 0; i < max; ++i) @@ -416,9 +425,9 @@ static int ReadNByteVector(unsigned char *dest, int max) } /** - * @return @c true, if successful. + * @return @c true, if successful. */ -static int ReadByte(unsigned char *dest) +static int ReadByte(unsigned char* dest) { ReadToken(); if(ISTOKEN(";")) @@ -426,14 +435,15 @@ static int ReadByte(unsigned char *dest) SetError("Missing integer value."); return false; } + *dest = strtoul(token, 0, 0); return true; } /** - * @return @c true, if successful. + * @return @c true, if successful. */ -static int ReadInt(int *dest, int unsign) +static int ReadInt(int* dest, int unsign) { ReadToken(); if(ISTOKEN(";")) @@ -441,14 +451,15 @@ static int ReadInt(int *dest, int unsign) SetError("Missing integer value."); return false; } + *dest = unsign ? strtoul(token, 0, 0) : strtol(token, 0, 0); return true; } /** - * @return @c true, if successful. + * @return @c true, if successful. */ -static int ReadFloat(float *dest) +static int ReadFloat(float* dest) { ReadToken(); if(ISTOKEN(";")) @@ -456,13 +467,14 @@ static int ReadFloat(float *dest) SetError("Missing float value."); return false; } + *dest = (float) strtod(token, 0); return true; } -static int ReadFlags(int *dest, const char *prefix) +static int ReadFlags(int* dest, const char* prefix) { - char flag[1024]; + char flag[1024]; // By default, no flags are set. *dest = 0; @@ -498,16 +510,17 @@ static int ReadFlags(int *dest, const char *prefix) if(!ReadToken()) break; - if(!ISTOKEN("|")) // | is required for multiple flags. + if(!ISTOKEN("|")) // | is required for multiple flags. { UnreadToken(token); break; } } + return true; } -static int ReadBlendmode(blendmode_t *dest) +static int ReadBlendmode(blendmode_t* dest) { char flag[1024]; blendmode_t bm; @@ -544,9 +557,9 @@ static int ReadBlendmode(blendmode_t *dest) } /** - * @return @c true, if successful. + * @return @c true, if successful. */ -static int ReadLabel(char *label) +static int ReadLabel(char* label) { strcpy(label, ""); for(;;) @@ -557,7 +570,7 @@ static int ReadLabel(char *label) SetError("Unexpected end of file."); return false; } - if(ISTOKEN("}")) // End block. + if(ISTOKEN("}")) // End block. { strcpy(label, token); return true; @@ -569,7 +582,7 @@ static int ReadLabel(char *label) SetError("Label without value."); return false; } - continue; // Semicolons are optional in v6. + continue; // Semicolons are optional in v6. } if(ISTOKEN("=") || ISTOKEN("{")) break; @@ -578,12 +591,13 @@ static int ReadLabel(char *label) strcat(label, " "); strcat(label, token); } + return true; } -static void DED_Include(char *fileName, directory_t * dir) +static void DED_Include(char* fileName, directory_t* dir) { - char tmp[256], path[256]; + char tmp[256], path[256]; M_TranslatePath(fileName, tmp); if(!Dir_IsAbsolute(tmp)) @@ -598,7 +612,7 @@ static void DED_Include(char *fileName, directory_t * dir) strcpy(token, ""); } -static void DED_InitReader(char *buffer, const char *fileName) +static void DED_InitReader(char* buffer, const char* fileName) { if(source && source - sourceStack >= MAX_RECUR_DEPTH) { @@ -637,12 +651,13 @@ static void DED_CloseReader(void) } /** - * Return true if the condition passes. The condition token can be a - * command line option or a game mode. + * @param cond Condition token. Can be a command line option + * or a game mode. + * @return @c true if the condition passes. */ -static boolean DED_CheckCondition(const char *cond, boolean expected) +static boolean DED_CheckCondition(const char* cond, boolean expected) { - boolean value = false; + boolean value = false; if(cond[0] == '-') { @@ -665,41 +680,38 @@ static boolean DED_CheckCondition(const char *cond, boolean expected) * @param buffer The data to be read, must be null-terminated. * @param sourceFile Just FYI. */ -/* *INDENT-OFF* */ -static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) +static int DED_ReadData(ded_t* ded, char* buffer, const char* sourceFile) { - char dummy[128]; - int dummyInt; - int idx, retval = true; - char label[128], tmp[256]; - ded_mobj_t *mo; - int prev_mo_idx = -1; // For "Copy". - ded_state_t *st; - int prev_state_idx = -1; // For "Copy" - ded_light_t *lig; - int prev_ligdef_idx = -1; // For "Copy". - ded_model_t *mdl, *prevmdl = 0; - int prev_modef_idx = -1; // For "Copy". - ded_sound_t *snd; - ded_mapinfo_t *mi; - int prev_mapinfo_idx = -1; // For "Copy". - ded_str_t *tn; - ded_value_t *val; - ded_detailtexture_t *dtl; - int prev_dtldef_idx = -1; // For "Copy". - ded_ptcgen_t *gen; - int prev_gendef_idx = -1; // For "Copy". - int prev_decordef_idx = -1; // For "Copy". - int prev_refdef_idx = -1; // For "Copy". - ded_finale_t *fin; - ded_linetype_t *l; - int prev_linetype_idx = -1; // For "Copy". - ded_sectortype_t *sec; - int prev_sectortype_idx = -1; // For "Copy". - int depth; - char *rootstr = 0, *ptr; - int bCopyNext = false; - directory_t fileDir; + char dummy[128], label[128], tmp[256]; + int dummyInt, idx, retVal = true; + ded_mobj_t* mo; + int prevMobjDefIdx = -1; // For "Copy". + ded_state_t* st; + int prevStateDefIdx = -1; // For "Copy" + ded_light_t* lig; + int prevLightDefIdx = -1; // For "Copy". + ded_model_t* mdl, *prevModel = 0; + int prevModelDefIdx = -1; // For "Copy". + ded_sound_t* snd; + ded_mapinfo_t* mi; + int prevMapInfoDefIdx = -1; // For "Copy". + ded_str_t* tn; + ded_value_t* val; + ded_detailtexture_t* dtl; + int prevDetailDefIdx = -1; // For "Copy". + ded_ptcgen_t* gen; + int prevGenDefIdx = -1; // For "Copy". + int prevDecorDefIdx = -1; // For "Copy". + int prevRefDefIdx = -1; // For "Copy". + ded_finale_t* fin; + ded_linetype_t* l; + int prevLineTypeDefIdx = -1; // For "Copy". + ded_sectortype_t* sec; + int prevSectorTypeDefIdx = -1; // For "Copy". + int depth; + char* rootStr = 0, *ptr; + int bCopyNext = 0; + directory_t fileDir; // For including other files -- we must know where we are. Dir_FileDir(sourceFile, &fileDir); @@ -833,10 +845,10 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) idx = DED_AddMobj(ded, ""); mo = ded->mobjs + idx; - if(prev_mo_idx >= 0 && bCopyNext) + if(prevMobjDefIdx >= 0 && bCopyNext) { // Should we copy the previous definition? - memcpy(mo, ded->mobjs + prev_mo_idx, sizeof(*mo)); + memcpy(mo, ded->mobjs + prevMobjDefIdx, sizeof(*mo)); } FINDBEGIN; @@ -878,7 +890,7 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) RV_END CHECKSC; } - prev_mo_idx = idx; + prevMobjDefIdx = idx; } if(ISTOKEN("State")) @@ -887,10 +899,10 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) idx = DED_AddState(ded, ""); st = ded->states + idx; - if(prev_state_idx >= 0 && bCopyNext) + if(prevStateDefIdx >= 0 && bCopyNext) { // Should we copy the previous definition? - memcpy(st, ded->states + prev_state_idx, sizeof(*st)); + memcpy(st, ded->states + prevStateDefIdx, sizeof(*st)); } FINDBEGIN; @@ -911,7 +923,7 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) RV_END CHECKSC; } - prev_state_idx = idx; + prevStateDefIdx = idx; } if(ISTOKEN("Sprite")) @@ -933,17 +945,17 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) // A new light. idx = DED_AddLight(ded, ""); lig = ded->lights + idx; - if(prev_ligdef_idx >= 0 && bCopyNext) + if(prevLightDefIdx >= 0 && bCopyNext) { // Should we copy the previous definition? - memcpy(lig, ded->lights + prev_ligdef_idx, sizeof(*lig)); + memcpy(lig, ded->lights + prevLightDefIdx, sizeof(*lig)); } FINDBEGIN; for(;;) { READLABEL; RV_STR("State", lig->state) - RV_STR("Map", lig->level) + RV_STR("Map", lig->uniqueMapID) RV_FLT("X Offset", lig->offset[VX]) RV_FLT("Y Offset", lig->offset[VY]) RV_VEC("Origin", lig->offset, 3) @@ -978,7 +990,7 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) RV_END CHECKSC; } - prev_ligdef_idx = idx; + prevLightDefIdx = idx; } if(ISTOKEN("Model")) @@ -989,11 +1001,11 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) idx = DED_AddModel(ded, ""); mdl = ded->models + idx; sub = 0; - if(prev_modef_idx >= 0) + if(prevModelDefIdx >= 0) { - prevmdl = ded->models + prev_modef_idx; + prevModel = ded->models + prevModelDefIdx; // Should we copy the previous definition? - if(bCopyNext) memcpy(mdl, prevmdl, sizeof(*mdl)); + if(bCopyNext) memcpy(mdl, prevModel, sizeof(*mdl)); } FINDBEGIN; @@ -1060,30 +1072,30 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) // Some post-processing. No point in doing this in a fancy way, // the whole reader will be rewritten sooner or later... - if(prevmdl) + if(prevModel) { int i; if(!strcmp(mdl->state, "-")) - strcpy(mdl->state, prevmdl->state); + strcpy(mdl->state, prevModel->state); if(!strcmp(mdl->sprite.id, "-")) - strcpy(mdl->sprite.id, prevmdl->sprite.id); - //if(!strcmp(mdl->group, "-")) strcpy(mdl->group, prevmdl->group); - //if(!strcmp(mdl->flags, "-")) strcpy(mdl->flags, prevmdl->flags); + strcpy(mdl->sprite.id, prevModel->sprite.id); + //if(!strcmp(mdl->group, "-")) strcpy(mdl->group, prevModel->group); + //if(!strcmp(mdl->flags, "-")) strcpy(mdl->flags, prevModel->flags); for(i = 0; i < DED_MAX_SUB_MODELS; ++i) { if(!strcmp(mdl->sub[i].filename.path, "-")) - strcpy(mdl->sub[i].filename.path, prevmdl->sub[i].filename.path); + strcpy(mdl->sub[i].filename.path, prevModel->sub[i].filename.path); if(!strcmp(mdl->sub[i].frame, "-")) - strcpy(mdl->sub[i].frame, prevmdl->sub[i].frame); + strcpy(mdl->sub[i].frame, prevModel->sub[i].frame); - //if(!strcmp(mdl->sub[i].flags, "-")) strcpy(mdl->sub[i].flags, prevmdl->sub[i].flags); + //if(!strcmp(mdl->sub[i].flags, "-")) strcpy(mdl->sub[i].flags, prevModel->sub[i].flags); } } - prev_modef_idx = idx; + prevModelDefIdx = idx; } if(ISTOKEN("Sound")) @@ -1138,12 +1150,12 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) idx = DED_AddMapInfo(ded, ""); mi = ded->mapInfo + idx; - if(prev_mapinfo_idx >= 0 && bCopyNext) + if(prevMapInfoDefIdx >= 0 && bCopyNext) { int m; // Should we copy the previous definition? - memcpy(mi, ded->mapInfo + prev_mapinfo_idx, sizeof(*mi)); + memcpy(mi, ded->mapInfo + prevMapInfoDefIdx, sizeof(*mi)); mi->execute = sdup(mi->execute); for(m = 0; m < NUM_SKY_MODELS; ++m) { @@ -1151,7 +1163,7 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) = sdup(mi->skyModels[m].execute); } } - prev_mapinfo_idx = idx; + prevMapInfoDefIdx = idx; sub = 0; FINDBEGIN; @@ -1197,7 +1209,7 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) if(sub == NUM_SKY_MODELS) { // Too many! SetError("Too many sky models."); - retval = false; + retVal = false; goto ded_end_read; } sub++; @@ -1249,7 +1261,7 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) { M_Free(temp); SetError("Syntax error in text value."); - retval = false; + retVal = false; goto ded_end_read; } } @@ -1301,7 +1313,7 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) if(ISTOKEN("Values")) // String Values { depth = 0; - rootstr = M_Calloc(1); // A null string. + rootStr = M_Calloc(1); // A null string. FINDBEGIN; for(;;) @@ -1311,7 +1323,7 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) if(strchr(label, '|')) { SetError("Value labels can't include | characters (ASCII 124)."); - retval = false; + retVal = false; goto ded_end_read; } @@ -1331,25 +1343,25 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) val->text = temp; // Compose the identifier. - val->id = M_Malloc(strlen(rootstr) + strlen(label) + 1); - strcpy(val->id, rootstr); + val->id = M_Malloc(strlen(rootStr) + strlen(label) + 1); + strcpy(val->id, rootStr); strcat(val->id, label); } else { M_Free(temp); SetError("Syntax error in string value."); - retval = false; + retVal = false; goto ded_end_read; } } else if(ISTOKEN("{")) { // Begin a new group. - rootstr = M_Realloc(rootstr, strlen(rootstr) + rootStr = M_Realloc(rootStr, strlen(rootStr) + strlen(label) + 2); - strcat(rootstr, label); - strcat(rootstr, "|"); // The separator. + strcat(rootStr, label); + strcat(rootStr, "|"); // The separator. // Increase group level. depth++; continue; @@ -1362,54 +1374,67 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) if(!depth) break; // End root depth. - // Decrease level and modify rootstr. + // Decrease level and modify rootStr. depth--; - len = strlen(rootstr); - rootstr[len-1] = 0; // Remove last |. - ptr = strrchr(rootstr, '|'); + len = strlen(rootStr); + rootStr[len-1] = 0; // Remove last |. + ptr = strrchr(rootStr, '|'); if(ptr) { ptr[1] = 0; - rootstr = M_Realloc(rootstr, strlen(rootstr) + 1); + rootStr = M_Realloc(rootStr, strlen(rootStr) + 1); } else { // Back to level zero. - rootstr = M_Realloc(rootstr, 1); - *rootstr = 0; + rootStr = M_Realloc(rootStr, 1); + *rootStr = 0; } } else { // Only the above characters are allowed. SetError("Illegal token."); - retval = false; + retVal = false; goto ded_end_read; } CHECKSC; } - M_Free(rootstr); - rootstr = 0; + M_Free(rootStr); + rootStr = 0; } if(ISTOKEN("Detail")) // Detail Texture { idx = DED_AddDetail(ded, ""); dtl = ded->details + idx; - if(prev_dtldef_idx >= 0 && bCopyNext) + if(prevDetailDefIdx >= 0 && bCopyNext) { // Should we copy the previous definition? - memcpy(dtl, ded->details + prev_dtldef_idx, sizeof(*dtl)); + memcpy(dtl, ded->details + prevDetailDefIdx, sizeof(*dtl)); } FINDBEGIN; for(;;) { READLABEL; - RV_STR("Texture", dtl->texture) - RV_STR("Wall", dtl->texture) // Alias - RV_STR("Flat", dtl->flat) - if(ISLABEL("Lump")) + RV_FLAGS("Flags", dtl->flags, "dtf_") + if(ISLABEL("Texture")) + { + READSTR(dtl->materialName1) + dtl->materialGroup1 = MG_TEXTURES; + } + else if(ISLABEL("Wall")) // Alias + { + READSTR(dtl->materialName1) + dtl->materialGroup1 = MG_TEXTURES; + } + else if(ISLABEL("Flat")) + { + READSTR(dtl->materialName2) + dtl->materialGroup2 = MG_FLATS; + } + else if(ISLABEL("Lump")) { READSTR(dtl->detailLump.path) dtl->isExternal = false; @@ -1426,7 +1451,7 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) RV_END CHECKSC; } - prev_dtldef_idx = idx; + prevDetailDefIdx = idx; } if(ISTOKEN("Reflection")) // Surface reflection @@ -1436,16 +1461,17 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) idx = DED_AddReflection(ded); ref = &ded->reflections[idx]; - if(prev_refdef_idx >= 0 && bCopyNext) + if(prevRefDefIdx >= 0 && bCopyNext) { // Should we copy the previous definition? - memcpy(ref, ded->reflections + prev_refdef_idx, sizeof(*ref)); + memcpy(ref, ded->reflections + prevRefDefIdx, sizeof(*ref)); } FINDBEGIN; for(;;) { READLABEL; + RV_FLAGS("Flags", ref->flags, "rff_") RV_FLT("Shininess", ref->shininess) RV_VEC("Min color", ref->minColor, 3) RV_BLENDMODE("Blending mode", ref->blendMode) @@ -1466,7 +1492,7 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) else RV_END CHECKSC; } - prev_refdef_idx = idx; + prevRefDefIdx = idx; } if(ISTOKEN("Generator")) // Particle Generator @@ -1476,17 +1502,17 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) idx = DED_AddPtcGen(ded, ""); gen = ded->ptcGens + idx; sub = 0; - if(prev_gendef_idx >= 0 && bCopyNext) + if(prevGenDefIdx >= 0 && bCopyNext) { // Should we copy the previous definition? - memcpy(gen, ded->ptcGens + prev_gendef_idx, sizeof(*gen)); + memcpy(gen, ded->ptcGens + prevGenDefIdx, sizeof(*gen)); // Duplicate the stages array. - if(ded->ptcGens[prev_gendef_idx].stages) + if(ded->ptcGens[prevGenDefIdx].stages) { gen->stages = M_Malloc(sizeof(ded_ptcstage_t) * gen->stageCount.max); - memcpy(gen->stages, ded->ptcGens[prev_gendef_idx].stages, + memcpy(gen->stages, ded->ptcGens[prevGenDefIdx].stages, sizeof(ded_ptcstage_t) * gen->stageCount.num); } } @@ -1576,7 +1602,7 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) else RV_END CHECKSC; } - prev_gendef_idx = idx; + prevGenDefIdx = idx; } if(ISTOKEN("Finale") || ISTOKEN("InFine")) @@ -1633,10 +1659,10 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) idx = DED_AddDecoration(ded); decor = &ded->decorations[idx]; sub = 0; - if(prev_decordef_idx >= 0 && bCopyNext) + if(prevDecorDefIdx >= 0 && bCopyNext) { // Should we copy the previous definition? - memcpy(decor, ded->decorations + prev_decordef_idx, + memcpy(decor, ded->decorations + prevDecorDefIdx, sizeof(*decor)); } @@ -1674,7 +1700,7 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) if(sub == DED_DECOR_NUM_MODELS) { SetError("Too many models in decoration."); - retval = false; + retVal = false; goto ded_end_read; } @@ -1717,7 +1743,7 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) if(sub == DED_DECOR_NUM_LIGHTS) { SetError("Too many lights in decoration."); - retval = false; + retVal = false; goto ded_end_read; } @@ -1762,7 +1788,7 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) else RV_END CHECKSC; } - prev_decordef_idx = idx; + prevDecorDefIdx = idx; } if(ISTOKEN("Group")) @@ -1862,10 +1888,10 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) idx = DED_AddLineType(ded, 0); l = ded->lineTypes + idx; - if(prev_linetype_idx >= 0 && bCopyNext) + if(prevLineTypeDefIdx >= 0 && bCopyNext) { // Should we copy the previous definition? - memcpy(l, ded->lineTypes + prev_linetype_idx, sizeof(*l)); + memcpy(l, ded->lineTypes + prevLineTypeDefIdx, sizeof(*l)); } FINDBEGIN; @@ -2018,7 +2044,7 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) RV_END CHECKSC; } - prev_linetype_idx = idx; + prevLineTypeDefIdx = idx; } if(ISTOKEN("Sector")) // Sector Type @@ -2027,10 +2053,10 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) idx = DED_AddSectorType(ded, 0); sec = ded->sectorTypes + idx; - if(prev_sectortype_idx >= 0 && bCopyNext) + if(prevSectorTypeDefIdx >= 0 && bCopyNext) { // Should we copy the previous definition? - memcpy(sec, ded->sectorTypes + prev_sectortype_idx, + memcpy(sec, ded->sectorTypes + prevSectorTypeDefIdx, sizeof(*sec)); } @@ -2111,18 +2137,18 @@ static int DED_ReadData(ded_t *ded, char *buffer, const char *sourceFile) RV_END CHECKSC; } - prev_sectortype_idx = idx; + prevSectorTypeDefIdx = idx; } bCopyNext = false; } ded_end_read: - M_Free(rootstr); + M_Free(rootStr); // Free the source stack entry we were using. DED_CloseReader(); - return retval; + return retVal; } /* *INDENT-ON* */