From 15fdcbbe5899bde4831d100db63117ba2c00a4dd Mon Sep 17 00:00:00 2001 From: Samuel Villareal Date: Fri, 10 Sep 2010 02:36:05 +0000 Subject: + Fixed a minor fluke in P_ChangeSwitchTexture + R_SoundNumForDoor implemented + opensound/closesound variables added to vldoor_t struct Subversion-branch: /branches/strife-branch Subversion-revision: 2053 --- src/strife/p_spec.h | 22 +++++++----- src/strife/p_switch.c | 6 +++- src/strife/r_data.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++---- src/strife/r_data.h | 2 ++ 4 files changed, 107 insertions(+), 15 deletions(-) (limited to 'src/strife') diff --git a/src/strife/p_spec.h b/src/strife/p_spec.h index c62e933f..eaed5724 100644 --- a/src/strife/p_spec.h +++ b/src/strife/p_spec.h @@ -360,20 +360,26 @@ typedef enum typedef struct { - thinker_t thinker; - vldoor_e type; - sector_t* sector; - fixed_t topheight; - fixed_t speed; + thinker_t thinker; + vldoor_e type; + sector_t* sector; + fixed_t topheight; + fixed_t speed; // 1 = up, 0 = waiting at top, -1 = down - int direction; + int direction; // tics to wait at the top - int topwait; + int topwait; // (keep in case a door going down is reset) // when it reaches 0, start going down - int topcountdown; + int topcountdown; + + // villsa [STRIFE] new field - sound to play when opening + int opensound; + + // villsa [STRIFE] new field - sound to play when closing + int closesound; } vldoor_t; diff --git a/src/strife/p_switch.c b/src/strife/p_switch.c index 658aa55c..49e52760 100644 --- a/src/strife/p_switch.c +++ b/src/strife/p_switch.c @@ -220,7 +220,7 @@ static void P_SpawnBrokenGlass(line_t* line) for(i = 0; i < 7; i++) { - glass = P_SpawnMobj(x2, y2, ONCEILINGZ, MT_JUNK); + glass = P_SpawnMobj(x2, y2, ONFLOORZ, MT_JUNK); glass->z += (24*FRACUNIT); glass->flags |= (MF_SHADOW|MF_MVIS); @@ -313,6 +313,10 @@ void P_ChangeSwitchTexture(line_t* line, int useAgain) S_StartSound(buttonlist->soundorg,sound); sides[line->sidenum[0]].midtexture = switchlist[i^1]; + // villsa [STRIFE] affect second side of line + if(line->flags & ML_TWOSIDED) + sides[line->sidenum[1]].midtexture = switchlist[i^1]; + if(useAgain) P_StartButton(line, middle,switchlist[i],BUTTONTIME); diff --git a/src/strife/r_data.c b/src/strife/r_data.c index 84872c9f..569d1223 100644 --- a/src/strife/r_data.c +++ b/src/strife/r_data.c @@ -31,19 +31,14 @@ #include "i_swap.h" #include "i_system.h" #include "z_zone.h" - - #include "w_wad.h" - #include "doomdef.h" #include "r_local.h" #include "p_local.h" - #include "doomstat.h" #include "r_sky.h" - - #include "r_data.h" +#include "sounds.h" // villsa [STRIFE] // // Graphics. @@ -783,6 +778,91 @@ int R_TextureNumForName (char* name) return i; } +// +// R_SoundNumForDoor +// +// villsa [STRIFE] - new function +// Set sounds associated with door though why +// on earth is this function placed here? +// +void R_SoundNumForDoor(vldoor_t* door) +{ + int i; + sector_t *sector; + line_t *line; + texture_t *texture; + char name[8]; + char c1; + char c2; + + // set default sounds + door->opensound = sfx_drsmto; + door->closesound = sfx_drsmtc; + + for(sector = door->sector, i = 0; i < sector->linecount; i++) + { + line = sector->lines[i]; + + if(!(line->flags & ML_TWOSIDED)) + continue; + + texture = textures[sides[line->sidenum[0]].toptexture]; + memcpy(name, texture->name, 8); + //memcpy(&v6, texture->index, 0); // [STRIFE] todo - WHAT?! + + if(strncmp(name, "DOR", 3)) + continue; + + c1 = name[3]; + c2 = name[4]; + + // S type + if(c1 == 'S') + { + door->opensound = sfx_drston; + door->closesound = sfx_drston; + return; + } + + // M type + if(c1 == 'M') + { + // L subtype + if(c2 == 'L') + { + door->opensound = sfx_drlmto; + door->closesound = sfx_drlmtc; + } + // S subtype + else if(c2 == 'S') + { + door->opensound = sfx_drsmto; + door->closesound = sfx_drsmtc; + } + return; + } + // W type + else if(c1 == 'W') + { + // L subtype + if(c2 == 'L') + { + door->opensound = sfx_drlwud; + door->closesound = sfx_drlwud; + + } + // S subtype + else if(c2 == 'S') + { + door->opensound = sfx_drswud; + door->closesound = sfx_drswud; + + } + return; + } + } +} + diff --git a/src/strife/r_data.h b/src/strife/r_data.h index c987284c..c8d08179 100644 --- a/src/strife/r_data.h +++ b/src/strife/r_data.h @@ -31,6 +31,7 @@ #include "r_defs.h" #include "r_state.h" +#include "p_spec.h" // villsa [STRIFE] // Retrieve column data for span blitting. @@ -55,5 +56,6 @@ int R_FlatNumForName (char* name); // returns the texture number for the texture name. int R_TextureNumForName (char *name); int R_CheckTextureNumForName (char *name); +void R_SoundNumForDoor(vldoor_t* door); // villsa [STRIFE] #endif -- cgit v1.2.3