mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
Merge branch 'maint'
This commit is contained in:
commit
33ee8f9fef
6 changed files with 74 additions and 6 deletions
|
@ -35,6 +35,7 @@
|
|||
#include <string.h>
|
||||
#include "m_argv.h"
|
||||
#include "cmdlib.h"
|
||||
#include "i_system.h"
|
||||
|
||||
IMPLEMENT_CLASS (DArgs)
|
||||
|
||||
|
@ -391,6 +392,14 @@ void DArgs::CollectFiles(const char *param, const char *extension)
|
|||
}
|
||||
}
|
||||
|
||||
// Optional: Replace short path names with long path names
|
||||
#ifdef _WIN32
|
||||
for (i = 0; i < work.Size(); ++i)
|
||||
{
|
||||
work[i] = I_GetLongPathName(work[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Step 3: Add work back to Argv, as long as it's non-empty.
|
||||
if (work.Size() > 0)
|
||||
{
|
||||
|
|
|
@ -575,11 +575,7 @@ int ACSStringPool::InsertString(FString &str, unsigned int h, unsigned int bucke
|
|||
}
|
||||
else
|
||||
{ // Scan for the next free entry
|
||||
unsigned int i;
|
||||
for (i = FirstFreeEntry + 1; i < Pool.Size() && Pool[i].Next != FREE_ENTRY; ++i)
|
||||
{
|
||||
}
|
||||
FirstFreeEntry = i;
|
||||
FindFirstFreeEntry(FirstFreeEntry + 1);
|
||||
}
|
||||
PoolEntry *entry = &Pool[index];
|
||||
entry->Str = str;
|
||||
|
@ -590,6 +586,23 @@ int ACSStringPool::InsertString(FString &str, unsigned int h, unsigned int bucke
|
|||
return index | STRPOOL_LIBRARYID_OR;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// ACSStringPool :: FindFirstFreeEntry
|
||||
//
|
||||
// Finds the first free entry, starting at base.
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
void ACSStringPool::FindFirstFreeEntry(unsigned base)
|
||||
{
|
||||
while (base < Pool.Size() && Pool[base].Next != FREE_ENTRY)
|
||||
{
|
||||
base++;
|
||||
}
|
||||
FirstFreeEntry = base;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// ACSStringPool :: ReadStrings
|
||||
|
@ -638,6 +651,7 @@ void ACSStringPool::ReadStrings(PNGHandle *png, DWORD id)
|
|||
{
|
||||
delete[] str;
|
||||
}
|
||||
FindFirstFreeEntry(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -690,6 +704,7 @@ void ACSStringPool::Dump() const
|
|||
Printf("%4u. (%2d) \"%s\"\n", i, Pool[i].LockCount, Pool[i].Str.GetChars());
|
||||
}
|
||||
}
|
||||
Printf("First free %u\n", FirstFreeEntry);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
@ -8405,7 +8420,7 @@ scriptwait:
|
|||
{
|
||||
int playernum = STACK(1);
|
||||
|
||||
if (playernum < 0 || playernum >= MAXPLAYERS || !playeringame[playernum] || players[playernum].camera == NULL)
|
||||
if (playernum < 0 || playernum >= MAXPLAYERS || !playeringame[playernum] || players[playernum].camera == NULL || players[playernum].camera->player != NULL)
|
||||
{
|
||||
STACK(1) = -1;
|
||||
}
|
||||
|
|
|
@ -100,6 +100,7 @@ public:
|
|||
private:
|
||||
int FindString(const char *str, size_t len, unsigned int h, unsigned int bucketnum);
|
||||
int InsertString(FString &str, unsigned int h, unsigned int bucketnum, const SDWORD *stack, int stackdepth);
|
||||
void FindFirstFreeEntry(unsigned int base);
|
||||
|
||||
enum { NUM_BUCKETS = 251 };
|
||||
enum { FREE_ENTRY = 0xFFFFFFFE }; // Stored in PoolEntry's Next field
|
||||
|
|
|
@ -4913,6 +4913,18 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetTics)
|
|||
ACTION_PARAM_START(1);
|
||||
ACTION_PARAM_INT(tics_to_set, 0);
|
||||
|
||||
if (stateowner != self && self->player != NULL && stateowner->IsKindOf(RUNTIME_CLASS(AWeapon)))
|
||||
{ // Is this a weapon? Need to check psp states for a match, then. Blah.
|
||||
for (int i = 0; i < NUMPSPRITES; ++i)
|
||||
{
|
||||
if (self->player->psprites[i].state == CallingState)
|
||||
{
|
||||
self->player->psprites[i].tics = tics_to_set;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Just set tics for self.
|
||||
self->tics = tics_to_set;
|
||||
}
|
||||
|
||||
|
|
|
@ -1569,3 +1569,31 @@ unsigned int I_MakeRNGSeed()
|
|||
CryptReleaseContext(prov, 0);
|
||||
return seed;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// I_GetLongPathName
|
||||
//
|
||||
// Returns the long version of the path, or the original if there isn't
|
||||
// anything worth changing.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
FString I_GetLongPathName(FString shortpath)
|
||||
{
|
||||
DWORD buffsize = GetLongPathName(shortpath.GetChars(), NULL, 0);
|
||||
if (buffsize == 0)
|
||||
{ // nothing to change (it doesn't exist, maybe?)
|
||||
return shortpath;
|
||||
}
|
||||
TCHAR *buff = new TCHAR[buffsize];
|
||||
DWORD buffsize2 = GetLongPathName(shortpath.GetChars(), buff, buffsize);
|
||||
if (buffsize2 >= buffsize)
|
||||
{ // Failure! Just return the short path
|
||||
delete[] buff;
|
||||
return shortpath;
|
||||
}
|
||||
FString longpath(buff, buffsize2);
|
||||
delete[] buff;
|
||||
return longpath;
|
||||
}
|
||||
|
|
|
@ -155,6 +155,9 @@ typedef _W64 long WLONG_PTR;
|
|||
typedef long WLONG_PTR;
|
||||
#endif
|
||||
|
||||
// Wrapper for GetLongPathName
|
||||
FString I_GetLongPathName(FString shortpath);
|
||||
|
||||
// Directory searching routines
|
||||
|
||||
// Mirror WIN32_FIND_DATAA in <winbase.h>
|
||||
|
|
Loading…
Reference in a new issue