- manual merge of all NBlood changes that couldn't get cherry picked.

This commit is contained in:
Christoph Oelckers 2019-09-21 13:02:17 +02:00
parent bc3d2e9aec
commit 998ac01157
71 changed files with 3415 additions and 2030 deletions

View file

@ -189,7 +189,6 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\source\audiolib\src\al_midi.cpp" />
<ClCompile Include="..\..\source\audiolib\src\drivers.cpp" />
<ClCompile Include="..\..\source\audiolib\src\driver_directsound.cpp" />
<ClCompile Include="..\..\source\audiolib\src\driver_nosound.cpp" />
@ -209,8 +208,6 @@
<ClCompile Include="..\..\source\audiolib\src\mpu401.cpp" />
<ClCompile Include="..\..\source\audiolib\src\multivoc.cpp" />
<ClCompile Include="..\..\source\audiolib\src\music.cpp" />
<ClCompile Include="..\..\source\audiolib\src\opl3.cpp" />
<ClCompile Include="..\..\source\audiolib\src\oplmidi.cpp" />
<ClCompile Include="..\..\source\audiolib\src\pitch.cpp" />
<ClCompile Include="..\..\source\audiolib\src\sdlmusic.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
@ -223,21 +220,17 @@
<ClCompile Include="..\..\source\audiolib\src\xmp.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\source\audiolib\include\al_midi.h" />
<ClInclude Include="..\..\source\audiolib\include\drivers.h" />
<ClInclude Include="..\..\source\audiolib\include\fx_man.h" />
<ClInclude Include="..\..\source\audiolib\include\midi.h" />
<ClInclude Include="..\..\source\audiolib\include\mpu401.h" />
<ClInclude Include="..\..\source\audiolib\include\multivoc.h" />
<ClInclude Include="..\..\source\audiolib\include\music.h" />
<ClInclude Include="..\..\source\audiolib\include\opl3.h" />
<ClInclude Include="..\..\source\audiolib\include\oplmidi.h" />
<ClInclude Include="..\..\source\audiolib\src\driver_directsound.h" />
<ClInclude Include="..\..\source\audiolib\src\driver_nosound.h" />
<ClInclude Include="..\..\source\audiolib\src\driver_sdl.h" />
<ClInclude Include="..\..\source\audiolib\src\linklist.h" />
<ClInclude Include="..\..\source\audiolib\src\pitch.h" />
<ClInclude Include="..\..\source\audiolib\src\_al_midi.h" />
<ClInclude Include="..\..\source\audiolib\src\_midi.h" />
<ClInclude Include="..\..\source\audiolib\src\_multivc.h" />
<ClInclude Include="..\..\source\audiolib\src\_oplmidi.h" />

View file

@ -56,9 +56,6 @@
<ClCompile Include="..\..\source\audiolib\src\sdlmusic.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\source\audiolib\src\al_midi.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\source\audiolib\src\gmtimbre.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -71,12 +68,6 @@
<ClCompile Include="..\..\source\audiolib\src\music.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\source\audiolib\src\opl3.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\source\audiolib\src\oplmidi.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\source\audiolib\src\pitch.h">
@ -109,29 +100,17 @@
<ClInclude Include="..\..\source\audiolib\include\music.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\source\audiolib\src\_al_midi.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\source\audiolib\src\_midi.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\source\audiolib\src\_oplmidi.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\source\audiolib\include\al_midi.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\source\audiolib\include\midi.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\source\audiolib\include\mpu401.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\source\audiolib\include\opl3.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\source\audiolib\include\oplmidi.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

File diff suppressed because it is too large Load diff

View file

@ -80,7 +80,7 @@ struct THINGINFO
unsigned char at15; // xrepeat
unsigned char at16; // yrepeat
int at17[7]; // damage
int allowThrow; // By NoOne: indicates if kGDXCustomDude can throw it
bool allowThrow; // By NoOne: indicates if kCustomDude can throw it
};
struct AMMOITEMDATA
@ -129,7 +129,7 @@ struct MissileType
unsigned char atb; // yrepeat
char atc; // shade
unsigned char atd; // clipdist
int fireSound[2]; // By NoOne: predefined fire sounds. used by kGDXCustomDude, but can be used for something else.
int fireSound[2]; // By NoOne: predefined fire sounds. used by kCustomDude, but can be used for something else.
};
struct EXPLOSION
@ -137,8 +137,8 @@ struct EXPLOSION
unsigned char at0;
char at1; // dmg
char at2; // dmg rnd
int at3; // radius
int at7;
int radius; // radius
int dmgType;
int atb;
int atf;
int at13;
@ -162,7 +162,19 @@ struct VECTORDATA {
int at15; // blood splats
int at19; // blood splat chance
VECTORDATA_at1d at1d[15];
int fireSound[2]; // By NoOne: predefined fire sounds. used by kGDXCustomDude, but can be used for something else.
int fireSound[2]; // By NoOne: predefined fire sounds. used by kCustomDude, but can be used for something else.
};
// by NoOne: sprite mass info for getSpriteMassBySize();
struct SPRITEMASS {
int seqId;
short picnum; // mainly needs for moving debris
short xrepeat;
short yrepeat;
short clipdist; // mass multiplier
int mass;
short airVel; // mainly needs for moving debris
int fraction; // mainly needs for moving debris
};
extern AMMOITEMDATA gAmmoItemData[];
@ -208,7 +220,7 @@ int actSpriteIdToOwnerId(int nSprite);
int actOwnerIdToSpriteId(int nSprite);
bool actTypeInSector(int nSector, int nType);
void actAllocateSpares(void);
void actInit(void);
void actInit(bool bSaveLoad);
void ConcussSprite(int a1, spritetype *pSprite, int x, int y, int z, int a6);
int actWallBounceVector(int *x, int *y, int nWall, int a4);
int actFloorBounceVector(int *x, int *y, int *z, int nSector, int a5);
@ -258,5 +270,18 @@ int GetRandDataVal(int *rData, spritetype* pSprite);
bool sfxPlayMissileSound(spritetype* pSprite, int missileId);
bool sfxPlayVectorSound(spritetype* pSprite, int vectorId);
spritetype* actSpawnCustomDude(spritetype* pSprite, int nDist);
int getDudeMassBySpriteSize(spritetype* pSprite);
int getSpriteMassBySize(spritetype* pSprite);
bool ceilIsTooLow(spritetype* pSprite);
void actBuildMissile(spritetype* pMissile, int nXSprite, int nSprite);
int isDebris(int nSprite);
int debrisGetFreeIndex(void);
void debrisMove(int listIndex);
void debrisConcuss(int nOwner, int listIndex, int x, int y, int z, int dmg);
extern SPRITEMASS gSpriteMass[kMaxXSprites];
extern short gProxySpritesList[kMaxSuperXSprites];
extern short gSightSpritesList[kMaxSuperXSprites];
extern short gPhysSpritesList[kMaxSuperXSprites];
extern short gProxySpritesCount;
extern short gSightSpritesCount;
extern short gPhysSpritesCount;

View file

@ -111,8 +111,8 @@ void aiNewState(spritetype *pSprite, XSPRITE *pXSprite, AISTATE *pAIState)
if (pAIState->at0 >= 0) {
// By NoOne: Custom dude uses data2 to keep it's seqStartId
switch (pSprite->type) {
case kGDXDudeUniversalCultist:
case kGDXGenDudeBurning:
case kCustomDude:
case kCustomDudeBurning:
seqStartId = pXSprite->data2;
break;
}
@ -231,9 +231,9 @@ bool CanMove(spritetype *pSprite, int a2, int nAngle, int nRange)
if (floorZ - bottom > 0x2000)
return false;
break;
case kGDXDudeUniversalCultist:
case kGDXGenDudeBurning:
if ((Crusher && !dudeIsImmune(pSprite, pXSector->damageType)) || xsprite[pSprite->extra].dudeGuard) return false;
case kCustomDude:
case kCustomDudeBurning:
if ((Crusher && !dudeIsImmune(pSprite, pXSector->damageType)) || ((Water || Underwater) && !canSwim(pSprite))) return false;
return true;
fallthrough__;
case 203:
@ -421,7 +421,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
break;
}
case kGDXDudeUniversalCultist:
case kCustomDude:
{
DUDEEXTRA_at6_u1* pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1;
pDudeExtraE->at8 = 1;
@ -432,12 +432,12 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
else {
aiNewState(pSprite, pXSprite, &GDXGenDudeSearchL);
if (Chance(0x4000))
sfxPlayGDXGenDudeSound(pSprite, 0, pXSprite->data3);
sfxPlayGDXGenDudeSound(pSprite, 0);
}
}
else {
if (Chance(0x4000))
sfxPlayGDXGenDudeSound(pSprite, 0, pXSprite->data3);
sfxPlayGDXGenDudeSound(pSprite, 0);
if (spriteIsUnderwater(pSprite, false))
aiNewState(pSprite, pXSprite, &GDXGenDudeChaseW);
@ -447,7 +447,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
}
break;
}
case kGDXGenDudeBurning:
case kCustomDudeBurning:
if (pXSprite->target == -1)
aiNewState(pSprite, pXSprite, &GDXGenDudeBurnSearch);
else
@ -1048,24 +1048,24 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T
evKill(nSprite, 3, CALLBACK_ID_0);
}
break;
case kGDXGenDudeBurning:
case kCustomDudeBurning:
if (Chance(0x2000) && gDudeExtra[pSprite->extra].at0 < (int)gFrameClock) {
sfxPlayGDXGenDudeSound(pSprite, 3, pXSprite->data3);
sfxPlayGDXGenDudeSound(pSprite, 3);
gDudeExtra[pSprite->extra].at0 = (int)gFrameClock + 360;
}
if (pXSprite->burnTime == 0) pXSprite->burnTime = 2400;
if (spriteIsUnderwater(pSprite, false)) {
pSprite->type = kGDXDudeUniversalCultist;
pSprite->type = kCustomDude;
pXSprite->burnTime = 0;
pXSprite->health = 1; // so it can be killed with flame weapons while underwater and if already was burning dude before.
aiNewState(pSprite, pXSprite, &GDXGenDudeGotoW);
}
break;
case kGDXDudeUniversalCultist:
case kCustomDude:
{
if (nDmgType == DAMAGE_TYPE_1) {
if (pXSprite->health <= pDudeInfo->fleeHealth) {
if (getNextIncarnation(pXSprite) == NULL) {
if (pXSprite->txID <= 0 || getNextIncarnation(pXSprite) == NULL) {
removeDudeStuff(pSprite);
if (pXSprite->data1 >= 459 && pXSprite->data1 < (459 + kExplodeMax) - 1)
@ -1083,10 +1083,10 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T
&& gSysRes.Lookup(pXSprite->data2 + 3, "SEQ")) {
aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1);
sfxPlayGDXGenDudeSound(pSprite, 3, pXSprite->data3);
pSprite->type = kGDXGenDudeBurning;
sfxPlayGDXGenDudeSound(pSprite, 3);
pSprite->type = kCustomDudeBurning;
if (pXSprite->data2 == 11520) // don't inherit palette for burning if using default animation
if (pXSprite->data2 == kDefaultAnimationBase) // don't inherit palette for burning if using default animation
pSprite->pal = 0;
aiNewState(pSprite, pXSprite, &GDXGenDudeBurnGoto);
@ -1097,18 +1097,20 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T
}
} else {
actKillDude(nSource, pSprite, nDmgType, nDamage);
actKillDude(nSource, pSprite, DAMAGE_TYPE_0, 65535);
}
}
} else if (pXSprite->aiState != &GDXGenDudeDodgeDmgD && pXSprite->aiState != &GDXGenDudeDodgeDmgL
&& pXSprite->aiState != &GDXGenDudeDodgeDmgW) {
} else if (!inDodge(pXSprite->aiState)) {
if (Chance(getDodgeChance(pSprite))) {
if (Chance(getDodgeChance(pSprite)) || inIdle(pXSprite->aiState)) {
if (!spriteIsUnderwater(pSprite, false)) {
if (!sub_5BDA8(pSprite, 14)) aiNewState(pSprite, pXSprite, &GDXGenDudeDodgeDmgL);
if (!canDuck(pSprite) || !sub_5BDA8(pSprite, 14)) aiNewState(pSprite, pXSprite, &GDXGenDudeDodgeDmgL);
else aiNewState(pSprite, pXSprite, &GDXGenDudeDodgeDmgD);
if (Chance(0x0200))
sfxPlayGDXGenDudeSound(pSprite, 1);
}
else if (sub_5BDA8(pSprite, 13) && spriteIsUnderwater(pSprite, false))
else if (sub_5BDA8(pSprite, 13))
aiNewState(pSprite, pXSprite, &GDXGenDudeDodgeDmgW);
}
}
@ -1150,33 +1152,34 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite)
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
switch (pSprite->type)
{
case kGDXDudeUniversalCultist:
case kCustomDude:
{
int mass = getDudeMassBySpriteSize(pSprite); int chance3 = getRecoilChance(pSprite);
if ((mass < 155 && !spriteIsUnderwater(pSprite, false) && pDudeExtra->at4) || (mass > 155 && Chance(chance3)))
int mass = getSpriteMassBySize(pSprite); int chance4 = getRecoilChance(pSprite); bool chance3 = Chance(chance4);
if (pDudeExtra->at4 && (inIdle(pXSprite->aiState) || mass < 155 || (mass >= 155 && chance3)) && !spriteIsUnderwater(pSprite, false))
{
sfxPlayGDXGenDudeSound(pSprite, 1, pXSprite->data3);
sfxPlayGDXGenDudeSound(pSprite, 1);
if (gSysRes.Lookup(pXSprite->data2 + 4, "SEQ")) aiNewState(pSprite, pXSprite, &GDXGenDudeRTesla);
else if (!v4 || (v4 && gGameOptions.nDifficulty == 0)) aiNewState(pSprite, pXSprite, &GDXGenDudeRecoilD);
else if (spriteIsUnderwater(pSprite, false)) aiNewState(pSprite, pXSprite, &GDXGenDudeRecoilW);
if (gSysRes.Lookup(pXSprite->data2 + 4, "SEQ")) {
GDXGenDudeRTesla.at18 = (Chance(chance4 * 2) ? &GDXGenDudeDodgeL : &GDXGenDudeDodgeDmgL);
aiNewState(pSprite, pXSprite, &GDXGenDudeRTesla);
}
else if (canDuck(pSprite) && (Chance(chance4) || gGameOptions.nDifficulty == 0)) aiNewState(pSprite, pXSprite, &GDXGenDudeRecoilD);
else if (canSwim(pSprite) && spriteIsUnderwater(pSprite, false)) aiNewState(pSprite, pXSprite, &GDXGenDudeRecoilW);
else aiNewState(pSprite, pXSprite, &GDXGenDudeRecoilL);
return;
break;
}
if (pXSprite->aiState == &GDXGenDudeDodgeDmgW || pXSprite->aiState == &GDXGenDudeDodgeDmgD
|| pXSprite->aiState == &GDXGenDudeDodgeDmgL) {
if (Chance(chance3)) sfxPlayGDXGenDudeSound(pSprite, 1, pXSprite->data3);
return;
if (inDodge(pXSprite->aiState)) {
sfxPlayGDXGenDudeSound(pSprite, 1);
break;
}
if ((!dudeIsMelee(pXSprite) && mass < 155) || Chance(chance3)) {
if (inIdle(pXSprite->aiState) || chance3 || Chance(getRecoilChance(pSprite)) || (!dudeIsMelee(pXSprite) && mass < 155)) {
sfxPlayGDXGenDudeSound(pSprite, 1, pXSprite->data3);
sfxPlayGDXGenDudeSound(pSprite, 1);
if (!v4 || (v4 && gGameOptions.nDifficulty == 0)) aiNewState(pSprite, pXSprite, &GDXGenDudeRecoilD);
else if (spriteIsUnderwater(pSprite, false)) aiNewState(pSprite, pXSprite, &GDXGenDudeRecoilW);
if (canDuck(pSprite) && (Chance(chance4) || gGameOptions.nDifficulty == 0)) aiNewState(pSprite, pXSprite, &GDXGenDudeRecoilD);
else if (canSwim(pSprite) && spriteIsUnderwater(pSprite, false)) aiNewState(pSprite, pXSprite, &GDXGenDudeRecoilW);
else aiNewState(pSprite, pXSprite, &GDXGenDudeRecoilL);
}
@ -1221,7 +1224,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite)
case 240:
aiNewState(pSprite, pXSprite, &cultistBurnGoto);
break;
case kGDXGenDudeBurning:
case kCustomDudeBurning:
aiNewState(pSprite, pXSprite, &GDXGenDudeBurnGoto);
break;
case 204:
@ -1234,9 +1237,9 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite)
case 203:
case 205:
aiPlay3DSound(pSprite, 1106, AI_SFX_PRIORITY_2, -1);
if (pDudeExtra->at4 && pXSprite->cumulDamage > pDudeInfo->startHealth/3)
if (pDudeExtra->at4 && pXSprite->data3 > pDudeInfo->startHealth/3)
aiNewState(pSprite, pXSprite, &zombieATeslaRecoil);
else if (pXSprite->cumulDamage > pDudeInfo->startHealth/3)
else if (pXSprite->data3 > pDudeInfo->startHealth/3)
aiNewState(pSprite, pXSprite, &zombieARecoil2);
else
aiNewState(pSprite, pXSprite, &zombieARecoil);
@ -1256,7 +1259,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite)
break;
case 227:
aiPlay3DSound(pSprite, 2302+Random(2), AI_SFX_PRIORITY_2, -1);
if (pDudeExtra->at4 && pXSprite->cumulDamage > pDudeInfo->startHealth/3)
if (pDudeExtra->at4 && pXSprite->data3 > pDudeInfo->startHealth/3)
aiNewState(pSprite, pXSprite, &cerberusTeslaRecoil);
else
aiNewState(pSprite, pXSprite, &cerberusRecoil);
@ -1511,7 +1514,7 @@ void aiProcessDudes(void)
}
if (pXSprite->health > 0 && ((pDudeInfo->hinderDamage<<4) <= cumulDamage[nXSprite]))
{
pXSprite->cumulDamage = cumulDamage[nXSprite];
pXSprite->data3 = cumulDamage[nXSprite];
RecoilDude(pSprite, pXSprite);
}
}
@ -1540,7 +1543,7 @@ void aiInitSprite(spritetype *pSprite)
pDudeExtra->at0 = 0;
switch (pSprite->type)
{
case kGDXDudeUniversalCultist:
case kCustomDude:
{
DUDEEXTRA_at6_u1* pDudeExtraE = &gDudeExtra[nXSprite].at6.u1;
pDudeExtraE->at8 = 0;
@ -1549,7 +1552,7 @@ void aiInitSprite(spritetype *pSprite)
aiNewState(pSprite, pXSprite, &GDXGenDudeIdleL);
break;
}
case kGDXGenDudeBurning:
case kCustomDudeBurning:
aiNewState(pSprite, pXSprite, &GDXGenDudeBurnGoto);
pXSprite->burnTime = 1200;
break;
@ -1756,15 +1759,16 @@ void aiInitSprite(spritetype *pSprite)
case 244:
pSprite->hitag = 7;
break;
case 225: // by NoOne: FakeDude type
break;
// By NoOne: Allow put pods and tentacles on ceilings if sprite is y-flipped.
case 221:
case 222:
case 223:
case 224:
case 225:
case 226:
if ((pSprite->cstat & CSTAT_SPRITE_YFLIP) != 0) {
if (!(pSprite->hitag & kHitagExtBit)) // don't add autoaim for player if hitag 1 specified in editor.
if (!(pSprite->hitag & kModernTypeFlag1)) // don't add autoaim for player if hitag 1 specified in editor.
pSprite->hitag = kHitagAutoAim;
break;
}

View file

@ -123,7 +123,7 @@ static void thinkGoto(spritetype *pSprite, XSPRITE *pXSprite)
case 252:
aiNewState(pSprite, pXSprite, &tinycalebBurnSearch);
break;
case kGDXGenDudeBurning:
case kCustomDudeBurning:
aiNewState(pSprite, pXSprite, &GDXGenDudeBurnSearch);
break;
}
@ -155,7 +155,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
case 252:
aiNewState(pSprite, pXSprite, &tinycalebBurnGoto);
break;
case kGDXGenDudeBurning:
case kCustomDudeBurning:
aiNewState(pSprite, pXSprite, &GDXGenDudeBurnGoto);
break;
}
@ -191,7 +191,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
case 252:
aiNewState(pSprite, pXSprite, &tinycalebBurnSearch);
break;
case kGDXGenDudeBurning:
case kCustomDudeBurning:
aiNewState(pSprite, pXSprite, &GDXGenDudeBurnSearch);
break;
}
@ -229,7 +229,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
case 252:
aiNewState(pSprite, pXSprite, &tinycalebBurnAttack);
break;
case kGDXGenDudeBurning:
case kCustomDudeBurning:
aiNewState(pSprite, pXSprite, &GDXGenDudeBurnSearch);
break;
}
@ -259,7 +259,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
case 252:
aiNewState(pSprite, pXSprite, &tinycalebBurnGoto);
break;
case kGDXGenDudeBurning:
case kCustomDudeBurning:
aiNewState(pSprite, pXSprite, &GDXGenDudeBurnSearch);
break;
}

