Disable Gold-only weapons for Regular edition (Tim Beckmann)

fixed compiling with -DNDEBUG
This commit is contained in:
Steven Fuller 2002-02-09 19:30:43 +00:00 committed by Patryk Obara
parent 47d9cc1b2c
commit e681d155d9
8 changed files with 70 additions and 20 deletions

View file

@ -4,13 +4,14 @@ CXX = gcc
#CXX = gcc-3.0
NASM = nasm
#CFLAGS = -g -Wall -pipe -Dengine=1 -I. -Iinclude -Iwin95 -Iavp -Iavp/win95 -Iavp/support -Iavp/win95/frontend -Iavp/win95/gadgets
CFLAGS = -g -Wall -pipe -O2 -Dengine=1 -I. -Iinclude -Iwin95 -Iavp -Iavp/win95 -Iavp/support -Iavp/win95/frontend -Iavp/win95/gadgets
#CFLAGS = -Wall -pipe -O6 -ffast-math -fomit-frame-pointer -march=pentiumpro -mcpu=pentiumpro -Dengine=1 -I. -Iinclude -Iwin95 -Iavp -Iavp/win95 -Iavp/support -Iavp/win95/frontend -Iavp/win95/gadgets
#CFLAGS = -g -Wall -pipe
CFLAGS = -g -Wall -pipe -O2
#CFLAGS = -DNDEBUG -Wall -pipe -O6 -ffast-math -fomit-frame-pointer -march=pentiumpro -mcpu=pentiumpro
CFLAGS += -Dengine=1 -I. -Iinclude -Iwin95 -Iavp -Iavp/win95 -Iavp/support -Iavp/win95/frontend -Iavp/win95/gadgets
CXXFLAGS = $(CFLAGS)
CFLAGS += $(shell sdl-config --cflags)
#LDLIBS = -L/usr/X11R6/lib -lX11 -lXext -lGL $(shell sdl-config --libs) -lopenal
LDLIBS = $(shell sdl-config --libs) -lGL -lopenal
# Debian SDL+NVIDIA workaround (change /usr/lib to the real location of the files)

1
README
View file

@ -65,6 +65,7 @@ Hopefully all the necessary file loading changes were made. Please let me
know if something goes wrong.
***
The next line can be ignored for now:
If you have the regular edition, add -DREGULAR_EDITION to CFLAGS.
If the version you want to use is not the Gold Edition, download

View file

@ -31,7 +31,6 @@
#include "huddefs.h"
#include "ai_sight.h"
#include "targeting.h"
#include "inventry.h"
#include "game_statistics.h"
#include "particle.h"

View file

@ -30,7 +30,6 @@
#include "game_statistics.h"
#include "avp_userprofile.h"
#include "huddefs.h"
#include "avp_menus.h"
#include "savegame.h"
#include "huffman.hpp"

View file

