summaryrefslogtreecommitdiff
path: root/src/strife/r_data.c
diff options
context:
space:
mode:
authorSamuel Villareal2010-09-10 02:36:05 +0000
committerSamuel Villareal2010-09-10 02:36:05 +0000
commit15fdcbbe5899bde4831d100db63117ba2c00a4dd (patch)
tree2946712e7f430dab262d9e704168a504f8f938af /src/strife/r_data.c
parent9f4c5a6ed4e490fb51aa207c2def75fcb2622584 (diff)
downloadchocolate-doom-15fdcbbe5899bde4831d100db63117ba2c00a4dd.tar.gz
chocolate-doom-15fdcbbe5899bde4831d100db63117ba2c00a4dd.tar.bz2
chocolate-doom-15fdcbbe5899bde4831d100db63117ba2c00a4dd.zip
+ 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
Diffstat (limited to 'src/strife/r_data.c')
-rw-r--r--src/strife/r_data.c92
1 files changed, 86 insertions, 6 deletions
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;
+ }
+ }
+}
+