File diff suppressed because it is too large Load diff

View file

@ -25,6 +25,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "ai.h"
#include "eventq.h"
#define kMaxGenDudeSndMode 11
#define kDefaultAnimationBase 11520
extern AISTATE GDXGenDudeIdleL;
extern AISTATE GDXGenDudeIdleW;
extern AISTATE GDXGenDudeSearchL;
@ -43,18 +47,24 @@ extern AISTATE GDXGenDudeChaseW;
extern AISTATE GDXGenDudeFireL;
extern AISTATE GDXGenDudeFireD;
extern AISTATE GDXGenDudeFireW;
extern AISTATE GDXGenDudeFire2L;
extern AISTATE GDXGenDudeFire2D;
extern AISTATE GDXGenDudeFire2W;
extern AISTATE GDXGenDudeRecoilL;
extern AISTATE GDXGenDudeRecoilD;
extern AISTATE GDXGenDudeRecoilW;
extern AISTATE GDGenDudeThrow;
extern AISTATE GDGenDudeThrow2;
extern AISTATE GDXGenDudeThrow;
extern AISTATE GDXGenDudeThrow2;
extern AISTATE GDXGenDudePunch;
extern AISTATE GDXGenDudeRTesla;
extern AISTATE GDXGenDudeProne;
extern AISTATE GDXGenDudeTurn;
extern AISTATE GDXGenDudeTransform;
struct GENDUDESND
{
int defaultSndId;
int randomRange;
int sndIdOffset; // relative to data3
bool aiPlaySound; // false = sfxStart3DSound();
};
extern GENDUDESND gCustomDudeSnd[];
XSPRITE* getNextIncarnation(XSPRITE* pXSprite);
void killDudeLeech(spritetype* pLeech);
@ -62,7 +72,7 @@ void removeLeech(spritetype* pLeech, bool delSprite = true);
void removeDudeStuff(spritetype* pSprite);
spritetype* leechIsDropped(spritetype* pSprite);
bool spriteIsUnderwater(spritetype* pSprite, bool oldWay);
bool sfxPlayGDXGenDudeSound(spritetype* pSprite, int mode, int data);
bool sfxPlayGDXGenDudeSound(spritetype* pSprite, int mode);
void aiGenDudeMoveForward(spritetype* pSprite, XSPRITE* pXSprite);
int getGenDudeMoveSpeed(spritetype* pSprite, int which, bool mul, bool shift);
bool TargetNearThing(spritetype* pSprite, int thingType);
@ -73,3 +83,9 @@ int getDodgeChance(spritetype* pSprite);
int getRecoilChance(spritetype* pSprite);
bool dudeIsMelee(XSPRITE* pXSprite);
void updateTargetOfSlaves(spritetype* pSprite);
bool canSwim(spritetype* pSprite);
bool canDuck(spritetype* pSprite);
bool CDCanMove(spritetype* pSprite);
bool inDodge(AISTATE* aiState);
bool inIdle(AISTATE* aiState);
int getSeqStartId(XSPRITE* pXSprite);

View file

