mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-01 00:21:35 +00:00
- Added a check to Wads.CheckNumForName to return -1 for names longer than
8 characters which contain path separators. - Fixed: Hires texture replacement must replace all matching textures, not just the first one found. This is particularly important for icons based on sprites. - added a con_alpha CVAR to set the console's translucency. - Added MartinHowe's submission for A_CustomBulletAttack aimfacing parameter. - Added MartinHowe's submission for A_PlaySoundEx attenuation parameter. - Fixed: Bots shouldn't target friendly monsters. - Fixed a typo in sbarinfo.cpp (noatribox instead of noartibox.) SVN r654 (trunk)
This commit is contained in:
parent
37f9c50b4e
commit
a329efe9a4
10 changed files with 176 additions and 52 deletions
|
@ -1,3 +1,15 @@
|
||||||
|
December 28, 2007 (Changes by Graf Zahl)
|
||||||
|
- Added a check to Wads.CheckNumForName to return -1 for names longer than
|
||||||
|
8 characters which contain path separators.
|
||||||
|
- Fixed: Hires texture replacement must replace all matching textures, not
|
||||||
|
just the first one found. This is particularly important for icons based
|
||||||
|
on sprites.
|
||||||
|
- added a con_alpha CVAR to set the console's translucency.
|
||||||
|
- Added MartinHowe's submission for A_CustomBulletAttack aimfacing parameter.
|
||||||
|
- Added MartinHowe's submission for A_PlaySoundEx attenuation parameter.
|
||||||
|
- Fixed: Bots shouldn't target friendly monsters.
|
||||||
|
- Fixed a typo in sbarinfo.cpp (noatribox instead of noartibox.)
|
||||||
|
|
||||||
December 27, 2007
|
December 27, 2007
|
||||||
- Fixed cases where a larger power-of-2-sized native texture had to be
|
- Fixed cases where a larger power-of-2-sized native texture had to be
|
||||||
allocated. (I wonder if D3D actually handles this automatically when you use
|
allocated. (I wonder if D3D actually handles this automatically when you use
|
||||||
|
|
|
@ -403,6 +403,6 @@ void DCajunMaster::Set_enemy (AActor *actor)
|
||||||
*enemy = oldenemy; //Try go for last (it will be NULL if there wasn't anyone)
|
*enemy = oldenemy; //Try go for last (it will be NULL if there wasn't anyone)
|
||||||
}
|
}
|
||||||
//Verify that that enemy is really something alive that bot can kill.
|
//Verify that that enemy is really something alive that bot can kill.
|
||||||
if (*enemy && ((*enemy)->health < 0 || !((*enemy)->flags&MF_SHOOTABLE)))
|
if (*enemy && (((*enemy)->health < 0 || !((*enemy)->flags&MF_SHOOTABLE)) || actor->IsFriend(*enemy)))
|
||||||
*enemy = NULL;
|
*enemy = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "d_gui.h"
|
#include "d_gui.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
|
#include "vectors.h"
|
||||||
|
|
||||||
#include "gi.h"
|
#include "gi.h"
|
||||||
|
|
||||||
|
@ -157,6 +158,12 @@ CUSTOM_CVAR (Int, con_scaletext, 0, CVAR_ARCHIVE) // Scale notify text at high
|
||||||
if (self > 2) self = 2;
|
if (self > 2) self = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CUSTOM_CVAR(Float, con_alpha, 0.75f, CVAR_ARCHIVE)
|
||||||
|
{
|
||||||
|
if (self < 0.f) self = 0.f;
|
||||||
|
if (self > 1.f) self = 1.f;
|
||||||
|
}
|
||||||
|
|
||||||
// Command to run when Ctrl-D is pressed at start of line
|
// Command to run when Ctrl-D is pressed at start of line
|
||||||
CVAR (String, con_ctrl_d, "", CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
CVAR (String, con_ctrl_d, "", CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
|
|
||||||
|
@ -1138,7 +1145,7 @@ void C_DrawConsole (bool hw2d)
|
||||||
DTA_DestWidth, screen->GetWidth(),
|
DTA_DestWidth, screen->GetWidth(),
|
||||||
DTA_DestHeight, screen->GetHeight(),
|
DTA_DestHeight, screen->GetHeight(),
|
||||||
DTA_ColorOverlay, conshade,
|
DTA_ColorOverlay, conshade,
|
||||||
DTA_Alpha, hw2d ? FRACUNIT*3/4 : FRACUNIT,
|
DTA_Alpha, hw2d ? FLOAT2FIXED(con_alpha) : FRACUNIT,
|
||||||
DTA_Masked, false,
|
DTA_Masked, false,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
if (conline && visheight < screen->GetHeight())
|
if (conline && visheight < screen->GetHeight())
|
||||||
|
|
|
@ -522,7 +522,7 @@ void SBarInfo::ParseSBarInfoBlock(SBarInfoBlock &block)
|
||||||
{
|
{
|
||||||
cmd.flags += DRAWINVENTORYBAR_ALWAYSSHOW;
|
cmd.flags += DRAWINVENTORYBAR_ALWAYSSHOW;
|
||||||
}
|
}
|
||||||
else if(SC_Compare("noatribox"))
|
else if(SC_Compare("noartibox"))
|
||||||
{
|
{
|
||||||
cmd.flags += DRAWINVENTORYBAR_NOARTIBOX;
|
cmd.flags += DRAWINVENTORYBAR_NOARTIBOX;
|
||||||
}
|
}
|
||||||
|
|
150
src/r_data.cpp
150
src/r_data.cpp
|
@ -147,6 +147,46 @@ int FTextureManager::CheckForTexture (const char *name, int usetype, BITFIELD fl
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int FTextureManager::ListTextures (const char *name, TArray<int> &list)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (name == NULL || name[0] == '\0')
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
// [RH] Doom counted anything beginning with '-' as "no texture".
|
||||||
|
// Hopefully nobody made use of that and had textures like "-EMPTY",
|
||||||
|
// because -NOFLAT- is a valid graphic for ZDoom.
|
||||||
|
if (name[0] == '-' && name[1] == '\0')
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
i = HashFirst[MakeKey (name) % HASH_SIZE];
|
||||||
|
|
||||||
|
while (i != HASH_END)
|
||||||
|
{
|
||||||
|
const FTexture *tex = Textures[i].Texture;
|
||||||
|
|
||||||
|
if (stricmp (tex->Name, name) == 0)
|
||||||
|
{
|
||||||
|
// NULL textures must be ignored.
|
||||||
|
if (tex->UseType!=FTexture::TEX_Null)
|
||||||
|
{
|
||||||
|
int j;
|
||||||
|
for(j = 0; j < list.Size(); j++)
|
||||||
|
{
|
||||||
|
// Check for overriding definitions from newer WADs
|
||||||
|
if (Textures[list[j]].Texture->UseType == tex->UseType) break;
|
||||||
|
}
|
||||||
|
if (j==list.Size()) list.Push(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
i = Textures[i].HashNext;
|
||||||
|
}
|
||||||
|
return list.Size();
|
||||||
|
}
|
||||||
|
|
||||||
int FTextureManager::GetTexture (const char *name, int usetype, BITFIELD flags)
|
int FTextureManager::GetTexture (const char *name, int usetype, BITFIELD flags)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -312,6 +352,7 @@ void FTextureManager::AddHiresTextures ()
|
||||||
int firsttx = Wads.CheckNumForName ("HI_START");
|
int firsttx = Wads.CheckNumForName ("HI_START");
|
||||||
int lasttx = Wads.CheckNumForName ("HI_END");
|
int lasttx = Wads.CheckNumForName ("HI_END");
|
||||||
char name[9];
|
char name[9];
|
||||||
|
TArray<int> tlist;
|
||||||
|
|
||||||
if (firsttx == -1 || lasttx == -1)
|
if (firsttx == -1 || lasttx == -1)
|
||||||
{
|
{
|
||||||
|
@ -322,38 +363,44 @@ void FTextureManager::AddHiresTextures ()
|
||||||
|
|
||||||
for (firsttx += 1; firsttx < lasttx; ++firsttx)
|
for (firsttx += 1; firsttx < lasttx; ++firsttx)
|
||||||
{
|
{
|
||||||
|
tlist.Clear();
|
||||||
Wads.GetLumpName (name, firsttx);
|
Wads.GetLumpName (name, firsttx);
|
||||||
|
|
||||||
if (Wads.CheckNumForName (name, ns_hires) == firsttx)
|
if (Wads.CheckNumForName (name, ns_hires) == firsttx)
|
||||||
{
|
{
|
||||||
FTexture * newtex = FTexture::CreateTexture (firsttx, FTexture::TEX_Any);
|
int amount = ListTextures(name, tlist);
|
||||||
if (newtex != NULL)
|
if (amount == 0)
|
||||||
{
|
{
|
||||||
int oldtexno = CheckForTexture(name, FTexture::TEX_Wall, TEXMAN_Overridable|TEXMAN_TryAny);
|
int oldtex = AddPatch(name);
|
||||||
|
if (oldtex >= 0) tlist.Push(oldtex);
|
||||||
if (oldtexno<0)
|
|
||||||
{
|
|
||||||
oldtexno = AddPatch(name);
|
|
||||||
}
|
|
||||||
newtex->bWorldPanning = true;
|
|
||||||
if (oldtexno<0)
|
|
||||||
{
|
|
||||||
// A texture with this name does not yet exist
|
|
||||||
newtex->UseType=FTexture::TEX_Override;
|
|
||||||
AddTexture(newtex);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FTexture * oldtex = Textures[oldtexno].Texture;
|
|
||||||
|
|
||||||
// Replace the entire texture and adjust the scaling and offset factors.
|
|
||||||
newtex->SetScaledSize(oldtex->GetScaledWidth(), oldtex->GetScaledHeight());
|
|
||||||
newtex->LeftOffset = FixedMul(oldtex->GetScaledLeftOffset(), newtex->xScale);
|
|
||||||
newtex->TopOffset = FixedMul(oldtex->GetScaledTopOffset(), newtex->yScale);
|
|
||||||
ReplaceTexture(oldtexno, newtex, true);
|
|
||||||
}
|
|
||||||
StartScreen->Progress();
|
|
||||||
}
|
}
|
||||||
|
if (tlist.Size() == 0)
|
||||||
|
{
|
||||||
|
// A texture with this name does not yet exist
|
||||||
|
FTexture * newtex = FTexture::CreateTexture (firsttx, FTexture::TEX_Any);
|
||||||
|
newtex->UseType=FTexture::TEX_Override;
|
||||||
|
AddTexture(newtex);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for(int i = 0; i < tlist.Size(); i++)
|
||||||
|
{
|
||||||
|
FTexture * newtex = FTexture::CreateTexture (firsttx, FTexture::TEX_Any);
|
||||||
|
if (newtex != NULL)
|
||||||
|
{
|
||||||
|
int oldtexno = tlist[i];
|
||||||
|
FTexture * oldtex = Textures[oldtexno].Texture;
|
||||||
|
|
||||||
|
// Replace the entire texture and adjust the scaling and offset factors.
|
||||||
|
newtex->bWorldPanning = true;
|
||||||
|
newtex->SetScaledSize(oldtex->GetScaledWidth(), oldtex->GetScaledHeight());
|
||||||
|
newtex->LeftOffset = FixedMul(oldtex->GetScaledLeftOffset(), newtex->xScale);
|
||||||
|
newtex->TopOffset = FixedMul(oldtex->GetScaledTopOffset(), newtex->yScale);
|
||||||
|
ReplaceTexture(oldtexno, newtex, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
StartScreen->Progress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -371,6 +418,7 @@ void FTextureManager::LoadHiresTex()
|
||||||
bool is32bit;
|
bool is32bit;
|
||||||
int width, height;
|
int width, height;
|
||||||
int type, mode;
|
int type, mode;
|
||||||
|
TArray<int> tlist;
|
||||||
|
|
||||||
lastLump = 0;
|
lastLump = 0;
|
||||||
src[8] = '\0';
|
src[8] = '\0';
|
||||||
|
@ -392,30 +440,50 @@ void FTextureManager::LoadHiresTex()
|
||||||
|
|
||||||
sc_String[8]=0;
|
sc_String[8]=0;
|
||||||
|
|
||||||
int tex = TexMan.CheckForTexture(sc_String, type, mode);
|
tlist.Clear();
|
||||||
|
int amount = ListTextures(sc_String, tlist);
|
||||||
if (tex<0)
|
if (amount == 0)
|
||||||
{
|
{
|
||||||
tex= AddPatch(sc_String);
|
int oldtex = AddPatch(sc_String);
|
||||||
|
if (oldtex >= 0) tlist.Push(oldtex);
|
||||||
}
|
}
|
||||||
|
FName texname = sc_String;
|
||||||
|
|
||||||
SC_MustGetString();
|
SC_MustGetString();
|
||||||
int lumpnum = Wads.CheckNumForFullName(sc_String);
|
int lumpnum = Wads.CheckNumForFullName(sc_String);
|
||||||
if (lumpnum < 0) lumpnum = Wads.CheckNumForName(sc_String, ns_graphics);
|
if (lumpnum < 0) lumpnum = Wads.CheckNumForName(sc_String, ns_graphics);
|
||||||
|
|
||||||
if (tex>0)
|
if (tlist.Size() == 0)
|
||||||
{
|
{
|
||||||
FTexture * oldtex = TexMan[tex];
|
Printf("Attempting to remap non-existent texture %s to %s\n",
|
||||||
FTexture * newtex = FTexture::CreateTexture (lumpnum, FTexture::TEX_Any);
|
texname.GetChars(), sc_String);
|
||||||
|
}
|
||||||
if (newtex != NULL)
|
else
|
||||||
|
{
|
||||||
|
for(int i = 0; i < tlist.Size(); i++)
|
||||||
{
|
{
|
||||||
// Replace the entire texture and adjust the scaling and offset factors.
|
FTexture * oldtex = Textures[tlist[i]].Texture;
|
||||||
newtex->bWorldPanning = true;
|
int sl;
|
||||||
newtex->SetScaledSize(oldtex->GetScaledWidth(), oldtex->GetScaledHeight());
|
|
||||||
newtex->LeftOffset = FixedMul(oldtex->GetScaledLeftOffset(), newtex->xScale);
|
// only replace matching types. For sprites also replace any MiscPatches
|
||||||
newtex->TopOffset = FixedMul(oldtex->GetScaledTopOffset(), newtex->yScale);
|
// based on the same lump. These can be created for icons.
|
||||||
ReplaceTexture(tex, newtex, true);
|
if (oldtex->UseType == type || type == FTexture::TEX_Any ||
|
||||||
|
(mode == TEXMAN_Overridable && oldtex->UseType == FTexture::TEX_Override) ||
|
||||||
|
(type == FTexture::TEX_Sprite && oldtex->UseType == FTexture::TEX_MiscPatch &&
|
||||||
|
(sl=oldtex->GetSourceLump()) >= 0 && Wads.GetLumpNamespace(sl) == ns_sprites)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
FTexture * newtex = FTexture::CreateTexture (lumpnum, FTexture::TEX_Any);
|
||||||
|
if (newtex != NULL)
|
||||||
|
{
|
||||||
|
// Replace the entire texture and adjust the scaling and offset factors.
|
||||||
|
newtex->bWorldPanning = true;
|
||||||
|
newtex->SetScaledSize(oldtex->GetScaledWidth(), oldtex->GetScaledHeight());
|
||||||
|
newtex->LeftOffset = FixedMul(oldtex->GetScaledLeftOffset(), newtex->xScale);
|
||||||
|
newtex->TopOffset = FixedMul(oldtex->GetScaledTopOffset(), newtex->yScale);
|
||||||
|
ReplaceTexture(tlist[i], newtex, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
16
src/r_data.h
16
src/r_data.h
|
@ -53,6 +53,8 @@ public:
|
||||||
const BYTE *GetPixels ();
|
const BYTE *GetPixels ();
|
||||||
void Unload ();
|
void Unload ();
|
||||||
|
|
||||||
|
int GetSourceLump() { return SourceLump; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int SourceLump;
|
int SourceLump;
|
||||||
BYTE *Pixels;
|
BYTE *Pixels;
|
||||||
|
@ -121,6 +123,8 @@ public:
|
||||||
const BYTE *GetPixels ();
|
const BYTE *GetPixels ();
|
||||||
void Unload ();
|
void Unload ();
|
||||||
|
|
||||||
|
int GetSourceLump() { return SourceLump; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int SourceLump;
|
int SourceLump;
|
||||||
BYTE *Pixels;
|
BYTE *Pixels;
|
||||||
|
@ -162,6 +166,8 @@ public:
|
||||||
const BYTE *GetPixels ();
|
const BYTE *GetPixels ();
|
||||||
void Unload ();
|
void Unload ();
|
||||||
|
|
||||||
|
int GetSourceLump() { return SourceLump; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static bool Check(FileReader & file);
|
static bool Check(FileReader & file);
|
||||||
static FTexture *Create(FileReader & file, int lumpnum);
|
static FTexture *Create(FileReader & file, int lumpnum);
|
||||||
|
@ -187,6 +193,8 @@ public:
|
||||||
void Unload ();
|
void Unload ();
|
||||||
void MakeTexture ();
|
void MakeTexture ();
|
||||||
|
|
||||||
|
int GetSourceLump() { return LumpNum; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static bool Check(FileReader & file);
|
static bool Check(FileReader & file);
|
||||||
|
@ -213,6 +221,8 @@ public:
|
||||||
const BYTE *GetPixels ();
|
const BYTE *GetPixels ();
|
||||||
void Unload ();
|
void Unload ();
|
||||||
|
|
||||||
|
int GetSourceLump() { return SourceLump; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
static bool Check(FileReader & file);
|
static bool Check(FileReader & file);
|
||||||
|
@ -242,6 +252,7 @@ public:
|
||||||
FTextureFormat GetFormat ();
|
FTextureFormat GetFormat ();
|
||||||
int CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y);
|
int CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y);
|
||||||
bool UseBasePalette();
|
bool UseBasePalette();
|
||||||
|
int GetSourceLump() { return SourceLump; }
|
||||||
|
|
||||||
static FTexture *CreateFromFile (PNGHandle *png, const FString &filename);
|
static FTexture *CreateFromFile (PNGHandle *png, const FString &filename);
|
||||||
|
|
||||||
|
@ -279,6 +290,7 @@ public:
|
||||||
const BYTE *GetPixels ();
|
const BYTE *GetPixels ();
|
||||||
void Unload ();
|
void Unload ();
|
||||||
FTextureFormat GetFormat ();
|
FTextureFormat GetFormat ();
|
||||||
|
int GetSourceLump() { return SourceLump; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static bool Check (FileReader &file);
|
static bool Check (FileReader &file);
|
||||||
|
@ -324,6 +336,7 @@ public:
|
||||||
FTextureFormat GetFormat ();
|
FTextureFormat GetFormat ();
|
||||||
int CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y);
|
int CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y);
|
||||||
bool UseBasePalette();
|
bool UseBasePalette();
|
||||||
|
int GetSourceLump() { return SourceLump; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -375,6 +388,7 @@ public:
|
||||||
|
|
||||||
int CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y);
|
int CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y);
|
||||||
bool UseBasePalette();
|
bool UseBasePalette();
|
||||||
|
int GetSourceLump() { return SourceLump; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int SourceLump;
|
int SourceLump;
|
||||||
|
@ -431,6 +445,7 @@ public:
|
||||||
|
|
||||||
int CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y);
|
int CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y);
|
||||||
bool UseBasePalette();
|
bool UseBasePalette();
|
||||||
|
int GetSourceLump() { return SourceLump; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int SourceLump;
|
int SourceLump;
|
||||||
|
@ -463,6 +478,7 @@ public:
|
||||||
const BYTE *GetPixels ();
|
const BYTE *GetPixels ();
|
||||||
void Unload ();
|
void Unload ();
|
||||||
bool CheckModified ();
|
bool CheckModified ();
|
||||||
|
int GetSourceLump() { return SourcePic->GetSourceLump(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FTexture *SourcePic;
|
FTexture *SourcePic;
|
||||||
|
|
|
@ -667,6 +667,7 @@ public:
|
||||||
|
|
||||||
virtual int CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y);
|
virtual int CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y);
|
||||||
virtual bool UseBasePalette();
|
virtual bool UseBasePalette();
|
||||||
|
virtual int GetSourceLump() { return -1; }
|
||||||
|
|
||||||
virtual void Unload () = 0;
|
virtual void Unload () = 0;
|
||||||
|
|
||||||
|
@ -794,6 +795,7 @@ public:
|
||||||
|
|
||||||
int CheckForTexture (const char *name, int usetype, BITFIELD flags=TEXMAN_TryAny);
|
int CheckForTexture (const char *name, int usetype, BITFIELD flags=TEXMAN_TryAny);
|
||||||
int GetTexture (const char *name, int usetype, BITFIELD flags=0);
|
int GetTexture (const char *name, int usetype, BITFIELD flags=0);
|
||||||
|
int ListTextures (const char *name, TArray<int> &list);
|
||||||
|
|
||||||
void WriteTexture (FArchive &arc, int picnum);
|
void WriteTexture (FArchive &arc, int picnum);
|
||||||
int ReadTexture (FArchive &arc);
|
int ReadTexture (FArchive &arc);
|
||||||
|
|
|
@ -308,12 +308,23 @@ void A_StopSound(AActor * self)
|
||||||
|
|
||||||
void A_PlaySoundEx (AActor *self)
|
void A_PlaySoundEx (AActor *self)
|
||||||
{
|
{
|
||||||
int index = CheckIndex(3);
|
int index = CheckIndex(4);
|
||||||
if (index < 0) return;
|
if (index < 0) return;
|
||||||
|
|
||||||
int soundid = StateParameters[index];
|
int soundid = StateParameters[index];
|
||||||
ENamedName channel = ENamedName(StateParameters[index + 1]);
|
ENamedName channel = ENamedName(StateParameters[index + 1]);
|
||||||
INTBOOL looping = StateParameters[index + 2];
|
INTBOOL looping = StateParameters[index + 2];
|
||||||
|
int attenuation_raw = EvalExpressionI(StateParameters[index + 3], self);
|
||||||
|
|
||||||
|
int attenuation;
|
||||||
|
switch (attenuation_raw)
|
||||||
|
{
|
||||||
|
case -1: attenuation=ATTN_STATIC; break; // drop off rapidly
|
||||||
|
default:
|
||||||
|
case 0: attenuation=ATTN_NORM; break; // normal
|
||||||
|
case 1: attenuation=ATTN_NONE; break; // full volume
|
||||||
|
case 2: attenuation=ATTN_SURROUND; break; // full volume surround
|
||||||
|
}
|
||||||
|
|
||||||
if (channel < NAME_Auto || channel > NAME_SoundSlot7)
|
if (channel < NAME_Auto || channel > NAME_SoundSlot7)
|
||||||
{
|
{
|
||||||
|
@ -322,13 +333,13 @@ void A_PlaySoundEx (AActor *self)
|
||||||
|
|
||||||
if (!looping)
|
if (!looping)
|
||||||
{
|
{
|
||||||
S_SoundID (self, channel - NAME_Auto, soundid, 1, ATTN_NORM);
|
S_SoundID (self, channel - NAME_Auto, soundid, 1, attenuation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!S_IsActorPlayingSomething (self, channel - NAME_Auto, soundid))
|
if (!S_IsActorPlayingSomething (self, channel - NAME_Auto, soundid))
|
||||||
{
|
{
|
||||||
S_LoopedSoundID (self, channel - NAME_Auto, soundid, 1, ATTN_NORM);
|
S_LoopedSoundID (self, channel - NAME_Auto, soundid, 1, attenuation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -811,7 +822,7 @@ void A_CustomMissile(AActor * self)
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
void A_CustomBulletAttack (AActor *self)
|
void A_CustomBulletAttack (AActor *self)
|
||||||
{
|
{
|
||||||
int index=CheckIndex(6);
|
int index=CheckIndex(7);
|
||||||
if (index<0) return;
|
if (index<0) return;
|
||||||
|
|
||||||
angle_t Spread_XY=angle_t(EvalExpressionF (StateParameters[index], self) * ANGLE_1);
|
angle_t Spread_XY=angle_t(EvalExpressionF (StateParameters[index], self) * ANGLE_1);
|
||||||
|
@ -820,6 +831,7 @@ void A_CustomBulletAttack (AActor *self)
|
||||||
int DamagePerBullet=EvalExpressionI (StateParameters[index+3], self);
|
int DamagePerBullet=EvalExpressionI (StateParameters[index+3], self);
|
||||||
ENamedName PuffType=(ENamedName)StateParameters[index+4];
|
ENamedName PuffType=(ENamedName)StateParameters[index+4];
|
||||||
fixed_t Range = fixed_t(EvalExpressionF (StateParameters[index+5], self) * FRACUNIT);
|
fixed_t Range = fixed_t(EvalExpressionF (StateParameters[index+5], self) * FRACUNIT);
|
||||||
|
bool AimFacing = !!EvalExpressionI (StateParameters[index+6], self);
|
||||||
|
|
||||||
if(Range==0) Range=MISSILERANGE;
|
if(Range==0) Range=MISSILERANGE;
|
||||||
|
|
||||||
|
@ -829,9 +841,9 @@ void A_CustomBulletAttack (AActor *self)
|
||||||
int bslope;
|
int bslope;
|
||||||
const PClass *pufftype;
|
const PClass *pufftype;
|
||||||
|
|
||||||
if (self->target)
|
if (self->target || AimFacing)
|
||||||
{
|
{
|
||||||
A_FaceTarget (self);
|
if (!AimFacing) A_FaceTarget (self);
|
||||||
bangle = self->angle;
|
bangle = self->angle;
|
||||||
|
|
||||||
pufftype = PClass::FindClass(PuffType);
|
pufftype = PClass::FindClass(PuffType);
|
||||||
|
|
|
@ -827,6 +827,13 @@ int FWadCollection::CheckNumForName (const char *name, int space)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Let's not search for names that are longer than 8 characters and contain path separators
|
||||||
|
// They are almost certainly full path names passed to this function.
|
||||||
|
if (strlen(name) > 8 && strpbrk(name, "/."))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
uppercopy (uname, name);
|
uppercopy (uname, name);
|
||||||
i = FirstLumpIndex[LumpNameHash (uname) % NumLumps];
|
i = FirstLumpIndex[LumpNameHash (uname) % NumLumps];
|
||||||
|
|
||||||
|
|
|
@ -124,12 +124,12 @@ class Actor extends Thinker
|
||||||
action native A_FLoopActiveSound();
|
action native A_FLoopActiveSound();
|
||||||
action native A_LoopActiveSound();
|
action native A_LoopActiveSound();
|
||||||
action native A_StopSound();
|
action native A_StopSound();
|
||||||
action native A_PlaySoundEx(sound whattoplay, coerce name slot, optional bool looping);
|
action native A_PlaySoundEx(sound whattoplay, coerce name slot, optional bool looping, optional eval int attenuation);
|
||||||
action native A_StopSoundEx(coerce name slot);
|
action native A_StopSoundEx(coerce name slot);
|
||||||
action native A_SeekerMissile(eval int threshold, eval int turnmax);
|
action native A_SeekerMissile(eval int threshold, eval int turnmax);
|
||||||
action native A_Jump(eval int chance, state label, ...);
|
action native A_Jump(eval int chance, state label, ...);
|
||||||
action native A_CustomMissile(class<Actor> missiletype, eval float spawnheight, eval int spawnofs_xy, optional eval float angle, optional eval int flags, optional eval float pitch);
|
action native A_CustomMissile(class<Actor> missiletype, eval float spawnheight, eval int spawnofs_xy, optional eval float angle, optional eval int flags, optional eval float pitch);
|
||||||
action native A_CustomBulletAttack(eval float spread_xy, eval float spread_z, eval int numbullets, eval int damageperbullet, optional class<Actor> pufftype, optional eval float range);
|
action native A_CustomBulletAttack(eval float spread_xy, eval float spread_z, eval int numbullets, eval int damageperbullet, optional class<Actor> pufftype, optional eval float range, optional eval bool aimfacing);
|
||||||
action native A_CustomRailgun(eval int damage, optional eval int spawnofs_xy, optional color color1, optional color color2, optional eval bool silent, optional eval bool aim, optional eval float maxdiff, optional class<Actor> pufftype);
|
action native A_CustomRailgun(eval int damage, optional eval int spawnofs_xy, optional color color1, optional color color2, optional eval bool silent, optional eval bool aim, optional eval float maxdiff, optional class<Actor> pufftype);
|
||||||
action native A_JumpIfHealthLower(eval int health, state label);
|
action native A_JumpIfHealthLower(eval int health, state label);
|
||||||
action native A_JumpIfCloser(eval float distance, state label);
|
action native A_JumpIfCloser(eval float distance, state label);
|
||||||
|
|
Loading…
Reference in a new issue