@ -196,6 +196,8 @@ struct Target PlayersTarget;
int GrenadeLauncherSelectedAmmo;
int LastHand; // For alien claws and two pistols
int AllowGoldWeapons = 0; // flag to indicate the Gold version weapons should be allowed
char *GrenadeLauncherBulletNames[6] = {
"bulletF", //05_
"bulletA", //_
@ -1637,6 +1639,12 @@ static int RequestChangeOfWeapon(PLAYER_STATUS *playerStatusPtr,PLAYER_WEAPON_DA
}
}
}
// Disallow Gold version weapons with regular version
if (!AllowGoldWeapons && ((playerStatusPtr->WeaponSlot[newSlot].WeaponIDNumber==WEAPON_FRISBEE_LAUNCHER) ||
(playerStatusPtr->WeaponSlot[newSlot].WeaponIDNumber==WEAPON_MARINE_PISTOL) ||
(playerStatusPtr->WeaponSlot[newSlot].WeaponIDNumber==WEAPON_TWO_PISTOLS))) {
slotValidity=0;
}
} while(slotValidity==0);
if(newSlot != playerStatusPtr->SelectedWeaponSlot)
@ -1704,6 +1712,12 @@ static int RequestChangeOfWeapon(PLAYER_STATUS *playerStatusPtr,PLAYER_WEAPON_DA
}
}
}
// Disallow Gold version weapons with regular version
if (!AllowGoldWeapons && ((playerStatusPtr->WeaponSlot[newSlot].WeaponIDNumber==WEAPON_FRISBEE_LAUNCHER) ||
(playerStatusPtr->WeaponSlot[newSlot].WeaponIDNumber==WEAPON_MARINE_PISTOL) ||
(playerStatusPtr->WeaponSlot[newSlot].WeaponIDNumber==WEAPON_TWO_PISTOLS))) {
slotValidity=0;
}
} while(slotValidity==0);
if(newSlot != playerStatusPtr->SelectedWeaponSlot)
@ -1723,6 +1737,12 @@ static int RequestChangeOfWeapon(PLAYER_STATUS *playerStatusPtr,PLAYER_WEAPON_DA
if( (requestedSlot != playerStatusPtr->SelectedWeaponSlot)
&&(playerStatusPtr->WeaponSlot[requestedSlot].Possessed == 1) )
{
// Disallow Gold version weapons with regular version
if (!AllowGoldWeapons && ((playerStatusPtr->WeaponSlot[requestedSlot].WeaponIDNumber==WEAPON_FRISBEE_LAUNCHER) ||
(playerStatusPtr->WeaponSlot[requestedSlot].WeaponIDNumber==WEAPON_MARINE_PISTOL) ||
(playerStatusPtr->WeaponSlot[requestedSlot].WeaponIDNumber==WEAPON_TWO_PISTOLS))) {
return 0;
}
if (playerStatusPtr->WeaponSlot[requestedSlot].WeaponIDNumber==WEAPON_PRED_DISC) {
if (playerStatusPtr->WeaponSlot[requestedSlot].PrimaryRoundsRemaining==0
&& playerStatusPtr->WeaponSlot[requestedSlot].PrimaryMagazinesRemaining==0) {
@ -1859,6 +1879,12 @@ static int RequestChangeOfWeaponWhilstSwapping(PLAYER_STATUS *playerStatusPtr,PL
}
}
}
// Disallow Gold version weapons with regular version
if (!AllowGoldWeapons && ((playerStatusPtr->WeaponSlot[newSlot].WeaponIDNumber==WEAPON_FRISBEE_LAUNCHER) ||
(playerStatusPtr->WeaponSlot[newSlot].WeaponIDNumber==WEAPON_MARINE_PISTOL) ||
(playerStatusPtr->WeaponSlot[newSlot].WeaponIDNumber==WEAPON_TWO_PISTOLS))) {
slotValidity=0;
}
}
while(slotValidity==0);
@ -1923,6 +1949,12 @@ static int RequestChangeOfWeaponWhilstSwapping(PLAYER_STATUS *playerStatusPtr,PL
}
}
}
// Disallow Gold version weapons with regular version
if (!AllowGoldWeapons && ((playerStatusPtr->WeaponSlot[newSlot].WeaponIDNumber==WEAPON_FRISBEE_LAUNCHER) ||
(playerStatusPtr->WeaponSlot[newSlot].WeaponIDNumber==WEAPON_MARINE_PISTOL) ||
(playerStatusPtr->WeaponSlot[newSlot].WeaponIDNumber==WEAPON_TWO_PISTOLS))) {
slotValidity=0;
}
}
while(slotValidity==0);
@ -1940,6 +1972,12 @@ static int RequestChangeOfWeaponWhilstSwapping(PLAYER_STATUS *playerStatusPtr,PL
if( (requestedSlot != currentSlot)
&&(playerStatusPtr->WeaponSlot[requestedSlot].Possessed == 1) )
{
// Disallow Gold version weapons with regular version
if (!AllowGoldWeapons && ((playerStatusPtr->WeaponSlot[requestedSlot].WeaponIDNumber==WEAPON_FRISBEE_LAUNCHER) ||
(playerStatusPtr->WeaponSlot[requestedSlot].WeaponIDNumber==WEAPON_MARINE_PISTOL) ||
(playerStatusPtr->WeaponSlot[requestedSlot].WeaponIDNumber==WEAPON_TWO_PISTOLS))) {
return 0;
}
if (playerStatusPtr->WeaponSlot[requestedSlot].WeaponIDNumber==WEAPON_PRED_DISC) {
if (playerStatusPtr->WeaponSlot[requestedSlot].PrimaryRoundsRemaining==0
&& playerStatusPtr->WeaponSlot[requestedSlot].PrimaryMagazinesRemaining==0) {

View file

@ -570,20 +570,28 @@ void InitNPCs(RIFFHANDLE h)
}
#endif
/* i believe this was added for the gold edition */
#if !(PREDATOR_DEMO||MARINE_DEMO||ALIEN_DEMO||REGULAR_EDITION)
if(AvP.PlayerType==I_Marine || Load_HNPC[HNPC_Marine])
{
//need to load the mdisk hierarchy
LoadedNPC tempnpc("mdisk.rif");
if (tempnpc.IsValid())
{
newnpcs.add_entry(tempnpc);
}
extern int AllowGoldWeapons;
// if the mdisk.rif file exists, add it. Note: Only the Gold version
// has this file, so the OpenGameFile is called just to check if it
// is available.
FILE *rifFile = OpenGameFile(DIRECTORY_FOR_RIFS"mdisk.rif",
FILEMODE_READONLY, FILETYPE_PERM);
if (rifFile != NULL)
{
CloseGameFile(rifFile);
//need to load the mdisk hierarchy
LoadedNPC tempnpc("mdisk.rif");
if (tempnpc.IsValid())
{
AllowGoldWeapons = 1;
newnpcs.add_entry(tempnpc);
}
}
}
#endif
// see what we already have, unloading what we don't need, and ensuring we don't load a npc twice
for (LIF<LoadedNPC> i_loaded_npc(&loaded_npcs); !i_loaded_npc.done(); )
@ -600,8 +608,10 @@ void InitNPCs(RIFFHANDLE h)
i_loaded_npc.delete_current();
}
}
#if debug
if(!KeepMainRifFile)
#endif
{
//at this point we no longer need the main level rif file
unload_rif(h);
@ -637,11 +647,13 @@ void InitNPCs(RIFFHANDLE h)
}
Set_Progress_Bar_Position(PBAR_NPC_START+PBAR_NPC_INTERVAL);
#if debug
if(KeepMainRifFile)
{
Env_Chunk = old_env_chunk; // pop Env_Chunk
}
else
#endif
{
Env_Chunk=0;
}

View file

@ -228,7 +228,7 @@ namespace AwTl
db_log1(("AW: Potential Memory Leaks Detected!!!"));
}
#ifdef _CPPRTTI
#warning "Run-Time Type Identification (RTTI) is enabled"
//#warning "Run-Time Type Identification (RTTI) is enabled"
for (Iterator itLeak(*this) ; !itLeak.Done() ; itLeak.Next())
{
db_logf1(("\tAW Object not deallocated: Type: %s RefCnt: %u",typeid(*itLeak.Get()).name(),itLeak.Get()->m_nRefCnt));
@ -238,7 +238,7 @@ namespace AwTl
db_log1(("AW: Object dump complete"));
}
#else // ! _CPPRTTI
#warning "Run-Time Type Identification (RTTI) is not enabled - memory leak checking will not report types"
//#warning "Run-Time Type Identification (RTTI) is not enabled - memory leak checking will not report types"
unsigned nRefs(0);
for (Iterator itLeak(*this) ; !itLeak.Done() ; itLeak.Next())
{

View file

@ -37,7 +37,7 @@
#endif
#ifdef NDEBUG
#define fail if (0)
static void fail(...) {}
#define list_fail_get_data_from_sentinel NULL
#define list_fail_add_entry_after NULL
#define list_fail_add_entry_before NULL