@ -475,12 +475,12 @@ void PreloadCache(void)
if (totalclock - clock >= 1)
{
clock = totalclock.Ticks();
clock = totalclock;
percentDisplayed++;
}
}
clock = totalclock.Ticks();
clock = totalclock;
}
}
}
@ -522,6 +522,10 @@ void StartLevel(GAMEOPTIONS *gameOptions)
gGameOptions.uGameFlags |= 4;
if ((gGameOptions.uGameFlags&4) && gDemo.at1 == 0)
levelPlayIntroScene(gGameOptions.nEpisode);
///////
gGameOptions.weaponsV10x = gWeaponsV10x;
///////
}
else if (gGameOptions.nGameType > 0 && !(gGameOptions.uGameFlags&1))
{
@ -540,6 +544,10 @@ void StartLevel(GAMEOPTIONS *gameOptions)
else
levelSetupOptions(gGameOptions.nEpisode, gGameOptions.nLevel);
///////
gGameOptions.weaponsV10x = gPacketStartGame.weaponsV10x;
///////
gBlueFlagDropped = false;
gRedFlagDropped = false;
}
@ -552,7 +560,7 @@ void StartLevel(GAMEOPTIONS *gameOptions)
}
}
bVanilla = gDemo.at1 && gDemo.m_bLegacy;
//blooddemohack = 1;//bVanilla;
blooddemohack = 2;//bVanilla;
memset(xsprite,0,sizeof(xsprite));
memset(sprite,0,kMaxSprites*sizeof(spritetype));
drawLoadingScreen();
@ -566,6 +574,7 @@ void StartLevel(GAMEOPTIONS *gameOptions)
gSecretMgr.Clear();
gLevelTime = 0;
automapping = 1;
for (int i = 0; i < kMaxSprites; i++)
{
spritetype *pSprite = &sprite[i];
@ -579,9 +588,6 @@ void StartLevel(GAMEOPTIONS *gameOptions)
DeleteSprite(i);
continue;
}
if (sprite[i].lotag == kGDXDudeTargetChanger)
InsertSpriteStat(i, kStatGDXDudeTargetChanger);
}
}
scrLoadPLUs();
@ -611,7 +617,7 @@ void StartLevel(GAMEOPTIONS *gameOptions)
}
InitSectorFX();
warpInit();
actInit();
actInit(false);
evInit();
for (int i = connecthead; i >= 0; i = connectpoint2[i])
{
@ -1517,7 +1523,7 @@ int app_main(int argc, char const * const * argv)
Resource::heap = new QHeap(nMaxAlloc);
#endif
gSysRes.Init(pUserRFF ? pUserRFF : "BLOOD.RFF");
gGuiRes.Init("GUI.RFF");
//gGuiRes.Init("GUI.RFF");
gSoundRes.Init(pUserSoundRFF ? pUserSoundRFF : "SOUNDS.RFF");
HookReplaceFunctions();

View file

@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "levels.h"
#include "resource.h"
#include "db.h"
struct INIDESCRIPTION {
const char *pzName;

View file

@ -44,6 +44,62 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "triggers.h"
#include "view.h"
void makeMissileBlocking(int nSprite) // 23
{
dassert(nSprite >= 0 && nSprite < kMaxSprites);
if (sprite[nSprite].statnum != 5) return;
sprite[nSprite].cstat |= CSTAT_SPRITE_BLOCK;
}
void UniMissileBurst(int nSprite) // 22
{
dassert(nSprite >= 0 && nSprite < kMaxSprites);
if (sprite[nSprite].statnum != 5) return;
spritetype * pSprite = &sprite[nSprite];
int nAngle = getangle(xvel[nSprite], yvel[nSprite]);
int nRadius = 0x55555;
for (int i = 0; i < 8; i++)
{
spritetype* pBurst = actSpawnSprite(pSprite, 5);
pBurst->lotag = pSprite->lotag;
pBurst->shade = pSprite->shade;
pBurst->picnum = pSprite->picnum;
pBurst->cstat = pSprite->cstat;
if ((pBurst->cstat & CSTAT_SPRITE_BLOCK)) {
pBurst->cstat &= ~CSTAT_SPRITE_BLOCK; // we don't want missiles impact each other
evPost(pBurst->xvel, 3, 100, CALLBACK_ID_23); // so set blocking flag a bit later
}
pBurst->pal = pSprite->pal;
pBurst->clipdist = pSprite->clipdist / 4;
pBurst->hitag = pSprite->hitag;
pBurst->xrepeat = pSprite->xrepeat / 2;
pBurst->yrepeat = pSprite->yrepeat / 2;
pBurst->ang = ((pSprite->ang + missileInfo[pSprite->lotag - kMissileBase].at6) & 2047);
pBurst->owner = pSprite->owner;
actBuildMissile(pBurst, pBurst->extra, pSprite->xvel);
int nAngle2 = (i << 11) / 8;
int dx = 0;
int dy = mulscale30r(nRadius, Sin(nAngle2));
int dz = mulscale30r(nRadius, -Cos(nAngle2));
if (i & 1)
{
dy >>= 1;
dz >>= 1;
}
RotateVector(&dx, &dy, nAngle);
xvel[pBurst->index] += dx;
yvel[pBurst->index] += dy;
zvel[pBurst->index] += dz;
evPost(pBurst->index, 3, 960, CALLBACK_ID_1);
}
evPost(nSprite, 3, 0, CALLBACK_ID_1);
}
void sub_74C20(int nSprite) // 7
{
@ -730,5 +786,7 @@ void(*gCallback[kCallbackMax])(int) =
sub_768E8,
sub_766B8,
sub_769B4,
sub_76B78
sub_76B78,
UniMissileBurst,
makeMissileBlocking,
};

View file

@ -47,6 +47,8 @@ enum CALLBACK_ID {
CALLBACK_ID_19,
CALLBACK_ID_20,
CALLBACK_ID_21,
CALLBACK_ID_22, // by NoOne: UniMissileBurst();
CALLBACK_ID_23, // by NoOne: makeMissileBlocking();
kCallbackMax
};

View file

@ -83,12 +83,13 @@ void QuitGame(void);
#define kMissileBase 300
#define kMissileMax 318
#define kThingBase 400
#define kThingMax 435
#define kThingMax 436
#define kMaxPowerUps 49
#define kMaxPowerUps 51
#define kStatRespawn 8
#define kStatMarker 10
#define kStatGDXDudeTargetChanger 20
#define kStatFree 1024
#define kLensSize 80
@ -103,7 +104,7 @@ void QuitGame(void);
#define kItemBase 100
#define kWeaponItemBase 40
#define kItemMax 149
#define kItemMax 151
// marker sprite types
#define kMarkerSPStart 1
@ -122,16 +123,26 @@ void QuitGame(void);
#define kMarkerLowGoo 14
#define kMarkerPath 15
// sprite attributes
#define kHitagMovePhys 0x0001 // affected by movement physics
#define kHitagGravityPhys 0x0002 // affected by gravity
#define kHitagFalling 0x0004 // currently in z-motion
#define kHitagAutoAim 0x0008
#define kHitagRespawn 0x0010
#define kHitagFree 0x0020
#define kHitagSmoke 0x0100
#define kHitagExtBit 0x8000 // NoOne's extension bit(Note: it's bit 0 in editor!)
// sprite physics attributes
#define kPhysMove 0x0001 // affected by movement physics
#define kPhysGravity 0x0002 // affected by gravity
#define kPhysFalling 0x0004 // currently in z-motion
// additional physics attributes for debris sprites
#define kPhysDebrisFly 0x0008 // *debris* affected by negative gravity (fly instead of falling, DO NOT mess with kHitagAutoAim)
#define kPhysDebrisVector 0x0400 // *debris* can be affected by vector weapons
#define kPhysDebrisExplode 0x0800 // *debris* can be affected by explosions
// *modern types only hitag*
#define kModernTypeFlag0 0x0
#define kModernTypeFlag1 0x1
#define kModernTypeFlag2 0x2
#define kModernTypeFlag3 0x3
// sector types
#define kSecBase 600
@ -187,14 +198,18 @@ void QuitGame(void);
#define kGDXSectorFXChanger 34
#define kGDXObjDataChanger 35
#define kGDXSpriteDamager 36
// 37 reserved
#define kGDXObjDataAccumulator 37
#define kGDXEffectSpawner 38
#define kGDXWindGenerator 39
#define kModernConcussSprite 712
#define kGDXThingTNTProx 433 // detects only players
#define kGDXThingThrowableRock 434 // does small damage if hits target
#define kGDXDudeUniversalCultist 254
#define kGDXGenDudeBurning 255
#define kGDXThingCustomDudeLifeLeech 435 // the same as normal, except it aims in specified target
#define kCustomDude 254
#define kCustomDudeBurning 255
#define kGDXItemMapLevel 150 // once picked up, draws whole minimap
// ai state types
#define kAiStateOther -1
@ -536,18 +551,18 @@ inline int approxDist(int dx, int dy)
class Rect {
public:
int x1, y1, x2, y2;
Rect(int _x1, int _y1, int _x2, int _y2)
int x0, y0, x1, y1;
Rect(int _x0, int _y0, int _x1, int _y1)
{
x1 = _x1; y1 = _y1; x2 = _x2; y2 = _y2;
x0 = _x0; y0 = _y0; x1 = _x1; y1 = _y1;
}
bool isValid(void) const
{
return x1 < x2 && y1 < y2;
return x0 < x1 && y0 < y1;
}
char isEmpty(void) const
{
return !(x1 < x2 && y1 < y2);
return !isValid();
}
bool operator!(void) const
{
@ -556,12 +571,40 @@ public:
Rect & operator&=(Rect &pOther)
{
x1 = ClipLow(x1, pOther.x1);
y1 = ClipLow(y1, pOther.y1);
x2 = ClipHigh(x2, pOther.x2);
y2 = ClipHigh(y2, pOther.y2);
x0 = ClipLow(x0, pOther.x0);
y0 = ClipLow(y0, pOther.y0);
x1 = ClipHigh(x1, pOther.x1);
y1 = ClipHigh(y1, pOther.y1);
return *this;
}
void offset(int dx, int dy)
{
x0 += dx;
y0 += dy;
x1 += dx;
y1 += dy;
}
int height()
{
return y1 - y0;
}
int width()
{
return x1 - x0;
}
bool inside(Rect& other)
{
return (x0 <= other.x0 && x1 >= other.x1 && y0 <= other.y0 && y1 >= other.y1);
}
bool inside(int x, int y)
{
return (x0 <= x && x1 > x && y0 <= y && y1 > y);
}
};
class BitReader {

View file

@ -69,6 +69,7 @@ int32_t JoystickAnalogueSaturate[MAXJOYAXES];
uint8_t KeyboardKeys[NUMGAMEFUNCTIONS][2];
int32_t scripthandle;
int32_t setupread;
int32_t MusicRestartsOnLoadToggle;
int32_t configversion;
int32_t CheckForUpdates;
int32_t LastUpdateCheck;
@ -112,6 +113,10 @@ int32_t gFov;
int32_t gCenterHoriz;
int32_t gDeliriumBlur;
//////////
int gWeaponsV10x;
/////////
int32_t CONFIG_FunctionNameToNum(const char *func)
{
int32_t i;
@ -668,18 +673,18 @@ int CONFIG_ReadSetup(void)
if (scripthandle < 0)
{
if (buildvfs_exists(SetupFilename)) // JBF 20031211
scripthandle = SCRIPT_Load(SetupFilename);
if (buildvfs_exists(SetupFilename)) // JBF 20031211
scripthandle = SCRIPT_Load(SetupFilename);
#if !defined(EDUKE32_TOUCH_DEVICES) && !defined(EDUKE32_STANDALONE)
else if (buildvfs_exists(SETUPFILENAME))
{
int const i = wm_ynbox("Import Configuration Settings",
"The configuration file \"%s\" was not found. "
"Import configuration data from \"%s\"?",
SetupFilename, SETUPFILENAME);
if (i)
scripthandle = SCRIPT_Load(SETUPFILENAME);
}
else if (buildvfs_exists(SETUPFILENAME))
{
int const i = wm_ynbox("Import Configuration Settings",
"The configuration file \"%s\" was not found. "
"Import configuration data from \"%s\"?",
SetupFilename, SETUPFILENAME);
if (i)
scripthandle = SCRIPT_Load(SETUPFILENAME);
}
#endif
}
@ -688,6 +693,11 @@ int CONFIG_ReadSetup(void)
if (scripthandle < 0)
return -1;
// Nuke: make cvar
///////
SCRIPT_GetNumber(scripthandle, "Game Options", "WeaponsV10x", &gWeaponsV10x);
///////
char commmacro[] = "CommbatMacro# ";
for (int i = 0; i < MAXRIDECULE; i++)
@ -995,6 +1005,10 @@ void CONFIG_WriteSetup(uint32_t flags)
SCRIPT_PutString(scripthandle, "Comm Setup",commmacro,&CommbatMacro[dummy][0]);
}
///////
SCRIPT_PutNumber(scripthandle, "Game Options", "WeaponsV10x", gWeaponsV10x, FALSE, FALSE);
///////
SCRIPT_Save(scripthandle, SetupFilename);
if ((flags & 2) == 0)

View file

@ -50,6 +50,7 @@ extern int32_t JoystickAnalogueSaturate[MAXJOYAXES];
extern uint8_t KeyboardKeys[NUMGAMEFUNCTIONS][2];
extern int32_t scripthandle;
extern int32_t setupread;
extern int32_t MusicRestartsOnLoadToggle;
extern int32_t configversion;
extern int32_t CheckForUpdates;
extern int32_t LastUpdateCheck;
@ -87,10 +88,16 @@ extern bool gFullMap;
extern hashtable_t h_gamefuncs;
extern int32_t gUpscaleFactor;
extern int32_t gLevelStats;
extern int32_t gPowerupDuration;
extern int32_t gShowMapTitle;
extern int32_t gFov;
extern int32_t gCenterHoriz;
extern int32_t gDeliriumBlur;
///////
extern int gWeaponsV10x;
//////
int CONFIG_ReadSetup(void);
void CONFIG_WriteSetup(uint32_t flags);
void CONFIG_SetDefaults(void);

View file

@ -187,8 +187,8 @@ void ctrlGetInput(void)
CONTROL_GetInput(&info);
if (MouseDeadZone)
{
if (MouseDeadZone)
{
if (info.mousey > 0)
info.mousey = max(info.mousey - MouseDeadZone, 0);
else if (info.mousey < 0)
@ -198,15 +198,15 @@ void ctrlGetInput(void)
info.mousex = max(info.mousex - MouseDeadZone, 0);
else if (info.mousex < 0)
info.mousex = min(info.mousex + MouseDeadZone, 0);
}
}
if (MouseBias)
{
if (MouseBias)
{
if (klabs(info.mousex) > klabs(info.mousey))
info.mousey = tabledivide32_noinline(info.mousey, MouseBias);
else
info.mousex = tabledivide32_noinline(info.mousex, MouseBias);
}
}
if (gQuitRequest)
gInput.keyFlags.quit = 1;

View file

@ -168,6 +168,7 @@ int credKOpen4Load(char *&pzFile)
void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav)
{
return;
#if 0
CSMKPlayer smkPlayer;
if (dword_148E14 >= 0)

View file

@ -519,6 +519,8 @@ void dbXWallClean(void)
void dbXSectorClean(void)
{
for (int i = 0; i < numsectors; i++)
{
int nXSector = sector[i].extra;
@ -1038,7 +1040,7 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short
pXWall->key = bitReader.readUnsigned(3);
pXWall->triggerPush = bitReader.readUnsigned(1);
pXWall->triggerVector = bitReader.readUnsigned(1);
pXWall->triggerReserved = bitReader.readUnsigned(1);
pXWall->triggerTouch = bitReader.readUnsigned(1);
pXWall->at11_0 = bitReader.readUnsigned(2);
pXWall->xpanFrac = bitReader.readUnsigned(8);
pXWall->ypanFrac = bitReader.readUnsigned(8);
@ -1077,12 +1079,6 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short
pSprite->hitag = B_LITTLE16(pSprite->hitag);
pSprite->extra = B_LITTLE16(pSprite->extra);
#endif
// NoOne's extension bit
if (pSprite->hitag&1)
{
pSprite->hitag &= ~1;
pSprite->hitag |= kHitagExtBit;
}
InsertSpriteSect(i, sprite[i].sectnum);
InsertSpriteStat(i, sprite[i].statnum);
Numsprites++;
@ -1284,8 +1280,8 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short
int dbSaveMap(const char *pPath, int nX, int nY, int nZ, short nAngle, short nSector)
{
char sMapExt[_MAX_PATH];
char sBakExt[_MAX_PATH];
char sMapExt[BMAX_PATH];
char sBakExt[BMAX_PATH];
int16_t tpskyoff[256];
int nSpriteNum;
psky_t *pSky = tileSetupSky(0);
@ -1527,7 +1523,7 @@ int dbSaveMap(const char *pPath, int nX, int nY, int nZ, short nAngle, short nSe
bitWriter.write(pXWall->key, 3);
bitWriter.write(pXWall->triggerPush, 1);
bitWriter.write(pXWall->triggerVector, 1);
bitWriter.write(pXWall->triggerReserved, 1);
bitWriter.write(pXWall->triggerTouch, 1);
bitWriter.write(pXWall->at11_0, 2);
bitWriter.write(pXWall->xpanFrac, 8);
bitWriter.write(pXWall->ypanFrac, 8);

View file

@ -26,6 +26,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define kMaxXWalls 512
#define kMaxXSectors 512
// by NoOne additional non-thing proximity, sight and physics sprites
#define kMaxSuperXSprites 128
#pragma pack(push, 1)
struct AISTATE;
@ -52,14 +55,14 @@ struct XSPRITE {
unsigned int respawnPending : 2; // respawnPending
signed int dropMsg : 10; // Drop Item
signed int dropMsg : 8; // Drop Item
unsigned int Decoupled : 1; // Decoupled
unsigned int triggerOnce : 1; // 1-shot
unsigned int isTriggered : 1; // works in case if triggerOnce selected
unsigned int key : 3; // Key
unsigned int wave : 2; // Wave
unsigned int Push: 1; // Push
unsigned int Push : 1; // Push
unsigned int Vector : 1; // Vector
unsigned int Impact : 1; // Impact
unsigned int Pickup : 1; // Pickup
@ -95,9 +98,9 @@ struct XSPRITE {
signed int burnSource : 16;
unsigned int height : 16;
unsigned int stateTimer : 16; // ai timer
AISTATE *aiState; // ai
signed int txIndex : 10; // used by kGDXSequentialTX to keep current TX ID index
signed int cumulDamage : 16; // for dudes
AISTATE* aiState; // ai
signed int sysData1 : 16; // used to keep here various system data, so user can't change it in map editor
unsigned int physAttr : 12; // currently used by additional physics sprites to keep it's attributes.
signed int scale; // used for scaling SEQ size on sprites
};
@ -207,7 +210,7 @@ struct XWALL {
unsigned int key : 3; // Key
unsigned int triggerPush : 1; // Push
unsigned int triggerVector : 1; // Vector
unsigned int triggerReserved : 1; // Reserved
unsigned int triggerTouch : 1; // by NoOne: renamed from Reserved to Touch as it works with Touch now.
unsigned int at11_0 : 2; // unused
unsigned int xpanFrac : 8; // x panning frac
unsigned int ypanFrac : 8; // y panning frac

View file

@ -750,7 +750,7 @@ DUDEINFO dudeInfo[kDudeMax-kDudeBase] =
0,
0,
7, -1, -1,
128, 256, 128, 256, 128, 128, 256,
256, 256, 256, 256, 256, 256, 256,
0, 0, 0, 0, 0, 0, 0,
0,
0
@ -1554,7 +1554,7 @@ DUDEINFO dudeInfo[kDudeMax-kDudeBase] =
// 0,
618, // melee distance
5, // flee health
12, // hinder damage
5, // hinder damage
0x0100, // change target chance
0x0010, // change target to kin chance
0x8000, // alertChance

View file

@ -47,7 +47,6 @@ enum COMMAND_ID {
kCommandCallback = 20,
COMMAND_ID_21,
kGDXCommandPaste = 53, // used by some new GDX types
kGDXCommandSpriteDamage, // used by sprite damager GDX type
COMMAND_ID_64 = 64,
};

View file

@ -79,9 +79,9 @@ FXDATA gFXData[] = {
{ CALLBACK_ID_NONE, 1, 0, 3, 58254, 1024, 480, 3269, 32, 32, 0, 0, 0 },
{ CALLBACK_ID_NONE, 1, 0, 3, 58254, 1024, 480, 3273, 32, 32, 0, 0, 0 },
{ CALLBACK_ID_NONE, 1, 0, 3, 58254, 1024, 480, 3277, 32, 32, 0, 0, 0 },
{ CALLBACK_ID_NONE, 2, 0, 1, -27962, 8192, 600, 1128, 16, 16, 514, -16, 0 },
{ CALLBACK_ID_NONE, 2, 0, 1, -18641, 8192, 600, 1128, 12, 12, 514, -16, 0 },
{ CALLBACK_ID_NONE, 2, 0, 1, -9320, 8192, 600, 1128, 8, 8, 514, -16, 0 },
{ CALLBACK_ID_NONE, 2, 0, 1, -27962, 8192, 600, 1128, 16, 16, 514, -16, 0 }, // bubble 1
{ CALLBACK_ID_NONE, 2, 0, 1, -18641, 8192, 600, 1128, 12, 12, 514, -16, 0 }, // bubble 2
{ CALLBACK_ID_NONE, 2, 0, 1, -9320, 8192, 600, 1128, 8, 8, 514, -16, 0 }, // bubble 3
{ CALLBACK_ID_NONE, 2, 0, 1, -18641, 8192, 600, 1131, 32, 32, 514, -16, 0 },
{ CALLBACK_ID_14, 2, 0, 3, 27962, 4096, 480, 733, 32, 32, 0, -16, 0 },
{ CALLBACK_ID_NONE, 1, 0, 3, 18641, 4096, 120, 2261, 12, 12, 0, -128, 0 },

View file

@ -830,12 +830,14 @@ bool CGameMenuItem7EA1C::Event(CGameMenuEvent &event)
if (at24)
delete at24;
at24 = new CGameMenu(1);
/*
DICTNODE *pRes = gGuiRes.Lookup(at38, "MNU");
if (pRes)
{
at34 = new IniFile(gGuiRes.Load(pRes));
Setup();
}
*/
if (at24)
gGameMenuMgr.Push(at24, at28);
return false;
@ -2891,7 +2893,7 @@ void CGameMenuItemPassword::Draw(void)
gMenuTextMgr.GetFontInfo(m_nFont, kInvalidPasswordMsg, &width, NULL);
gMenuTextMgr.DrawText(kInvalidPasswordMsg, m_nFont, m_nX - width / 2, m_nY + 20, shade, 0, false);
}
if (at5b && totalclock.Ticks() -at5b > 256)
if (at5b && totalclock-at5b > 256)
{
at5b = 0;
at37 = 0;

View file

@ -54,6 +54,7 @@ struct GAMEOPTIONS {
int nWeaponRespawnTime;
int nItemRespawnTime;
int nSpecialRespawnTime;
int weaponsV10x;
bool bFriendlyFire;
bool bKeepKeysOnRespawn;
};

View file

@ -313,6 +313,7 @@ void MyLoadSave::Load(void)
Read(&numyaxbunches, sizeof(numyaxbunches));
#endif
gCheatMgr.sub_5BCF4();
}
void MyLoadSave::Save(void)

View file

@ -54,7 +54,6 @@ public:
extern unsigned int gSavedOffset;
extern GAMEOPTIONS gSaveGameOptions[];
extern char *gSaveGamePic[10];
void UpdateSavedInfo(int nSlot);
void LoadSavedInfo(void);
void LoadSaveSetup(void);

View file

@ -76,6 +76,8 @@ void UpdateVideoModeMenuFrameLimit(CGameMenuItemZCycle *pItem);
void UpdateVideoModeMenuFPSOffset(CGameMenuItemSlider *pItem);
void UpdateVideoColorMenu(CGameMenuItemSliderFloat *);
void ResetVideoColor(CGameMenuItemChain *);
void SetWeaponsV10X(CGameMenuItemZBool* pItem);
#ifdef USE_OPENGL
void SetupVideoPolymostMenu(CGameMenuItemChain *);
#endif
@ -391,6 +393,11 @@ void SetShowMapTitle(CGameMenuItemZBool*);
void SetWeaponSwitch(CGameMenuItemZCycle *pItem);
CGameMenuItemTitle itemOptionsGameTitle("GAME SETUP", 1, 160, 20, 2038);
///////////////
CGameMenuItemZBool itemOptionsGameBoolWeaponsV10X("V1.0x WEAPONS BALANCE:", 3, 66, 130, 180, gWeaponsV10x, SetWeaponsV10X, NULL, NULL);
///////////////////
CGameMenuItemZBool itemOptionsGameBoolShowWeapons("SHOW WEAPONS:", 3, 66, 70, 180, gShowWeapon, SetShowWeapons, NULL, NULL);
CGameMenuItemZBool itemOptionsGameBoolSlopeTilting("SLOPE TILTING:", 3, 66, 80, 180, gSlopeTilting, SetSlopeTilting, NULL, NULL);
CGameMenuItemZBool itemOptionsGameBoolViewBobbing("VIEW BOBBING:", 3, 66, 90, 180, gViewVBobbing, SetViewBobbing, NULL, NULL);
@ -1096,6 +1103,13 @@ void SetupOptionsMenu(void)
menuOptionsGame.Add(&itemOptionsGameBoolViewSwaying, false);
menuOptionsGame.Add(&itemOptionsGameBoolAutoAim, false);
menuOptionsGame.Add(&itemOptionsGameWeaponSwitch, false);
//////////////////////
if (gGameOptions.nGameType == 0) {
menuOptionsGame.Add(&itemOptionsGameBoolWeaponsV10X, false);
}
/////////////////////
//menuOptionsGame.Add(&itemOptionsGameChainParentalLock, false);
menuOptionsGame.Add(&itemBloodQAV, false);
itemOptionsGameBoolShowWeapons.at20 = gShowWeapon;
@ -1105,6 +1119,10 @@ void SetupOptionsMenu(void)
itemOptionsGameBoolAutoAim.m_nFocus = gAutoAim;
itemOptionsGameWeaponSwitch.m_nFocus = (gWeaponSwitch&1) ? ((gWeaponSwitch&2) ? 1 : 2) : 0;
///////
itemOptionsGameBoolWeaponsV10X.at20 = gWeaponsV10x;
///////
menuOptionsDisplay.Add(&itemOptionsDisplayTitle, false);
menuOptionsDisplay.Add(&itemOptionsDisplayColor, true);
menuOptionsDisplay.Add(&itemOptionsDisplayMode, false);
@ -1365,6 +1383,16 @@ void ResetKeysClassic(CGameMenuItemChain *)
CONFIG_SetDefaultKeys(oldkeydefaults);
}
////
void SetWeaponsV10X(CGameMenuItemZBool* pItem)
{
if (gGameOptions.nGameType == 0) {
gWeaponsV10x = pItem->at20;
gGameOptions.weaponsV10x = pItem->at20;
}
}
////
void SetShowWeapons(CGameMenuItemZBool *pItem)
{
gShowWeapon = pItem->at20;
@ -2167,6 +2195,11 @@ void StartNetGame(CGameMenuItemChain *pItem)
strncpy(gPacketStartGame.userMapName, itemNetStart10.at20, 13);
gPacketStartGame.userMapName[12] = 0;
gPacketStartGame.userMap = gPacketStartGame.userMapName[0] != 0;
////
gPacketStartGame.weaponsV10x = gWeaponsV10x;
////
netBroadcastNewGame();
gStartNewGame = 1;
gGameMenuMgr.Deactivate();

View file

@ -76,6 +76,7 @@ struct PKT_STARTGAME {
char episodeId, levelId;
int unk;
char userMap, userMapName[13];
int weaponsV10x;
bool bFriendlyFire;
bool bKeepKeysOnRespawn;
};

View file

@ -1325,13 +1325,13 @@ char PickupWeapon(PLAYER *pPlayer, spritetype *pWeapon)
sfxPlay3DSound(pPlayer->pSprite, 777, -1, 0);
return 1;
}
if (!actGetRespawnTime(pWeapon))
return 0;
if (nAmmoType == -1)
return 0;
if (pPlayer->at181[nAmmoType] >= gAmmoInfo[nAmmoType].at0)
return 0;
pPlayer->at181[nAmmoType] = ClipHigh(pPlayer->at181[nAmmoType]+pWeaponItemData->atc, gAmmoInfo[nAmmoType].at0);
if (!actGetRespawnTime(pWeapon) || nAmmoType == -1 || pPlayer->at181[nAmmoType] >= gAmmoInfo[nAmmoType].at0) return 0;
else if (pWeapon->extra < 0 || xsprite[pWeapon->extra].data1 <= 0 || VanillaMode() || DemoRecordStatus())
pPlayer->at181[nAmmoType] = ClipHigh(pPlayer->at181[nAmmoType]+pWeaponItemData->atc, gAmmoInfo[nAmmoType].at0);
else
pPlayer->at181[nAmmoType] = ClipHigh(pPlayer->at181[nAmmoType] + xsprite[pWeapon->extra].data1, gAmmoInfo[nAmmoType].at0);
sfxPlay3DSound(pPlayer->pSprite, 777, -1, 0);
return 1;
}
@ -1342,28 +1342,27 @@ void PickUp(PLAYER *pPlayer, spritetype *pSprite)
int nType = pSprite->type;
char pickedUp = 0;
int customMsg = -1;
if (nType != 40 && nType != 80) { // By NoOne: no pickup for random item generators.
XSPRITE* pXSprite = (pSprite->extra >= 0) ? &xsprite[pSprite->extra] : NULL;
if (pXSprite != NULL && pXSprite->txID != 3 && pXSprite->lockMsg > 0) // by NoOne: allow custom INI message instead "Picked up"
customMsg = pXSprite->lockMsg;
XSPRITE* pXSprite = (pSprite->extra >= 0) ? &xsprite[pSprite->extra] : NULL;
if (pXSprite != NULL && pXSprite->txID != 3 && pXSprite->lockMsg > 0) // by NoOne: allow custom INI message instead "Picked up"
customMsg = pXSprite->lockMsg;
if (nType >= 100 && nType <= 149)
{
pickedUp = PickupItem(pPlayer, pSprite);
if (pickedUp && customMsg == -1) sprintf(buffer, "Picked up %s", gItemText[nType - 100]);
}
else if (nType >= 60 && nType < 81)
{
pickedUp = PickupAmmo(pPlayer, pSprite);
if (pickedUp && customMsg == -1) sprintf(buffer, "Picked up %s", gAmmoText[nType - 60]);
}
else if (nType >= 40 && nType < 51)
{
pickedUp = PickupWeapon(pPlayer, pSprite);
if (pickedUp && customMsg == -1) sprintf(buffer, "Picked up %s", gWeaponText[nType - 40]);
}
if (nType >= 100 && nType <= 149)
{
pickedUp = PickupItem(pPlayer, pSprite);
if (pickedUp && customMsg == -1) sprintf(buffer, "Picked up %s", gItemText[nType - 100]);
}
else if (nType >= 60 && nType < 81)
{
pickedUp = PickupAmmo(pPlayer, pSprite);
if (pickedUp && customMsg == -1) sprintf(buffer, "Picked up %s", gAmmoText[nType - 60]);
}
else if (nType >= 40 && nType < 51)
{
pickedUp = PickupWeapon(pPlayer, pSprite);
if (pickedUp && customMsg == -1) sprintf(buffer, "Picked up %s", gWeaponText[nType - 40]);
}
if (pickedUp)
{
if (pSprite->extra > 0)

View file

@ -36,7 +36,7 @@ int qanimateoffs(int a1, int a2)
int frames = picanm[a1].num;
if (frames > 0)
{
int const frameClock = gFrameClock);
int const frameClock = (int)gFrameClock;
int vd;
if ((a2&0xc000) == 0x8000)
vd = (Bcrc32(&a2, 2, 0)+frameClock)>>(picanm[a1].sf&PICANM_ANIMSPEED_MASK);

View file

@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gameutil.h"
#include "globals.h"
#include "trig.h"
#include "sectorfx.h"
char flicker1[] = {
0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0,
@ -105,8 +106,10 @@ int GetWaveValue(int a, int b, int c)
return 0;
}
int shadeCount;
short shadeList[512];
int shadeCount = 0;
short shadeList[kMaxXSectors];
int panCount = 0;
short panList[kMaxXSectors];
void DoSectorLighting(void)
{
@ -251,8 +254,6 @@ void UndoSectorLighting(void)
}
}
int panCount;
short panList[kMaxXSectors];
short wallPanList[kMaxXWalls];
int wallPanCount;

View file

@ -22,6 +22,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//-------------------------------------------------------------------------
#pragma once
extern int shadeCount;
extern short shadeList[kMaxXSectors];
extern int panCount;
extern short panList[kMaxXSectors];
void DoSectorLighting(void);
void UndoSectorLighting(void);
void DoSectorPanning(void);

View file

@ -346,7 +346,7 @@ void sfxPlay3DSoundCP(spritetype* pSprite, int soundId, int a3, int a4, int pitc
pBonkle->at2c = pBonkle->at20;
pBonkle->atc = soundId;
pBonkle->at8 = hRes;
pBonkle->at1c = (volume <= 0) ? pEffect->relVol : volume;
pBonkle->at1c = ((volume == 0) ? pEffect->relVol : ((volume == -1) ? 0 : ((volume > 255) ? 255 : volume)));
pBonkle->at18 = v14;
Calc3DValues(pBonkle);
int priority = 1;

View file

@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "dynamicgtk.h"
#include "blood.h"
#include "gtkpixdata.h"
#include "globals.h"
enum
{

View file

@ -11,6 +11,7 @@
#include "build.h"
#include "compat.h"
#include "baselayer.h"
#include "globals.h"
#ifndef MAC_OS_X_VERSION_10_5
# define NSImageScaleNone NSScaleNone

File diff suppressed because it is too large Load diff

View file

@ -43,7 +43,6 @@ void trTextOver(int nId);
// By NoOne: functions required for new features
// -------------------------------------------------------
void pastePropertiesInObj(int type, int nDest, EVENT event);
void trDamageSprite(int type, int nDest, EVENT event);
spritetype* getTargetInRange(spritetype* pSprite, int minDist, int maxDist, short data, short teamMode);
bool isMateOf(XSPRITE* pXDude, XSPRITE* pXSprite);
spritetype* targetIsPlayer(XSPRITE* pXSprite);
@ -56,7 +55,7 @@ void disturbDudesInSight(spritetype* pSprite, int max);
int getTargetDist(spritetype* pSprite, DUDEINFO* pDudeInfo, spritetype* pTarget);
int getFineTargetDist(spritetype* pSprite, spritetype* pTarget);
bool IsBurningDude(spritetype* pSprite);
bool IsKillableDude(spritetype* pSprite, bool locked);
bool IsKillableDude(spritetype* pSprite);
bool isAnnoyingUnit(spritetype* pDude);
bool unitCanFly(spritetype* pDude);
bool isMeleeUnit(spritetype* pDude);
@ -69,5 +68,8 @@ bool getDudesForTargetChg(XSPRITE* pXSprite);
void stopWindOnSectors(XSPRITE* pXSource);
void useSectorWindGen(XSPRITE* pXSource, sectortype* pSector);
void useEffectGen(XSPRITE* pXSource, spritetype* pSprite);
void useSeqSpawnerGen(XSPRITE* pXSource, spritetype* pSprite);
void useSeqSpawnerGen(XSPRITE* pXSource, int objType, int index);
void useSpriteDamager(XSPRITE* pXSource, spritetype* pSprite);
void useTeleportTarget(XSPRITE* pXSource, spritetype* pSprite);
void TeleFrag(int nKiller, int nSector);
// -------------------------------------------------------

View file

@ -1023,10 +1023,10 @@ void viewTileSprite(int nTile, int nShade, int nPalette, int x1, int y1, int x2,
dassert(nTile >= 0 && nTile < kMaxTiles);
int width = tilesiz[nTile].x;
int height = tilesiz[nTile].y;
int bx1 = DecBy(rect1.x1+1, width);
int by1 = DecBy(rect1.y1+1, height);
int bx2 = IncBy(rect1.x2-1, width);
int by2 = IncBy(rect1.y2-1, height);
int bx1 = DecBy(rect1.x0+1, width);
int by1 = DecBy(rect1.y0+1, height);
int bx2 = IncBy(rect1.x1-1, width);
int by2 = IncBy(rect1.y1-1, height);
for (int x = bx1; x < bx2; x += width)
for (int y = by1; y < by2; y += height)
rotatesprite(x<<16, y<<16, 65536, 0, nTile, nShade, nPalette, 64+16+8, x1, y1, x2-1, y2-1);
@ -2204,13 +2204,11 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t
break;
case 1:
{
#ifdef USE_OPENGL
if (videoGetRenderMode() >= REND_POLYMOST && usemodels && md_tilehasmodel(pTSprite->picnum, pTSprite->pal) >= 0 && !(spriteext[nSprite].flags&SPREXT_NOTMD))
if (tilehasmodelorvoxel(pTSprite->picnum, pTSprite->pal) && !(spriteext[nSprite].flags&SPREXT_NOTMD))
{
pTSprite->cstat &= ~4;
break;
}
#endif
int dX = cX - pTSprite->x;
int dY = cY - pTSprite->y;
RotateVector(&dX, &dY, 128-pTSprite->ang);
@ -2228,13 +2226,11 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t
}
case 2:
{
#ifdef USE_OPENGL
if (videoGetRenderMode() >= REND_POLYMOST && usemodels && md_tilehasmodel(pTSprite->picnum, pTSprite->pal) >= 0 && !(spriteext[nSprite].flags&SPREXT_NOTMD))
if (tilehasmodelorvoxel(pTSprite->picnum, pTSprite->pal) && !(spriteext[nSprite].flags&SPREXT_NOTMD))
{
pTSprite->cstat &= ~4;
break;
}
#endif
int dX = cX - pTSprite->x;
int dY = cY - pTSprite->y;
RotateVector(&dX, &dY, 128-pTSprite->ang);
@ -2270,6 +2266,7 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t
if ((pTSprite->hitag&16) == 0)
{
pTSprite->cstat |= 48;
pTSprite->cstat &= ~(4|8);
pTSprite->yoffset += picanm[pTSprite->picnum].yofs;
pTSprite->picnum = voxelIndex[pTSprite->picnum];
if (!voxoff[pTSprite->picnum])
@ -2289,9 +2286,15 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t
nAnim--;
}
if (usevoxels && videoGetRenderMode() != REND_POLYMER && tiletovox[pTSprite->picnum] != -1)
if ((pTSprite->cstat&48) != 48)
{
pTSprite->yoffset += picanm[pTSprite->picnum].yofs;
int nAnimTile = pTSprite->picnum + animateoffs_replace(pTSprite->picnum, 32768+pTSprite->owner);
if (usevoxels && videoGetRenderMode() != REND_POLYMER && tiletovox[nAnimTile] != -1)
{
pTSprite->yoffset += picanm[nAnimTile].yofs;
pTSprite->xoffset += picanm[nAnimTile].xofs;
}
}
sectortype *pSector = &sector[pTSprite->sectnum];

View file

@ -1382,41 +1382,79 @@ void FireVoodoo(int nTrigger, PLAYER *pPlayer)
void AltFireVoodoo(int nTrigger, PLAYER *pPlayer)
{
if (nTrigger != 2)
return;
//int nAmmo = pPlayer->at181[9];
int nCount = ClipHigh(pPlayer->at181[9], pPlayer->at1da);
if (nCount > 0)
{
int v4 = pPlayer->at181[9] - (pPlayer->at181[9] / nCount)*nCount;
for (int i = 0; i < pPlayer->at1da; i++)
{
int nTarget = pPlayer->at1de[i];
spritetype *pTarget = &sprite[nTarget];
if (v4 > 0)
v4--;
int nDist = approxDist(pTarget->x-pPlayer->pSprite->x, pTarget->y-pPlayer->pSprite->y);
if (nDist > 0 && nDist < 51200)
if (nTrigger == 2) {
// by NoOne: trying to simulate v1.0x voodoo here.
// dunno how exactly it works, but at least it not spend all the ammo on alt fire
if (gGameOptions.weaponsV10x && !VanillaMode() && !DemoRecordStatus()) {
int nCount = ClipHigh(pPlayer->at181[9], pPlayer->at1da);
if (nCount > 0)
{
int vc = pPlayer->at181[9]>>3;
int v8 = pPlayer->at181[9]<<1;
int nDamage = (v8+Random2(vc))<<4;
nDamage = (nDamage*((51200-nDist)+1))/51200;
nDamage = actDamageSprite(pPlayer->at5b, pTarget, DAMAGE_TYPE_5, nDamage);
UseAmmo(pPlayer, 9, nDamage);
if (pTarget->type >= kDudePlayer1 && pTarget->type <= kDudePlayer8)
for (int i = 0; i < pPlayer->at1da; i++)
{
PLAYER *pOtherPlayer = &gPlayer[pTarget->type-kDudePlayer1];
if (!pOtherPlayer->at31a || !powerupCheck(pOtherPlayer,14))
powerupActivate(pOtherPlayer, 28);
int nTarget = pPlayer->at1de[i];
spritetype* pTarget = &sprite[nTarget];
int nDist = approxDist(pTarget->x - pPlayer->pSprite->x, pTarget->y - pPlayer->pSprite->y);
if (nDist > 0 && nDist < 51200)
{
int vc = pPlayer->at181[9] >> 3;
int v8 = pPlayer->at181[9] << 1;
int nDamage = (v8 + Random(vc)) << 4;
nDamage = (nDamage * ((51200 - nDist) + 1)) / 51200;
nDamage = actDamageSprite(pPlayer->at5b, pTarget, DAMAGE_TYPE_5, nDamage);
if (pTarget->type >= kDudePlayer1 && pTarget->type <= kDudePlayer8)
{
PLAYER* pOtherPlayer = &gPlayer[pTarget->type - kDudePlayer1];
if (!pOtherPlayer->at31a || !powerupCheck(pOtherPlayer, 14))
powerupActivate(pOtherPlayer, 28);
}
fxSpawnBlood(pTarget, 0);
}
}
}
UseAmmo(pPlayer, 9, 20);
pPlayer->atc3 = 0;
return;
}
//int nAmmo = pPlayer->at181[9];
int nCount = ClipHigh(pPlayer->at181[9], pPlayer->at1da);
if (nCount > 0)
{
int v4 = pPlayer->at181[9] - (pPlayer->at181[9] / nCount) * nCount;
for (int i = 0; i < pPlayer->at1da; i++)
{
int nTarget = pPlayer->at1de[i];
spritetype* pTarget = &sprite[nTarget];
if (v4 > 0)
v4--;
int nDist = approxDist(pTarget->x - pPlayer->pSprite->x, pTarget->y - pPlayer->pSprite->y);
if (nDist > 0 && nDist < 51200)
{
int vc = pPlayer->at181[9] >> 3;
int v8 = pPlayer->at181[9] << 1;
int nDamage = (v8 + Random2(vc)) << 4;
nDamage = (nDamage * ((51200 - nDist) + 1)) / 51200;
nDamage = actDamageSprite(pPlayer->at5b, pTarget, DAMAGE_TYPE_5, nDamage);
UseAmmo(pPlayer, 9, nDamage);
if (pTarget->type >= kDudePlayer1 && pTarget->type <= kDudePlayer8)
{
PLAYER* pOtherPlayer = &gPlayer[pTarget->type - kDudePlayer1];
if (!pOtherPlayer->at31a || !powerupCheck(pOtherPlayer, 14))
powerupActivate(pOtherPlayer, 28);
}
fxSpawnBlood(pTarget, 0);
}
fxSpawnBlood(pTarget, 0);
}
}
UseAmmo(pPlayer, 9, pPlayer->at181[9]);
pPlayer->atcb[10] = 0;
pPlayer->atc3 = -1;
}
UseAmmo(pPlayer, 9, pPlayer->at181[9]);
pPlayer->atcb[10] = 0;
pPlayer->atc3 = -1;
}
void DropVoodoo(int nTrigger, PLAYER *pPlayer)
@ -2357,9 +2395,11 @@ void WeaponProcess(PLAYER *pPlayer)
return;
case 5:
if (powerupCheck(pPlayer, 17))
StartQAV(pPlayer, 122, nClientAltFireNapalm, 0);
// by NoOne: allow napalm launcher alt fire act like in v1.0x versions
if (gGameOptions.weaponsV10x && !VanillaMode() && !DemoRecordStatus()) StartQAV(pPlayer, 123, nClientFireNapalm2, 0);
else StartQAV(pPlayer, 122, nClientAltFireNapalm, 0);
else
StartQAV(pPlayer, 91, nClientAltFireNapalm, 0);
StartQAV(pPlayer, 91, (gGameOptions.weaponsV10x && !VanillaMode() && !DemoRecordStatus()) ? nClientFireNapalm : nClientAltFireNapalm, 0);
return;
case 2:
if (CheckAmmo(pPlayer, 1, 8))

View file

@ -29,6 +29,7 @@ extern char modechange;
extern char nogl;
extern int32_t vsync;
extern int32_t swapcomplete;
extern int32_t r_borderless;
extern int32_t r_displayindex;

View file

@ -178,7 +178,7 @@ void yax_updategrays(int32_t posze);
# else
// More user tag hijacking: lotag/extra. :/
# define YAX_PTRNEXTWALL(Ptr, Wall, Cf) (*(int16_t *)(&Ptr[Wall].lotag + (bloodhack ? 1 : 2)*Cf))
# define YAX_NEXTWALLDEFAULT(Cf) (((Cf)==YAX_CEILING) ? 0 : -1)
# define YAX_NEXTWALLDEFAULT(Cf) (bloodhack ? 0 : ((Cf)==YAX_CEILING) ? 0 : -1)
extern int16_t yax_bunchnum[MAXSECTORS][2];
extern int16_t yax_nextwall[MAXWALLS][2];
# endif
@ -948,6 +948,9 @@ static FORCE_INLINE int32_t videoGetRenderMode(void)
#endif
}
extern int32_t bloodhack;
extern int32_t blooddemohack;
/*************************************************************************
POSITION VARIABLES:

View file

@ -182,17 +182,19 @@ typedef struct
union {
struct
{
StructTracker(Sprite, int16_t) xvel /*index*/, yvel, zvel;
union {
StructTracker(Sprite, int16_t) xvel;
StructTracker(Sprite, int16_t) index;
};
StructTracker(Sprite, int16_t) yvel, zvel;
};
StructTracker(Sprite, int16_t) index;
vec3_16_t vel;
vec3_16_t vel;
};
union {
struct {
StructTracker(Sprite, int16_t) lotag /*type*/, hitag;
};
StructTracker(Sprite, int16_t) type;
};
union {
StructTracker(Sprite, int16_t) lotag;
StructTracker(Sprite, int16_t) type;
};
StructTracker(Sprite, int16_t) hitag;
StructTracker(Sprite, int16_t) extra;
} StructName(spritetypev7);

View file

@ -131,7 +131,6 @@ public:
explicit operator uint32_t() const { return wholeTicks; };
explicit operator int32_t() const { return wholeTicks; };
int32_t Ticks() const { return wholeTicks; }
private:
//POGO: wholeTicks must be first in member-order to ensure the address of

View file

@ -160,7 +160,7 @@ static FORCE_INLINE int polymost_is_npotmode(void)
#ifdef NEW_MAP_FORMAT
g_loadedMapVersion < 10 &&
#endif
(playing_rr? r_npotwallmode == 1 : r_npotwallmode != 0); // I have no idea which one is more correct...
r_npotwallmode;
}
static inline float polymost_invsqrt_approximation(float x)

View file

@ -1111,18 +1111,18 @@ int32_t kopen4load(const char *filename, char searchfirst)
char g_modDir[BMAX_PATH] = "/";
buildvfs_kfd kopen4loadfrommod(const char* fileName, char searchfirst)
buildvfs_kfd kopen4loadfrommod(const char *fileName, char searchfirst)
{
buildvfs_kfd kFile = buildvfs_kfd_invalid;
buildvfs_kfd kFile = buildvfs_kfd_invalid;
if (g_modDir[0] != '/' || g_modDir[1] != 0)
{
static char staticFileName[BMAX_PATH];
Bsnprintf(staticFileName, sizeof(staticFileName), "%s/%s", g_modDir, fileName);
kFile = kopen4load(staticFileName, searchfirst);
}
if (g_modDir[0] != '/' || g_modDir[1] != 0)
{
static char staticFileName[BMAX_PATH];
Bsnprintf(staticFileName, sizeof(staticFileName), "%s/%s", g_modDir, fileName);
kFile = kopen4load(staticFileName, searchfirst);
}
return (kFile == buildvfs_kfd_invalid) ? kopen4load(fileName, searchfirst) : kFile;
return (kFile == buildvfs_kfd_invalid) ? kopen4load(fileName, searchfirst) : kFile;
}
int32_t kread_internal(int32_t handle, void *buffer, int32_t leng, const uint8_t *arraygrp, const intptr_t *arrayhan, int32_t *arraypos)

View file

@ -794,15 +794,15 @@ static int cliptestsector(int const dasect, int const nextsect, int32_t const fl
if (blooddemohack)
{
int32_t daz = getflorzofslope(dasect, pos.x, pos.y);
int32_t daz2 = getflorzofslope(nextsect, pos.x, pos.y);
int32_t daz = getflorzofslope(dasect, pos.x, pos.y);
int32_t daz2 = getflorzofslope(nextsect, pos.x, pos.y);
if (daz2 < daz-(1<<8) && (sec2->floorstat&1) == 0)
if (posz >= daz2-(flordist-1)) return 1;
daz = getceilzofslope(dasect, pos.x, pos.y);
daz2 = getceilzofslope(nextsect, pos.x, pos.y);
if (daz2 > daz+(1<<8) && (sec2->ceilingstat&1) == 0)
if (posz <= daz2+(ceildist-1)) return 1;
if (daz2 < daz-(1<<8) && (sec2->floorstat&1) == 0)
if (posz >= daz2-(flordist-1)) return 1;
daz = getceilzofslope(dasect, pos.x, pos.y);
daz2 = getceilzofslope(nextsect, pos.x, pos.y);
if (daz2 > daz+(1<<8) && (sec2->ceilingstat&1) == 0)
if (posz <= daz2+(ceildist-1)) return 1;
return 0;
}
@ -817,7 +817,6 @@ static int cliptestsector(int const dasect, int const nextsect, int32_t const fl
return 1;
auto const sec = (usectorptr_t)&sector[dasect];
int32_t daz = sec->floorz;
int32_t dacz = sec->ceilingz;
@ -1373,17 +1372,17 @@ int32_t clipmove(vec3_t * const pos, int16_t * const sectnum, int32_t xvect, int
do
{
if (!blooddemohack)
for (native_t i=clipnum-1;i>=0;--i)
{
if (!bitmap_test(clipignore, i) && clipinsideboxline(pos->x, pos->y, clipit[i].x1, clipit[i].y1, clipit[i].x2, clipit[i].y2, walldist))
for (native_t i=clipnum-1;i>=0;--i)
{
vec2_t const vec = pos->vec2;
keepaway(&pos->x, &pos->y, i);
if (inside(pos->x,pos->y, *sectnum) != 1)
pos->vec2 = vec;
break;
if (!bitmap_test(clipignore, i) && clipinsideboxline(pos->x, pos->y, clipit[i].x1, clipit[i].y1, clipit[i].x2, clipit[i].y2, walldist))
{
vec2_t const vec = pos->vec2;
keepaway(&pos->x, &pos->y, i);
if (inside(pos->x,pos->y, *sectnum) != 1)
pos->vec2 = vec;
break;
}
}
}
vec2_t vec = goal;
@ -1392,8 +1391,8 @@ int32_t clipmove(vec3_t * const pos, int16_t * const sectnum, int32_t xvect, int
vec2_t const clipr = { clipit[hitwall].x2 - clipit[hitwall].x1, clipit[hitwall].y2 - clipit[hitwall].y1 };
int64_t const templl = maybe_truncate_to_int32((int64_t)clipr.x * clipr.x + (int64_t)clipr.y * clipr.y);
if (templl > 0)
{
if (templl > 0)
{
int64_t const templl2 = maybe_truncate_to_int32((int64_t)(goal.x-vec.x)*clipr.x + (int64_t)(goal.y-vec.y)*clipr.y);
int32_t const i = ((llabs(templl2)>>11) < templl) ? divscale64(templl2, templl, 20) : 0;
@ -1411,7 +1410,7 @@ int32_t clipmove(vec3_t * const pos, int16_t * const sectnum, int32_t xvect, int
if (blooddemohack == 1)
updatesector(pos->x, pos->y, sectnum);
return clipReturn;
}
}
}
keepaway(&goal.x, &goal.y, hitwall);
@ -1424,7 +1423,7 @@ int32_t clipmove(vec3_t * const pos, int16_t * const sectnum, int32_t xvect, int
}
if (!blooddemohack)
clipupdatesector(vec, sectnum, rad);
clipupdatesector(vec, sectnum, rad);
pos->x = vec.x;
pos->y = vec.y;
@ -1437,7 +1436,7 @@ int32_t clipmove(vec3_t * const pos, int16_t * const sectnum, int32_t xvect, int
if (inside(pos->x, pos->y, clipsectorlist[j]) == 1)
{
*sectnum = clipsectorlist[j];
return clipReturn;
return clipReturn;
}
int32_t tempint2, tempint1 = INT32_MAX;
@ -1705,13 +1704,13 @@ restart_grand:
int32_t daz, daz2;
closest = { pos->x, pos->y };
if (!blooddemohack)
getsectordist(closest, k, &closest);
getsectordist(closest, k, &closest);
getzsofslope(k,closest.x,closest.y,&daz,&daz2);
int32_t fz, cz;
closest = { pos->x, pos->y };
if (!blooddemohack)
getsectordist(closest, sectq[clipinfo[curidx].qend], &closest);
getsectordist(closest, sectq[clipinfo[curidx].qend], &closest);
getzsofslope(sectq[clipinfo[curidx].qend],closest.x,closest.y,&cz,&fz);
const int hitwhat = (curspr-(uspritetype *)sprite)+49152;
@ -1797,7 +1796,7 @@ restart_grand:
int32_t daz, daz2;
closest = { pos->x, pos->y };
if (!blooddemohack)
getsectordist(closest, k, &closest);
getsectordist(closest, k, &closest);
getzsofslope(k, closest.x,closest.y, &daz,&daz2);
#ifdef HAVE_CLIPSHAPE_FEATURE
@ -1807,7 +1806,7 @@ restart_grand:
closest = { pos->x, pos->y };
if (!blooddemohack)
getsectordist(closest, sectq[clipinfo[curidx].qend], &closest);
getsectordist(closest, sectq[clipinfo[curidx].qend], &closest);
getzsofslope(sectq[clipinfo[curidx].qend],closest.x,closest.y,&cz,&fz);
if ((sec->ceilingstat&1)==0)
@ -2441,19 +2440,19 @@ restart_grand:
if ((sv->z > intz) == ((cstat&8)==0)) continue;
if (!blooddemohack)
{
// Abyss crash prevention code ((intz-sv->z)*zx overflowing a 8-bit word)
// PK: the reason for the crash is not the overflowing (even if it IS a problem;
// signed overflow is undefined behavior in C), but rather the idiv trap when
// the resulting quotient doesn't fit into a *signed* 32-bit integer.
zz = (uint32_t)(intz-sv->z) * vx;
intx = sv->x+scale(zz,1,vz);
zz = (uint32_t)(intz-sv->z) * vy;
inty = sv->y+scale(zz,1,vz);
// Abyss crash prevention code ((intz-sv->z)*zx overflowing a 8-bit word)
// PK: the reason for the crash is not the overflowing (even if it IS a problem;
// signed overflow is undefined behavior in C), but rather the idiv trap when
// the resulting quotient doesn't fit into a *signed* 32-bit integer.
zz = (uint32_t)(intz-sv->z) * vx;
intx = sv->x+scale(zz,1,vz);
zz = (uint32_t)(intz-sv->z) * vy;
inty = sv->y+scale(zz,1,vz);
}
else
{
intx = sv->x+scale(intz-sv->z,vx,vz);
inty = sv->y+scale(intz-sv->z,vy,vz);
intx = sv->x+scale(intz-sv->z,vx,vz);
inty = sv->y+scale(intz-sv->z,vy,vz);
}
if (klabs(intx-sv->x)+klabs(inty-sv->y) > klabs((hit->pos.x)-sv->x)+klabs((hit->pos.y)-sv->y))

View file

@ -223,7 +223,7 @@ int32_t ldist(const void *s1, const void *s2)
{
auto sp1 = (vec2_t const *)s1;
auto sp2 = (vec2_t const *)s2;
return sepldist(sp1->x - sp2->x, sp1->y - sp2->y);
return sepldist(sp1->x - sp2->x, sp1->y - sp2->y) + (blooddemohack ? 1 : 0);
}
int32_t dist(const void *s1, const void *s2)

View file

@ -265,10 +265,10 @@ static int32_t Defs_ImportTileFromTexture(char const * const fn, int32_t const t
if (artstatus < 0)
return artstatus<<8;
int32_t picanmdisk;
Bmemcpy(&picanmdisk, &kpzbuf[20], sizeof(int32_t));
picanmdisk = B_LITTLE32(picanmdisk);
tileConvertAnimFormat(tile, picanmdisk);
int32_t picanmdisk;
Bmemcpy(&picanmdisk, &kpzbuf[20], sizeof(int32_t));
picanmdisk = B_LITTLE32(picanmdisk);
tileConvertAnimFormat(tile, picanmdisk);
int32_t const xsiz = B_LITTLE16(B_UNBUF16(&kpzbuf[16]));
int32_t const ysiz = B_LITTLE16(B_UNBUF16(&kpzbuf[18]));

View file

@ -204,6 +204,7 @@ static fix16_t global100horiz; // (-100..300)-scale horiz (the one passed to dr
int32_t(*getpalookup_replace)(int32_t davis, int32_t dashade) = NULL;
int32_t bloodhack = 0;
int32_t blooddemohack = 0;
// adapted from build.c
static void getclosestpointonwall_internal(vec2_t const p, int32_t const dawall, vec2_t *const closest)
@ -1668,9 +1669,7 @@ static inline int findUnusedTile(void)
static void classicScanSector(int16_t startsectnum)
{
if (startsectnum < 0)
{
return;
}
if (automapping)
show2dsector[startsectnum>>3] |= pow2char[startsectnum&7];
@ -3386,7 +3385,6 @@ static inline void setupslopevlin_alsotrans(int32_t logylogx, intptr_t bufplc, i
static void tslopevlin(uint8_t *p, const intptr_t *slopalptr, bssize_t cnt, int32_t bx, int32_t by)
{
const char *const A_C_RESTRICT buf = ggbuf;
const char *const A_C_RESTRICT pal = ggpal;
const char *const A_C_RESTRICT trans = paletteGetBlendTable(0);
const int32_t bzinc = (asm1>>3), pinc = ggpinc;
@ -3418,7 +3416,6 @@ static void tslopevlin(uint8_t *p, const intptr_t *slopalptr, bssize_t cnt, int3
static void mslopevlin(uint8_t *p, const intptr_t *slopalptr, bssize_t cnt, int32_t bx, int32_t by)
{
const char *const A_C_RESTRICT buf = ggbuf;
const char *const A_C_RESTRICT pal = ggpal;
const int32_t bzinc = (asm1>>3), pinc = ggpinc;
const uint32_t xtou = globalx3, ytov = globaly3;
@ -6102,10 +6099,10 @@ draw_as_face_sprite:
if (x == rx) return;
}
if (loadvoxel_replace)
for (i=0; i<MAXVOXMIPS; i++)
if (!voxoff[vtilenum][i])
{
if (loadvoxel_replace)
loadvoxel_replace(vtilenum);
break;
}
@ -7077,6 +7074,10 @@ static void dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t
dastat |= RS_TRANS2;
else
dastat &= ~RS_TRANS2;
// Blood's transparency table is inverted
if (bloodhack)
dastat ^= RS_TRANS2;
}
}
@ -7737,7 +7738,7 @@ LISTFN_STATIC int32_t insertspritestat(int16_t statnum)
// make back-link of the new freelist head point to nil
if (headspritestat[MAXSTATUS] >= 0)
prevspritestat[headspritestat[MAXSTATUS]] = -1;
else
else if (!blooddemohack)
tailspritefree = -1;
do_insertsprite_at_headofstat(blanktouse, statnum);
@ -7806,15 +7807,20 @@ int32_t deletesprite(int16_t spritenum)
sprite[spritenum].sectnum = MAXSECTORS;
// insert at tail of status freelist
prevspritestat[spritenum] = tailspritefree;
nextspritestat[spritenum] = -1;
if (tailspritefree >= 0)
nextspritestat[tailspritefree] = spritenum;
if (blooddemohack)
do_insertsprite_at_headofstat(spritenum, MAXSTATUS);
else
headspritestat[MAXSTATUS] = spritenum;
sprite[spritenum].statnum = MAXSTATUS;
{
prevspritestat[spritenum] = tailspritefree;
nextspritestat[spritenum] = -1;
if (tailspritefree >= 0)
nextspritestat[tailspritefree] = spritenum;
else
headspritestat[MAXSTATUS] = spritenum;
sprite[spritenum].statnum = MAXSTATUS;
tailspritefree = spritenum;
tailspritefree = spritenum;
}
Numsprites--;
return 0;
@ -9717,7 +9723,7 @@ int32_t engineLoadBoard(const char *filename, char flags, vec3_t *dapos, int16_t
{
if (loadboard_replace)
return loadboard_replace(filename, flags, dapos, daang, dacursectnum);
int32_t fil, i;
int32_t i;
int16_t numsprites;
const char myflags = flags&(~3);
@ -10706,8 +10712,46 @@ void vox_undefine(int32_t const tile)
//
// See http://fabiensanglard.net/duke3d/build_engine_internals.php,
// "Inside details" for the idea behind the algorithm.
int32_t inside_old(int32_t x, int32_t y, int16_t sectnum)
{
if (sectnum >= 0 && sectnum < numsectors)
{
uint32_t cnt = 0;
auto wal = (uwallptr_t)&wall[sector[sectnum].wallptr];
int wallsleft = sector[sectnum].wallnum;
do
{
// Get the x and y components of the [tested point]-->[wall
// point{1,2}] vectors.
vec2_t v1 = { wal->x - x, wal->y - y };
auto const &wal2 = *(uwallptr_t)&wall[wal->point2];
vec2_t v2 = { wal2.x - x, wal2.y - y };
// If their signs differ[*], ...
//
// [*] where '-' corresponds to <0 and '+' corresponds to >=0.
// Equivalently, the branch is taken iff
// y1 != y2 AND y_m <= y < y_M,
// where y_m := min(y1, y2) and y_M := max(y1, y2).
if ((v1.y^v2.y) < 0)
cnt ^= (((v1.x^v2.x) >= 0) ? v1.x : (v1.x*v2.y-v2.x*v1.y)^v2.y);
wal++;
}
while (--wallsleft);
return cnt>>31;
}
return -1;
}
int32_t inside(int32_t x, int32_t y, int16_t sectnum)
{
if (blooddemohack)
return inside_old(x, y, sectnum);
if ((unsigned)sectnum < (unsigned)numsectors)
{
uint32_t cnt1 = 0, cnt2 = 0;
@ -12257,6 +12301,7 @@ void renderPrepareMirror(int32_t dax, int32_t day, int32_t daz, fix16_t daang, f
#endif
}
//
// completemirror
//
@ -12373,7 +12418,8 @@ int32_t getceilzofslopeptr(usectorptr_t sec, int32_t dax, int32_t day)
if (i == 0) return sec->ceilingz;
int const j = dmulscale3(d.x, day-w.y, -d.y, dax-w.x);
return sec->ceilingz + (scale(sec->ceilingheinum,j>>1,i)<<1);
int const shift = blooddemohack ? 0 : 1;
return sec->ceilingz + (scale(sec->ceilingheinum,j>>shift,i)<<shift);
}
int32_t getflorzofslopeptr(usectorptr_t sec, int32_t dax, int32_t day)
@ -12391,7 +12437,8 @@ int32_t getflorzofslopeptr(usectorptr_t sec, int32_t dax, int32_t day)
if (i == 0) return sec->floorz;
int const j = dmulscale3(d.x, day-w.y, -d.y, dax-w.x);
return sec->floorz + (scale(sec->floorheinum,j>>1,i)<<1);
int const shift = blooddemohack ? 0 : 1;
return sec->floorz + (scale(sec->floorheinum,j>>shift,i)<<shift);
}
void getzsofslopeptr(usectorptr_t sec, int32_t dax, int32_t day, int32_t *ceilz, int32_t *florz)
@ -12410,10 +12457,11 @@ void getzsofslopeptr(usectorptr_t sec, int32_t dax, int32_t day, int32_t *ceilz,
if (i == 0) return;
int const j = dmulscale3(d.x,day-wal->y, -d.y,dax-wal->x);
int const shift = blooddemohack ? 0 : 1;
if (sec->ceilingstat&2)
*ceilz += scale(sec->ceilingheinum,j>>1,i)<<1;
*ceilz += scale(sec->ceilingheinum,j>>shift,i)<<shift;
if (sec->floorstat&2)
*florz += scale(sec->floorheinum,j>>1,i)<<1;
*florz += scale(sec->floorheinum,j>>shift,i)<<shift;
}
#ifdef YAX_ENABLE

View file

@ -401,18 +401,16 @@ static FORCE_INLINE void set_globalpos(int32_t const x, int32_t const y, int32_t
globalposz = z, fglobalposz = (float)z;
}
extern bool playing_blood;
#ifdef __cplusplus
}
#endif
template <typename T> static FORCE_INLINE void tileUpdatePicnum(T * const tileptr, int const obj)
{
auto &tile = *tileptr;
if (playing_blood || picanm[tile].sf & PICANM_ANIMTYPE_MASK) tile += animateoffs(tile, obj);
if (picanm[tile].sf & PICANM_ANIMTYPE_MASK)
tile += animateoffs(tile, obj);
if (((obj & 16384) == 16384) && (globalorientation & CSTAT_WALL_ROTATE_90) && rottile[tile].newtile != -1)
tile = rottile[tile].newtile;

View file

@ -209,8 +209,8 @@ void paletteLoadFromDisk(void)
return;
}
auto fil = kopen4load("palette.dat", 0);
if (fil == buildvfs_kfd_invalid)
buildvfs_kfd fil;
if ((fil = kopen4load("palette.dat", 0)) == buildvfs_kfd_invalid)
return;
@ -773,7 +773,7 @@ void videoSetPalette(char dabrightness, uint8_t dapalid, uint8_t flags)
}
videoSetGamma();
j = (!gammabrightness || (flags&32) != 0) ? curbrightness : 0;
j = !gammabrightness ? curbrightness : 0;
for (i=0; i<256; i++)
{
@ -791,7 +791,7 @@ void videoSetPalette(char dabrightness, uint8_t dapalid, uint8_t flags)
}
#ifdef USE_OPENGL
if ((flags&32) != 0 && videoGetRenderMode() == REND_POLYMOST)
if ((flags&32) != 0 && videoGetRenderMode() == REND_POLYMOST && playing_rr)
r_brightnesshack = j;
else
r_brightnesshack = 0;

View file

@ -4186,7 +4186,7 @@ static void polymost_drawalls(int32_t const bunch)
drawpoly_blend = 0;
int32_t const sectnum = thesector[bunchfirst[bunch]];
usectortype const * const sec = (usectortype *)&sector[sectnum];
auto const sec = (usectorptr_t)&sector[sectnum];
float const fglobalang = fix16_to_float(qglobalang);
polymost_outputGLDebugMessage(3, "polymost_drawalls(bunch:%d)", bunch);
@ -4196,10 +4196,10 @@ static void polymost_drawalls(int32_t const bunch)
{
int32_t const wallnum = thewall[z];
auto const wal = (uwalltype *)&wall[wallnum];
auto const wal2 = (uwalltype *)&wall[wal->point2];
auto const wal = (uwallptr_t)&wall[wallnum];
auto const wal2 = (uwallptr_t)&wall[wal->point2];
int32_t const nextsectnum = wal->nextsector;
auto const nextsec = nextsectnum>=0 ? (usectortype *)&sector[nextsectnum] : NULL;
auto const nextsec = nextsectnum>=0 ? (usectorptr_t)&sector[nextsectnum] : NULL;
//Offset&Rotate 3D coordinates to screen 3D space
vec2f_t walpos = { (float)(wal->x-globalposx), (float)(wal->y-globalposy) };
@ -4720,66 +4720,67 @@ static void polymost_drawalls(int32_t const bunch)
{
//Hack to draw color rectangle above sky when looking up...
xtex.d = xtex.u = xtex.v = 0;
ytex.d = gxyaspect * (1.0 / -262144.0);
ytex.u = 0;
ytex.v = 0;
//Hack to draw color rectangle above sky when looking up...
xtex.d = xtex.u = xtex.v = 0;
otex.d = -ghoriz * ytex.d;
otex.u = 0;
otex.v = 0;
ytex.d = gxyaspect * (1.0 / -262144.0);
ytex.u = 0;
ytex.v = 0;
o.y = -vv[0]/vv[1];
otex.d = -ghoriz * ytex.d;
otex.u = 0;
otex.v = 0;
if ((o.y < cy0) && (o.y < cy1))
polymost_domost(x1,o.y,x0,o.y);
else if ((o.y < cy0) != (o.y < cy1))
{
/* cy1 cy0
// / \
//oy---------- oy---------
// / \
// cy0 cy1 */
o.x = (o.y-cy0)*(x1-x0)/(cy1-cy0) + x0;
if (o.y < cy0)
o.y = -vv[0]/vv[1];
if ((o.y < cy0) && (o.y < cy1))
polymost_domost(x1,o.y,x0,o.y);
else if ((o.y < cy0) != (o.y < cy1))
{
polymost_domost(o.x,o.y,x0,o.y);
polymost_domost(x1,cy1,o.x,o.y);
/* cy1 cy0
// / \
//oy---------- oy---------
// / \
// cy0 cy1 */
o.x = (o.y-cy0)*(x1-x0)/(cy1-cy0) + x0;
if (o.y < cy0)
{
polymost_domost(o.x,o.y,x0,o.y);
polymost_domost(x1,cy1,o.x,o.y);
}
else
{
polymost_domost(o.x,o.y,x0,cy0);
polymost_domost(x1,o.y,o.x,o.y);
}
}
else
{
polymost_domost(o.x,o.y,x0,cy0);
polymost_domost(x1,o.y,o.x,o.y);
}
polymost_domost(x1,cy1,x0,cy0);
}
else
polymost_domost(x1,cy1,x0,cy0);
}
else
skyclamphack = 0;
skyclamphack = 0;
xtex.d = xtex.v = 0;
ytex.d = ytex.u = 0;
otex.d = dd;
xtex.u = otex.d * (t * double(((uint64_t)xdimscale * yxaspect) * viewingrange)) *
(1.0 / (16384.0 * 65536.0 * 65536.0 * 5.0 * 1024.0));
ytex.v = vv[1];
otex.v = r_parallaxskypanning ? vv[0] + dd*(float)sec->ceilingypanning*(float)i*(1.f/256.f) : vv[0];
xtex.d = xtex.v = 0;
ytex.d = ytex.u = 0;
otex.d = dd;
xtex.u = otex.d * (t * double(((uint64_t)xdimscale * yxaspect) * viewingrange)) *
(1.0 / (16384.0 * 65536.0 * 65536.0 * 5.0 * 1024.0));
ytex.v = vv[1];
otex.v = r_parallaxskypanning ? vv[0] + dd*(float)sec->ceilingypanning*(float)i*(1.f/256.f) : vv[0];
int const npot = (1<<(picsiz[globalpicnum]&15)) != tilesiz[globalpicnum].x;
int const xpanning = (r_parallaxskypanning?sec->ceilingxpanning:0);
i = globalpicnum;
float const r = (cy1-cy0)/(x1-x0); //slope of line
o.y = fviewingrange/(ghalfx*256.f); o.z = 1.f/o.y;
i = globalpicnum;
float const r = (cy1-cy0)/(x1-x0); //slope of line
o.y = fviewingrange/(ghalfx*256.f); o.z = 1.f/o.y;
int y = ((int32_t)(((x0-ghalfx)*o.y)+fglobalang)>>(11-dapskybits));
float fx = x0;
do
{
globalpicnum = dapskyoff[y&((1<<dapskybits)-1)]+i;
int y = ((int32_t)(((x0-ghalfx)*o.y)+fglobalang)>>(11-dapskybits));
float fx = x0;
do
{
globalpicnum = dapskyoff[y&((1<<dapskybits)-1)]+i;
if (npot)
{
fx = ((float)((y<<(11-dapskybits))-fglobalang))*o.z+ghalfx;
@ -4788,13 +4789,13 @@ static void polymost_drawalls(int32_t const bunch)
}
else
otex.u = otex.d*(t*((float)(fglobalang-(y<<(11-dapskybits)))) * (1.f/2048.f) + xpanning) - xtex.u*ghalfx;
y++;
o.x = fx; fx = (((float) (y<<(11-dapskybits))-fglobalang))*o.z+ghalfx;
if (fx > x1) { fx = x1; i = -1; }
y++;
o.x = fx; fx = (((float) (y<<(11-dapskybits))-fglobalang))*o.z+ghalfx;
if (fx > x1) { fx = x1; i = -1; }
pow2xsplit = 0; polymost_domost(fx,(fx-x0)*r+cy0,o.x,(o.x-x0)*r+cy0); //ceil
}
while (i >= 0);
pow2xsplit = 0; polymost_domost(fx,(fx-x0)*r+cy0,o.x,(o.x-x0)*r+cy0); //ceil
}
while (i >= 0);
}
ghoriz = ghorizbak;
@ -5104,12 +5105,12 @@ static void polymost_drawalls(int32_t const bunch)
}
if (((ofy0 < fy0) || (ofy1 < fy1)) && (!((sec->floorstat&sector[nextsectnum].floorstat)&1)))
{
uwalltype *nwal;
uwallptr_t nwal;
if (!(wal->cstat&2)) nwal = wal;
else
{
nwal = (uwalltype *)&wall[wal->nextwall];
nwal = (uwallptr_t)&wall[wal->nextwall];
otex.u += (float)(nwal->xpanning - wal->xpanning) * otex.d;
xtex.u += (float)(nwal->xpanning - wal->xpanning) * xtex.d;
ytex.u += (float)(nwal->xpanning - wal->xpanning) * ytex.d;
@ -5261,7 +5262,7 @@ void polymost_scansector(int32_t sectnum)
#endif
for (bssize_t z=headspritesect[sectnum]; z>=0; z=nextspritesect[z])
{
uspritetype const * const spr = (uspritetype *)&sprite[z];
auto const spr = (uspriteptr_t)&sprite[z];
if ((spr->cstat & 0x8000 && !showinvisibility) || spr->xrepeat == 0 || spr->yrepeat == 0)
continue;
@ -5291,12 +5292,12 @@ void polymost_scansector(int32_t sectnum)
vec2d_t p2 = { 0, 0 };
uwalltype *wal;
uwallptr_t wal;
int z;
for (z=startwall,wal=(uwalltype *)&wall[z]; z<endwall; z++,wal++)
for (z=startwall,wal=(uwallptr_t)&wall[z]; z<endwall; z++,wal++)
{
uwalltype const *const wal2 = (uwalltype *)&wall[wal->point2];
auto const wal2 = (uwallptr_t)&wall[wal->point2];
vec2d_t const fp1 = { double(wal->x - globalposx), double(wal->y - globalposy) };
vec2d_t const fp2 = { double(wal2->x - globalposx), double(wal2->y - globalposy) };
@ -5551,15 +5552,16 @@ void polymost_drawrooms()
{
gshang = 0.f;
gchang = 1.f;
ghoriz2 = (float)(ydimen >> 1) - ghoriz - ghorizcorrect;
ghoriz2 = (float)(ydimen >> 1) - (ghoriz + ghorizcorrect);
}
else
{
float r = (float)(ydimen >> 1) - ghoriz - ghorizcorrect;
float r = (float)(ydimen >> 1) - (ghoriz + ghorizcorrect);
gshang = r / Bsqrtf(r * r + ghalfx * ghalfx / (gvrcorrection * gvrcorrection));
gchang = Bsqrtf(1.f - gshang * gshang);
ghoriz2 = 0.f;
}
ghoriz = (float)(ydimen>>1);
resizeglcheck();
@ -5761,13 +5763,13 @@ static void polymost_drawmaskwallinternal(int32_t wallIndex)
auto const wal = (uwallptr_t)&wall[wallIndex];
auto const wal2 = (uwallptr_t)&wall[wal->point2];
int32_t const sectnum = wall[wal->nextwall].nextsector;
auto const sec = (usectortype *)&sector[sectnum];
auto const sec = (usectorptr_t)&sector[sectnum];
// if (wal->nextsector < 0) return;
// Without MASKWALL_BAD_ACCESS fix:
// wal->nextsector is -1, WGR2 SVN Lochwood Hollow (Til' Death L1) (or trueror1.map)
auto const nsec = (usectortype *)&sector[wal->nextsector];
auto const nsec = (usectorptr_t)&sector[wal->nextsector];
polymost_outputGLDebugMessage(3, "polymost_drawmaskwallinternal(wallIndex:%d)", wallIndex);
@ -6005,17 +6007,18 @@ void polymost_prepareMirror(int32_t dax, int32_t day, int32_t daz, fix16_t daang
ghalfy = (float)(ydimen>>1);
grhalfxdown10 = 1.f/(ghalfx*1024.f);
ghoriz = fix16_to_float(qglobalhoriz);
ghorizcorrect = fix16_to_float((100-polymostcenterhoriz)*divscale16(xdimenscale, viewingrange));
gvisibility = ((float)globalvisibility)*FOGSCALE;
resizeglcheck();
if (r_yshearing)
{
gshang = 0.f;
gchang = 1.f;
ghoriz2 = (float)(ydimen >> 1) - ghoriz;
ghoriz2 = (float)(ydimen >> 1) - (ghoriz+ghorizcorrect);
}
else
{
float r = (float)(ydimen >> 1) - ghoriz;
float r = (float)(ydimen >> 1) - (ghoriz+ghorizcorrect);
gshang = r / Bsqrtf(r * r + ghalfx * ghalfx / (gvrcorrection * gvrcorrection));
gchang = Bsqrtf(1.f - gshang * gshang);
ghoriz2 = 0.f;
@ -6068,10 +6071,10 @@ void Polymost_prepare_loadboard(void)
Bmemset(wsprinfo, 0, sizeof(wsprinfo));
}
static inline int32_t polymost_findwall(uspritetype const * const tspr, vec2_t const * const tsiz, int32_t * rd)
static inline int32_t polymost_findwall(uspriteptr_t const tspr, vec2_t const * const tsiz, int32_t * rd)
{
int32_t dist = 4, closest = -1;
usectortype const * const sect = (usectortype * )&sector[tspr->sectnum];
auto const sect = (usectortype * )&sector[tspr->sectnum];
vec2_t n;
for (bssize_t i=sect->wallptr; i<sect->wallptr + sect->wallnum; i++)
@ -6140,12 +6143,12 @@ int32_t polymost_lintersect(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
void polymost_drawsprite(int32_t snum)
{
uspritetype *const tspr = tspriteptr[snum];
auto const tspr = tspriteptr[snum];
if (EDUKE32_PREDICT_FALSE(bad_tspr(tspr)))
return;
const usectortype *sec;
usectorptr_t sec;
int32_t spritenum = tspr->owner;
@ -6187,7 +6190,7 @@ void polymost_drawsprite(int32_t snum)
drawpoly_alpha = spriteext[spritenum].alpha;
drawpoly_blend = tspr->blend;
sec = (usectortype *)&sector[tspr->sectnum];
sec = (usectorptr_t)&sector[tspr->sectnum];
//if ((usehightile && hicfindsubst(globalpicnum, globalpal, hictinting[globalpal].f & HICTINT_ALWAYSUSEART))
//|| (usemodels && md_tilehasmodel(globalpicnum, globalpal) >= 0))
@ -7804,10 +7807,6 @@ void polymost_initosdfuncs(void)
static osdcvardata_t cvars_polymost[] =
{
{ "r_animsmoothing","enable/disable model animation smoothing",(void *) &r_animsmoothing, CVAR_BOOL, 0, 1 },
{ "r_fullbrights","enable/disable fullbright textures",(void *) &r_fullbrights, CVAR_BOOL, 0, 1 },
{ "r_parallaxskyclamping","enable/disable parallaxed floor/ceiling sky texture clamping", (void *) &r_parallaxskyclamping, CVAR_BOOL, 0, 1 },
{ "r_parallaxskypanning","enable/disable parallaxed floor/ceiling panning when drawing a parallaxing sky", (void *) &r_parallaxskypanning, CVAR_BOOL, 0, 1 },
{ "r_polymostDebug","Set the verbosity of Polymost GL debug messages",(void *) &r_polymostDebug, CVAR_INT, 0, 3 },
#ifdef USE_GLEXT
{ "r_detailmapping","enable/disable detail mapping",(void *) &r_detailmapping, CVAR_BOOL, 0, 1 },
@ -7815,37 +7814,32 @@ void polymost_initosdfuncs(void)
#endif
{ "r_polygonmode","debugging feature",(void *) &r_polygonmode, CVAR_INT | CVAR_NOSAVE, 0, 3 },
{ "r_animsmoothing","enable/disable model animation smoothing",(void *) &r_animsmoothing, CVAR_BOOL, 0, 1 },
{ "r_anisotropy", "changes the OpenGL texture anisotropy setting", (void *) &glanisotropy, CVAR_INT|CVAR_FUNCPTR, 0, 16 },
{ "r_fullbrights","enable/disable fullbright textures",(void *) &r_fullbrights, CVAR_BOOL, 0, 1 },
{ "r_hightile","enable/disable hightile texture rendering",(void *) &usehightile, CVAR_BOOL, 0, 1 },
{ "r_models", "enable/disable model rendering", (void *)&usemodels, CVAR_BOOL, 0, 1 },
{ "r_nofog", "enable/disable GL fog", (void *)&nofog, CVAR_BOOL, 0, 1},
{ "r_npotwallmode", "enable/disable emulation of walls with non-power-of-two height textures (Polymost, r_hightile 0)",
(void *) &r_npotwallmode, CVAR_INT | CVAR_NOSAVE, 0, 2 },
{ "r_parallaxskyclamping","enable/disable parallaxed floor/ceiling sky texture clamping", (void *) &r_parallaxskyclamping, CVAR_BOOL, 0, 1 },
{ "r_parallaxskypanning","enable/disable parallaxed floor/ceiling panning when drawing a parallaxing sky", (void *) &r_parallaxskypanning, CVAR_BOOL, 0, 1 },
{ "r_projectionhack", "enable/disable projection hack", (void *) &glprojectionhacks, CVAR_INT, 0, 2 },
{ "r_shadeinterpolate", "enable/disable shade interpolation", (void *) &r_shadeinterpolate, CVAR_BOOL, 0, 1 },
{ "r_shadescale","multiplier for shading",(void *) &shadescale, CVAR_FLOAT, 0, 10 },
{ "r_shadescale_unbounded","enable/disable allowance of complete blackness",(void *) &shadescale_unbounded, CVAR_BOOL, 0, 1 },
{ "r_swapinterval","sets the GL swap interval (VSync)",(void *) &vsync, CVAR_INT|CVAR_FUNCPTR, -1, 1 },
{
"r_npotwallmode", "enable/disable emulation of walls with non-power-of-two height textures (Polymost, r_hightile 0)",
(void *) &r_npotwallmode, CVAR_INT, 0, 2
},
{ "r_anisotropy", "changes the OpenGL texture anisotropy setting", (void *) &glanisotropy, CVAR_INT|CVAR_FUNCPTR, 0, 16 },
{ "r_texturemaxsize","changes the maximum OpenGL texture size limit",(void *) &gltexmaxsize, CVAR_INT | CVAR_NOSAVE, 0, 4096 },
{ "r_texturemiplevel","changes the highest OpenGL mipmap level used",(void *) &gltexmiplevel, CVAR_INT, 0, 6 },
{ "r_texfilter", "changes the texture filtering settings (may require restart)", (void *) &gltexfiltermode, CVAR_INT|CVAR_FUNCPTR, 0, 5 },
{ "r_useindexedcolortextures", "enable/disable indexed color texture rendering", (void *) &r_useindexedcolortextures, CVAR_INT, 0, 1 },
{ "r_usenewshading",
"visibility/fog code: 0: orig. Polymost 1: 07/2011 2: linear 12/2012 3: no neg. start 03/2014 4: base constant on shade table 11/2017",
(void *) &r_usenewshading, CVAR_INT|CVAR_FUNCPTR, 0, 4
},
{ "r_projectionhack", "enable/disable projection hack", (void *) &glprojectionhacks, CVAR_INT, 0, 1 },
{ "r_shadeinterpolate", "enable/disable shade interpolation", (void *) &r_shadeinterpolate, CVAR_INT, 0, 1 },
{ "r_yshearing", "enable/disable y-shearing", (void*)&r_yshearing, CVAR_INT, 0, 1 },
#ifdef __ANDROID__
{ "r_models","enable/disable model rendering",(void *) &usemodels, CVAR_BOOL | CVAR_NOSAVE, 0, 1 },
#else
{ "r_models","enable/disable model rendering",(void *) &usemodels, CVAR_BOOL, 0, 1 },
{ "r_usenewshading",
"visibility/fog code: 0: orig. Polymost 1: 07/2011 2: linear 12/2012 3: no neg. start 03/2014 4: base constant on shade table 11/2017",
(void*)& r_usenewshading, CVAR_INT | CVAR_FUNCPTR, 0, 4},
{ "r_yshearing", "enable/disable y-shearing", (void*) &r_yshearing, CVAR_BOOL, 0, 1 },
{ "r_flatsky", "enable/disable flat skies", (void*)& r_flatsky, CVAR_BOOL, 0, 1 },
#endif
{ "r_nofog", "enable/disable GL fog", (void *)&nofog, CVAR_BOOL, 0, 1},
{ "r_hightile","enable/disable hightile texture rendering",(void *) &usehightile, CVAR_BOOL, 0, 1 },
};
for (i=0; i<ARRAY_SIZE(cvars_polymost); i++)
@ -7879,11 +7873,3 @@ void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype)
mdloadskin((md2model_t *)models[mid], 0, dapalnum, i);
}
#else /* if !defined USE_OPENGL */
#include "compat.h"
#endif
// vim:ts=4:sw=4:

View file

@ -507,7 +507,7 @@ static int32_t artReadIndexedFile(int32_t tilefilei)
const int32_t permap = (tilefilei >= MAXARTFILES_BASE); // is it a per-map ART file?
buildvfs_kfd fil;
auto kopen4loadfunc = playing_blood ? kopen4loadfrommod : kopen4load;
auto kopen4loadfunc = bloodhack == 2 ? kopen4loadfrommod : kopen4load;
if ((fil = kopen4loadfunc(fn, 0)) != buildvfs_kfd_invalid)
{
@ -713,7 +713,7 @@ void tileLoadData(int16_t tilenume, int32_t dasiz, char *buffer)
char const *fn = artGetIndexedFileName(tfn);
auto kopen4loadfunc = playing_blood ? kopen4loadfrommod : kopen4load;
auto kopen4loadfunc = bloodhack == 2 ? kopen4loadfrommod : kopen4load;
artfil = kopen4loadfunc(fn, 0);

View file

@ -160,6 +160,8 @@ enum GameEvent_t {
EVENT_RESETGOTPICS,
EVENT_VALIDATESTART,
EVENT_NEWGAMECUSTOM,
EVENT_INITCOMPLETE,
EVENT_CAPIR,
#ifdef LUNATIC
EVENT_ANIMATEALLSPRITES,
#endif

View file

@ -820,12 +820,12 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
#endif
#ifdef POLYMER
if (videoGetRenderMode() == REND_POLYMER)
polymer_setanimatesprites(G_DoSpriteAnimations, pSprite->x, pSprite->y, pSprite->z, fix16_to_int(CAMERA(q16ang)), smoothRatio);
polymer_setanimatesprites(G_DoSpriteAnimations, pSprite->x, pSprite->y, pSprite->z - ZOFFSET6, fix16_to_int(CAMERA(q16ang)), smoothRatio);
#endif
yax_preparedrawrooms();
renderDrawRoomsQ16(pSprite->x, pSprite->y, pSprite->z - ZOFFSET6, CAMERA(q16ang), fix16_from_int(pSprite->yvel), pSprite->sectnum);
yax_drawrooms(G_DoSpriteAnimations, pSprite->sectnum, 0, smoothRatio);
G_DoSpriteAnimations(pSprite->x, pSprite->y, pSprite->z, fix16_to_int(CAMERA(q16ang)), smoothRatio);
G_DoSpriteAnimations(pSprite->x, pSprite->y, pSprite->z - ZOFFSET6, fix16_to_int(CAMERA(q16ang)), smoothRatio);
renderDrawMasks();
}
}
@ -6143,10 +6143,10 @@ static void G_Startup(void)
if (g_modDir[0] != '/' && (cwd = buildvfs_getcwd(NULL, 0)))
{
buildvfs_chdir(g_modDir);
if (artLoadFiles("tiles%03d.art", MAXCACHE1DSIZE) < 0)
if (artLoadFiles("tiles%03i.art", MAXCACHE1DSIZE) < 0)
{
buildvfs_chdir(cwd);
if (artLoadFiles("tiles%03d.art", MAXCACHE1DSIZE) < 0)
if (artLoadFiles("tiles%03i.art", MAXCACHE1DSIZE) < 0)
G_GameExit("Failed loading art.");
}
buildvfs_chdir(cwd);
@ -6154,7 +6154,7 @@ static void G_Startup(void)
Xfree(cwd);
#endif
}
else if (artLoadFiles("tiles%03d.art",MAXCACHE1DSIZE) < 0)
else if (artLoadFiles("tiles%03i.art",MAXCACHE1DSIZE) < 0)
G_GameExit("Failed loading art.");
cacheAllSounds();
@ -6809,6 +6809,8 @@ int app_main(int argc, char const * const * argv)
// getpackets();
VM_OnEvent(EVENT_INITCOMPLETE);
MAIN_LOOP_RESTART:
totalclock = 0;
ototalclock = 0;

View file

@ -166,6 +166,8 @@ static tokenmap_t const vm_keywords[] =
{ "calchypotenuse", CON_CALCHYPOTENUSE },
{ "cansee", CON_CANSEE },
{ "canseespr", CON_CANSEESPR },
{ "capia", CON_CAPIA },
{ "capis", CON_CAPIS },
{ "case", CON_CASE },
{ "changespritesect", CON_CHANGESPRITESECT },
{ "changespritestat", CON_CHANGESPRITESTAT },
@ -992,6 +994,8 @@ const char *EventNames[MAXEVENTS] =
"EVENT_RESETGOTPICS",
"EVENT_VALIDATESTART",
"EVENT_NEWGAMECUSTOM",
"EVENT_INITCOMPLETE",
"EVENT_CAPIR",
#ifdef LUNATIC
"EVENT_ANIMATEALLSPRITES",
#endif
@ -3595,6 +3599,7 @@ DO_DEFSTATE:
fallthrough__;
case CON_ACTIVATECHEAT:
case CON_ANGOFF:
case CON_CAPIA:
case CON_CHECKACTIVATORMOTION:
case CON_CHECKAVAILINVEN:
case CON_CHECKAVAILWEAPON:
@ -3658,6 +3663,7 @@ DO_DEFSTATE:
C_GetNextVarType(GAMEVAR_READONLY);
fallthrough__;
case CON_ACTORSOUND:
case CON_CAPIS:
case CON_CHANGESPRITESECT:
case CON_CHANGESPRITESTAT:
case CON_EZSHOOT:

View file

@ -1069,6 +1069,8 @@ enum IterationTypes_t
TRANSFORM(CON_CALCHYPOTENUSE) DELIMITER \
TRANSFORM(CON_CANSEE) DELIMITER \
TRANSFORM(CON_CANSEESPR) DELIMITER \
TRANSFORM(CON_CAPIA) DELIMITER \
TRANSFORM(CON_CAPIS) DELIMITER \
TRANSFORM(CON_CHANGESPRITESECT) DELIMITER \
TRANSFORM(CON_CHANGESPRITESTAT) DELIMITER \
TRANSFORM(CON_CHECKACTIVATORMOTION) DELIMITER \

View file

@ -4834,6 +4834,29 @@ badindex:
dispatch();
}
vInstruction(CON_CAPIA):
{
insptr++;
int const nQuote = Gv_GetVar(*insptr++);
VM_ASSERT((unsigned)nQuote < MAXQUOTES && apStrings[nQuote], "invalid quote %d\n", nQuote);
//communityapiUnlockAchievement(apStrings[nQuote]);
dispatch();
}
vInstruction(CON_CAPIS):
{
insptr++;
int const nQuote = Gv_GetVar(*insptr++);
int const value = Gv_GetVar(*insptr++);
VM_ASSERT((unsigned)nQuote < MAXQUOTES && apStrings[nQuote], "invalid quote %d\n", nQuote);
//communityapiSetStat(apStrings[nQuote], value);
dispatch();
}
vInstruction(CON_SPAWN):
insptr++;

View file

@ -307,8 +307,8 @@ MAKE_SPACER( Space8, 8<<16 ); // colcorr, redslide
static MenuEntry_t ME_Space2_Redfont = MAKE_MENUENTRY( NULL, &MF_Redfont, &MEF_Null, &MEO_Space2, Spacer );
static MenuEntry_t ME_Space4_Bluefont = MAKE_MENUENTRY( NULL, &MF_Bluefont, &MEF_Null, &MEO_Space4, Spacer );
#ifndef EDUKE32_SIMPLE_MENU
static MenuEntry_t ME_Space4_Redfont = MAKE_MENUENTRY( NULL, &MF_Redfont, &MEF_Null, &MEO_Space4, Spacer );
#ifndef EDUKE32_SIMPLE_MENU
static MenuEntry_t ME_Space8_Bluefont = MAKE_MENUENTRY( NULL, &MF_Bluefont, &MEF_Null, &MEO_Space8, Spacer );
#endif
static MenuEntry_t ME_Space6_Redfont = MAKE_MENUENTRY( NULL, &MF_Redfont, &MEF_Null, &MEO_Space6, Spacer );
@ -751,7 +751,7 @@ static MenuEntry_t *MEL_VIDEOSETUP[] = {
&ME_VIDEOSETUP_VSYNC,
&ME_VIDEOSETUP_FRAMELIMIT,
&ME_VIDEOSETUP_FRAMELIMITOFFSET,
&ME_Space6_Redfont,
&ME_Space4_Redfont,
&ME_VIDEOSETUP_APPLY,
};
static MenuEntry_t *MEL_DISPLAYSETUP[] = {

View file

@ -972,12 +972,12 @@ void S_Update(void)
// when playing back a new sound needs an existing sound to be stopped first
void S_Callback(intptr_t num)
{
if (num == MUSIC_ID)
if ((int32_t)num == MUSIC_ID)
return;
mutex_lock(&m_callback);
unative_t const ldnum = dnum;
dq[ldnum & (DQSIZE - 1)] = num;
dq[ldnum & (DQSIZE - 1)] = (uint32_t)num;
dnum++;
mutex_unlock(&m_callback);
}

View file

@ -3503,8 +3503,7 @@ default_case:
A_SetSprite(newSprite, CLIPMASK0);
}
actor[sectSprite].lasttransport = ((int32_t)totalclock & UINT8_MAX);
actor[sectSprite].lasttransport = ((int32_t) totalclock & UINT8_MAX);
if (sectLotag == ST_1_ABOVE_WATER || sectLotag == ST_2_UNDERWATER)
{

View file

@ -630,20 +630,25 @@ int32_t CONFIG_ReadSetup(void)
if (ud.config.scripthandle < 0)
{
if (buildvfs_exists(g_setupFileName)) // JBF 20031211
ud.config.scripthandle = SCRIPT_Load(g_setupFileName);
if (buildvfs_exists(g_setupFileName)) // JBF 20031211
ud.config.scripthandle = SCRIPT_Load(g_setupFileName);
#if !defined(EDUKE32_TOUCH_DEVICES)
else if (buildvfs_exists(SETUPFILENAME))
{
int const i = wm_ynbox("Import Configuration Settings",
"The configuration file \"%s\" was not found. "
"Import configuration data from \"%s\"?",
g_setupFileName, SETUPFILENAME);
if (i)
ud.config.scripthandle = SCRIPT_Load(SETUPFILENAME);
}
else if (buildvfs_exists(SETUPFILENAME))
{
int32_t i;
i=wm_ynbox("Import Configuration Settings", "The configuration file \"%s\" was not found. "
"Import configuration data from \"%s\"?", g_setupFileName, SETUPFILENAME);
if (i) ud.config.scripthandle = SCRIPT_Load(SETUPFILENAME);
}
else if (buildvfs_exists("duke3d.cfg"))
{
int32_t i;
i=wm_ynbox("Import Configuration Settings", "The configuration file \"%s\" was not found. "
"Import configuration data from \"duke3d.cfg\"?", g_setupFileName);
if (i) ud.config.scripthandle = SCRIPT_Load("duke3d.cfg");
}
#endif
}
}
pathsearchmode = 0;

View file

@ -631,8 +631,10 @@ RECHECK:
renderFlushPerms();
#ifdef PLAYDEMOLOOP // Todo: Make a CVar.
if (!g_netServer && ud.multimode < 2)
foundemo = 0;// G_OpenDemoRead(g_whichDemo);
foundemo = G_OpenDemoRead(g_whichDemo);
#endif
if (foundemo == 0)
{
@ -988,7 +990,7 @@ nextdemo_nomenu:
}
else
{
j = calc_smoothratio((int32_t)totalclock, (int32_t)ototalclock);
j = calc_smoothratio(totalclock, ototalclock);
if (g_demo_paused && g_demo_rewind)
j = 65536-j;

View file

@ -979,7 +979,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
if (ud.pause_on || pPlayer->on_crane > -1)
smoothRatio = 65536;
else
smoothRatio = calc_smoothratio((int32_t)totalclock, (int32_t)ototalclock);
smoothRatio = calc_smoothratio(totalclock, ototalclock);
if (RRRA && g_fogType)
pPlayer->visibility = ud.const_visibility;
@ -7452,6 +7452,8 @@ static void G_Startup(void)
G_CompileScripts();
blooddemohack = 1;
if (engineInit())
G_FatalEngineError();

View file

@ -1149,7 +1149,6 @@ void Screen_Play(void)
videoNextPage();
I_ClearAllInput();
videoNextPage();
} while (running);
}

View file

@ -7638,14 +7638,14 @@ void M_DisplayMenus(void)
m_menuchange_watchpoint++;
#endif
if ((int32_t)totalclock < m_animation.start)
if (totalclock < m_animation.start)
{
m_animation.start = 0;
m_animation.length = 0;
}
// Determine animation values.
if ((int32_t)totalclock < m_animation.start + m_animation.length)
if (totalclock < m_animation.start + m_animation.length)
{
const int32_t screenwidth = scale(240<<16, xdim, ydim);
@ -7659,7 +7659,7 @@ void M_DisplayMenus(void)
}
// Display the menu, with a transition animation if applicable.
if ((int32_t)totalclock < m_animation.start + m_animation.length)
if (totalclock < m_animation.start + m_animation.length)
{
Menu_Run(m_animation.previous, previousOrigin);
Menu_Run(m_animation.current, origin);

View file

@ -88,7 +88,7 @@ void Net_SyncPlayer(ENetEvent *event)
event->peer->data = (void *)(intptr_t)i;
g_player[i].netsynctime = (int32_t)totalclock;
//g_player[i].netsynctime = totalclock;
g_player[i].playerquitflag = 1;
//g_player[i].revision = g_netMapRevision;
@ -2178,7 +2178,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
if ((g_player[other].movefifoend&(TIMERUPDATESIZ-1)) == 0)
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
{
{
if (g_player[i].playerquitflag == 0) continue;
if (i == myconnectindex)
otherminlag = (int)((signed char)packbuf[j]);
@ -2192,7 +2192,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
for(TRAVERSE_CONNECT(i))
j += g_player[i].playerquitflag+g_player[i].playerquitflag;
for(TRAVERSE_CONNECT(i))
{
{
if (g_player[i].playerquitflag == 0) continue;
l = packbuf[k]+(int)(packbuf[k+1]<<8);
@ -2260,7 +2260,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
movefifosendplc += g_movesPerPacket;
break;
break;
case PACKET_TYPE_SLAVE_TO_MASTER: //[1] (receive slave sync buffer)
j = 3;
k = packbuf[1] + (int)(packbuf[2]<<8);
@ -2272,13 +2272,13 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
if (k&1) nsyn[other].fvel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2;
if (k&2) nsyn[other].svel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2;
if (k&4)
{
{
nsyn[other].q16avel = (fix16_t)packbuf[j];
nsyn[other].q16avel += (fix16_t)packbuf[j + 1] << 8;
nsyn[other].q16avel += (fix16_t)packbuf[j + 2] << 16;
nsyn[other].q16avel += (fix16_t)packbuf[j + 3] << 24;
j += 4;
}
}
if (k&8) nsyn[other].bits = ((nsyn[other].bits&0xffffff00)|((int)packbuf[j++]));
if (k&16) nsyn[other].bits = ((nsyn[other].bits&0xffff00ff)|((int)packbuf[j++])<<8);
if (k&32) nsyn[other].bits = ((nsyn[other].bits&0xff00ffff)|((int)packbuf[j++])<<16);
@ -2311,7 +2311,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
g_player[other].movefifoend++;
}
break;
break;
case PACKET_TYPE_BROADCAST:
g_player[other].movefifoend = movefifoplc = movefifosendplc = predictfifoplc = 0;
@ -2326,7 +2326,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
if (i == myconnectindex)
otherminlag = (int)((signed char)packbuf[j]);
j++;
}
}
osyn = (input_t *)&inputfifo[(g_player[other].movefifoend-1)&(MOVEFIFOSIZ-1)][0];
nsyn = (input_t *)&inputfifo[(g_player[other].movefifoend)&(MOVEFIFOSIZ-1)][0];
@ -2338,7 +2338,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
if (k&1) nsyn[other].fvel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2;
if (k&2) nsyn[other].svel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2;
if (k&4)
{
{
nsyn[other].q16avel = (fix16_t)packbuf[j];
nsyn[other].q16avel += (fix16_t)packbuf[j + 1] << 8;
nsyn[other].q16avel += (fix16_t)packbuf[j + 2] << 16;
@ -2350,7 +2350,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
if (k&32) nsyn[other].bits = ((nsyn[other].bits&0xff00ffff)|((int)packbuf[j++])<<16);
if (k&64) nsyn[other].bits = ((nsyn[other].bits&0x00ffffff)|((int)packbuf[j++])<<24);
if (k&128)
{
{
nsyn[other].q16horz = (fix16_t)packbuf[j];
nsyn[other].q16horz += (fix16_t)packbuf[j + 1] << 8;
nsyn[other].q16horz += (fix16_t)packbuf[j + 2] << 16;
@ -2366,10 +2366,10 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
g_player[other].movefifoend++;
for (i=g_movesPerPacket-1;i>=1;i--)
{
{
copybufbyte(&nsyn[other],&inputfifo[g_player[other].movefifoend&(MOVEFIFOSIZ-1)][other],sizeof(input_t));
g_player[other].movefifoend++;
}
}
/*
while (j < packbufleng)
@ -2383,7 +2383,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
if (j > packbufleng)
initprintf("INVALID GAME PACKET!!! (packet %d, %d too many bytes (%d %d))\n",packbuf[0],j-packbufleng,packbufleng,k);
break;
break;
case PACKET_TYPE_NULL_PACKET:
break;
@ -2427,7 +2427,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
pus = NUMPAGES;
pub = NUMPAGES;
break;
break;
case PACKET_TYPE_NEW_GAME:
//Slaves in M/S mode only send to master
@ -2500,14 +2500,14 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
{
initprintf("Player has version %d, expecting %d\n",packbuf[2],(char)atoi(s_buildDate));
G_GameExit("You cannot play with different versions of EDuke32!");
}
}
if (packbuf[3] != (char)BYTEVERSION)
{
initprintf("Player has version %d, expecting %d (%d, %d, %d)\n",packbuf[3],BYTEVERSION, NETVERSION, PLUTOPAK, VOLUMEONE);
G_GameExit("You cannot play Duke with different versions!");
}
}
if (packbuf[4] > g_numSyncBytes)
{
{
initprintf("Sync debugging enabled\n");
g_numSyncBytes = packbuf[4];
}
@ -2604,7 +2604,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
case PACKET_TYPE_MENU_LEVEL_QUIT:
//slaves in M/S mode only send to master
if (myconnectindex == connecthead)
{
{
//Master re-transmits message to all others
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
if (i != other)
@ -2629,7 +2629,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
boardfilename[packbufleng-1] = 0;
Bcorrectfilename(boardfilename,0);
if (boardfilename[0] != 0)
{
{
if ((i = kopen4loadfrommod(boardfilename,0)) < 0)
{
Bmemset(boardfilename,0,sizeof(boardfilename));
@ -2641,7 +2641,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
if (ud.m_level_number == 7 && ud.m_volume_number == 0 && boardfilename[0] == 0)
ud.m_level_number = 0;
break;
break;
case PACKET_TYPE_MAP_VOTE:
case PACKET_TYPE_MAP_VOTE_INITIATE:
@ -2653,7 +2653,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
if (i != other)
Net_SendPacket(i,packbuf,packbufleng);
}
}
switch (packbuf[0])
{
@ -2665,7 +2665,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
Bsprintf(tempbuf,"Confirmed vote from %s",g_player[packbuf[1]].user_name);
G_AddUserQuote(tempbuf);
}
break;
break;
case PACKET_TYPE_MAP_VOTE_INITIATE: // call map vote
/* if (g_networkBroadcastMode == 0 && packbuf[1] == connecthead)
@ -2706,11 +2706,11 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
{
g_player[i].vote = 0;
g_player[i].gotvote = 0;
}
}
G_AddUserQuote(tempbuf);
}
}
break;
}
}
break;
//case PACKET_TYPE_LOAD_GAME:
@ -3063,12 +3063,12 @@ void Net_ParseClientPacket(ENetEvent *event)
break;
default:
{
uint8_t *pbuf = event->packet->data;
int32_t packbufleng = event->packet->dataLength;
int16_t j;
int32_t other = pbuf[--packbufleng];
switch (pbuf[0])
{
uint8_t *pbuf = event->packet->data;
int32_t packbufleng = event->packet->dataLength;
int16_t j;
int32_t other = pbuf[--packbufleng];
switch (pbuf[0])
{
//case PACKET_SLAVE_TO_MASTER: //[1] (receive slave sync buffer)
// Net_ReceiveClientUpdate(event);
// break;
@ -3105,14 +3105,14 @@ void Net_ParseClientPacket(ENetEvent *event)
// g_player[other].pingcnt++;
// break;
case PACKET_AUTH:
Net_ReceiveChallenge(pbuf, packbufleng, event);
break;
case PACKET_AUTH:
Net_ReceiveChallenge(pbuf, packbufleng, event);
break;
default:
Net_ParsePacketCommon(pbuf, packbufleng, 0);
break;
}
default:
Net_ParsePacketCommon(pbuf, packbufleng, 0);
break;
}
break;
}
}
@ -3168,7 +3168,7 @@ void Net_ParseServerPacket(ENetEvent *event)
case PACKET_PLAYER_DISCONNECTED:
//if ((g_player[myconnectindex].ps->gm & MODE_GAME))
P_RemovePlayer(pbuf[1]);
P_RemovePlayer(pbuf[1]);
numplayers = pbuf[2];
ud.multimode = pbuf[3];
g_mostConcurrentPlayers = pbuf[4];

View file

@ -619,7 +619,7 @@ static int osdcmd_cmenu(osdcmdptr_t parm)
if ((g_player[myconnectindex].ps->gm & MODE_MENU) != MODE_MENU)
Menu_Open(myconnectindex);
Menu_Change(Batol(parm->parms[0]));
Menu_Change(Batol(parm->parms[0]));
return OSDCMD_OK;
}
@ -769,7 +769,7 @@ static int osdcmd_button(osdcmdptr_t parm)
// if (g_player[myconnectindex].ps->gm == MODE_GAME) // only trigger these if in game
CONTROL_ButtonFlags[CONFIG_FunctionNameToNum(p)] = 1; // FIXME
return OSDCMD_OK;
return OSDCMD_OK;
}
const char *const ConsoleButtons[] =
@ -887,37 +887,37 @@ static int osdcmd_bind(osdcmdptr_t parm)
CONTROL_BindKey(sctokeylut[i].sc, tempbuf, repeat, sctokeylut[i].key);
char *cp = tempbuf;
char *cp = tempbuf;
// Populate the keyboard config menu based on the bind.
// Take care of processing one-to-many bindings properly, too.
// Populate the keyboard config menu based on the bind.
// Take care of processing one-to-many bindings properly, too.
static char const s_gamefunc_[] = "gamefunc_";
int constexpr strlen_gamefunc_ = ARRAY_SIZE(s_gamefunc_) - 1;
while ((cp = Bstrstr(cp, s_gamefunc_)))
{
{
cp += strlen_gamefunc_;
char *semi = Bstrchr(cp, ';');
if (semi)
*semi = 0;
if (semi)
*semi = 0;
j = CONFIG_FunctionNameToNum(cp);
j = CONFIG_FunctionNameToNum(cp);
if (semi)
cp = semi+1;
if (semi)
cp = semi+1;
if (j != -1)
{
ud.config.KeyboardKeys[j][1] = ud.config.KeyboardKeys[j][0];
if (j != -1)
{
ud.config.KeyboardKeys[j][1] = ud.config.KeyboardKeys[j][0];
ud.config.KeyboardKeys[j][0] = sctokeylut[i].sc;
// CONTROL_MapKey(j, sctokeylut[i].sc, ud.config.KeyboardKeys[j][0]);
if (j == gamefunc_Show_Console)
if (j == gamefunc_Show_Console)
OSD_CaptureKey(sctokeylut[i].sc);
}
}
}
if (!OSD_ParsingScript())
OSD_Printf("%s\n",parm->raw);
@ -963,10 +963,10 @@ static int osdcmd_unbind(osdcmdptr_t parm)
{
if (!Bstrcasecmp(parm->parms[0], ConsoleButtons[i]))
{
CONTROL_FreeMouseBind(i);
CONTROL_FreeMouseBind(i);
OSD_Printf("unbound %s\n", ConsoleButtons[i]);
return OSDCMD_OK;
}
return OSDCMD_OK;
}
}
return OSDCMD_SHOWHELP;
@ -1507,12 +1507,12 @@ int32_t registerosdcommands(void)
{
switch (cv.flags & (CVAR_FUNCPTR|CVAR_MULTI))
{
case CVAR_FUNCPTR:
case CVAR_FUNCPTR:
OSD_RegisterCvar(&cv, osdcmd_cvar_set_game); break;
case CVAR_MULTI:
case CVAR_FUNCPTR|CVAR_MULTI:
case CVAR_MULTI:
case CVAR_FUNCPTR|CVAR_MULTI:
OSD_RegisterCvar(&cv, osdcmd_cvar_set_multi); break;
default:
default:
OSD_RegisterCvar(&cv, osdcmd_cvar_set); break;
}
}

View file

@ -2736,12 +2736,13 @@ enddisplayweapon:
int32_t g_myAimMode = 0, g_myAimStat = 0, g_oldAimStat = 0;
int32_t mouseyaxismode = -1;
void P_GetInput(int const playerNum)
void P_GetInput(int playerNum)
{
auto const pPlayer = g_player[playerNum].ps;
ControlInfo info;
if ((pPlayer->gm & (MODE_MENU | MODE_TYPE)) || (ud.pause_on && !KB_KeyPressed(sc_Pause)))
if ((pPlayer->gm & (MODE_MENU|MODE_TYPE)) || (ud.pause_on && !KB_KeyPressed(sc_Pause)))
{
if (!(pPlayer->gm&MODE_MENU))
CONTROL_GetInput(&info);
@ -2855,7 +2856,7 @@ void P_GetInput(int const playerNum)
input.q16avel += fix16_from_int((turnHeldTime >= TURBOTURNTIME) ? (turnAmount << 1) : (PREAMBLETURN << 1));
}
else
turnHeldTime = 0;
turnHeldTime=0;
}
if (BUTTON(gamefunc_Strafe_Left) && !(pPlayer->movement_lock & 4))
@ -3018,11 +3019,11 @@ void P_GetInput(int const playerNum)
ud.folfvel = input.fvel;
ud.folavel = fix16_to_int(input.q16avel);
localInput.fvel = 0;
localInput.svel = 0;
localInput.fvel = 0;
localInput.svel = 0;
localInput.q16avel = 0;
localInput.q16horz = 0;
localInput.q16avel = 0;
localInput.q16horz = 0;
return;
}
@ -4008,7 +4009,7 @@ static int32_t P_DoCounters(int playerNum)
}
A_PlaySound(soundId, pPlayer->i);
}
else if ((int32_t)totalclock > 1024)
else if (totalclock > 1024)
if (playerNum == screenpeek || GTFLAGS(GAMETYPE_COOPSOUND))
{
if (rand()&1)

View file

@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "menus.h"
#include "demo.h"
#include "savegame.h"
#include "cmdline.h"
static int32_t g_whichPalForPlayer = 9;
@ -687,7 +688,7 @@ void G_CacheMapData(void)
Bmemset(gotpic, 0, sizeof(gotpic));
endtime = timerGetTicks();
endtime = timerGetTicks();
OSD_Printf("Cache time: %dms\n", endtime-starttime);
}
@ -2177,7 +2178,7 @@ static inline void clearfrags(void)
void G_ResetTimers(uint8_t keepgtics)
{
ototalclock = totalclock = g_cloudClock = lockclock = 0;
totalclock = g_cloudClock = ototalclock = lockclock = 0;
ready2send = 1;
g_levelTextTime = 85;

View file

@ -290,10 +290,10 @@ static inline void G_MoveClouds(void)
{
int32_t i;
if ((int32_t)totalclock <= g_cloudClock && (int32_t)totalclock >= (g_cloudClock - 7))
if (totalclock <= g_cloudClock && totalclock >= (g_cloudClock-7))
return;
g_cloudClock = (int32_t)totalclock + 6;
g_cloudClock = totalclock+6;
g_cloudX += sintable[(fix16_to_int(g_player[screenpeek].ps->q16ang)+512)&2047]>>9;
g_cloudY += sintable[fix16_to_int(g_player[screenpeek].ps->q16ang)&2047]>>9;
@ -1062,7 +1062,7 @@ void G_DisplayRest(int32_t smoothratio)
if (ud.overhead_on > 0)
{
// smoothratio = min(max(smoothratio,0),65536);
smoothratio = calc_smoothratio((int32_t)totalclock, (int32_t)ototalclock);
smoothratio = calc_smoothratio(totalclock, ototalclock);
G_DoInterpolations(smoothratio);
if (ud.scrollmode == 0)
@ -2420,7 +2420,7 @@ void G_BonusScreen(int32_t bonusonly)
break;
}
}
else if ((int32_t)totalclock > (10240+120L)) break;
else if (totalclock > (10240+120L)) break;
else
{
switch (((int32_t) totalclock>>5)&3)
@ -3010,7 +3010,7 @@ void G_BonusScreenRRRA(int32_t bonusonly)
break;
}
}
else if ((int32_t)totalclock > (10240+120L)) break;
else if (totalclock > (10240+120L)) break;
else
{
switch (((int32_t) totalclock>>5)&3)