mirror of
https://github.com/bearstonem/openmohaa-vr.git
synced 2026-10-24 14:00:23 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60faa9dd9b | ||
|
|
75f8f86f86 | ||
|
|
0ee1307e75 | ||
|
|
f0c38305b5 | ||
|
|
e07dda6991 | ||
|
|
b10ce9a426 | ||
|
|
2ac2800ecb | ||
|
|
e59200a7de | ||
|
|
a7902a8837 | ||
|
|
615726cc75 | ||
|
|
839abf6076 | ||
|
|
c7c8d4580d | ||
|
|
2cc47e10f9 | ||
|
|
8fc5dacebf | ||
|
|
cb23f3bb70 | ||
|
|
d7350d8629 | ||
|
|
ac6b5ef1f7 | ||
|
|
7fdd26c59e | ||
|
|
fad555308b | ||
|
|
969255c48e | ||
|
|
433305617c | ||
|
|
5418d84c7e | ||
|
|
cca37e3dfe | ||
|
|
0e9d83ee14 | ||
|
|
ecbf7f6caa | ||
|
|
5a3638fa68 | ||
|
|
111088b540 | ||
|
|
ba1703ebf0 | ||
|
|
825df20a72 | ||
|
|
0a42fd79d2 | ||
|
|
e50a041c12 | ||
|
|
ce0e9fe77e |
No files matched your search
@@ -689,11 +689,14 @@ Called before every level change or subsystem restart
|
||||
void CG_Shutdown(void)
|
||||
{
|
||||
L_ShutdownEvents();
|
||||
// Shutdown radar
|
||||
cgi.CL_InitRadar(NULL, NULL, -1);
|
||||
|
||||
// some mods may need to do cleanup work here,
|
||||
// like closing files or archiving session data
|
||||
|
||||
// hide the stats screen
|
||||
cgi.UI_HideMenu("StatsScreen", 1);
|
||||
cgi.UI_HideMenu("StatsScreen", qtrue);
|
||||
|
||||
// reset the scoreboard
|
||||
CG_PrepScoreBoardInfo();
|
||||
|
||||
@@ -882,13 +882,13 @@ void CG_DrawActiveFrame(int serverTime, int frameTime, stereoFrame_t stereoView,
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
cgi.UI_ShowMenu("mission_success_1", CVAR_ARCHIVE);
|
||||
cgi.UI_HideMenu("mission_success_1", CVAR_ARCHIVE);
|
||||
break;
|
||||
case 2:
|
||||
cgi.UI_ShowMenu("mission_success_2", CVAR_ARCHIVE);
|
||||
cgi.UI_HideMenu("mission_success_2", CVAR_ARCHIVE);
|
||||
break;
|
||||
case 3:
|
||||
cgi.UI_ShowMenu("mission_success_3", CVAR_ARCHIVE);
|
||||
cgi.UI_HideMenu("mission_success_3", CVAR_ARCHIVE);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@@ -896,21 +896,21 @@ void CG_DrawActiveFrame(int serverTime, int frameTime, stereoFrame_t stereoView,
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
cgi.UI_ShowMenu("mission_failed_1", CVAR_ARCHIVE);
|
||||
cgi.UI_HideMenu("mission_failed_1", CVAR_ARCHIVE);
|
||||
break;
|
||||
case 2:
|
||||
cgi.UI_ShowMenu("mission_failed_2", CVAR_ARCHIVE);
|
||||
cgi.UI_HideMenu("mission_failed_2", CVAR_ARCHIVE);
|
||||
break;
|
||||
case 3:
|
||||
cgi.UI_ShowMenu("mission_failed_3", CVAR_ARCHIVE);
|
||||
cgi.UI_HideMenu("mission_failed_3", CVAR_ARCHIVE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (cgi.Cvar_Get("g_success", "", 0)->integer) {
|
||||
cgi.UI_ShowMenu("StatsScreen_Success", qfalse);
|
||||
cgi.UI_HideMenu("StatsScreen_Success", qfalse);
|
||||
} else {
|
||||
cgi.UI_ShowMenu("StatsScreen_Failed", qfalse);
|
||||
cgi.UI_HideMenu("StatsScreen_Failed", qfalse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2710,7 +2710,7 @@ Constructor
|
||||
Actor::Actor()
|
||||
: mVoiceType(-1)
|
||||
{
|
||||
entflags |= EF_ACTOR;
|
||||
entflags |= ECF_ACTOR;
|
||||
|
||||
m_pszDebugState = "";
|
||||
m_pFallPath = NULL;
|
||||
@@ -2963,7 +2963,7 @@ Actor::~Actor()
|
||||
ClearPointEntity();
|
||||
ClearTurnEntity();
|
||||
|
||||
entflags &= ~EF_ACTOR;
|
||||
entflags &= ~ECF_ACTOR;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -167,7 +167,7 @@ static size_t GetLongestClientCmdAllFramesLength(dtiki_t *tiki, int animnum, int
|
||||
|
||||
Animate::Animate()
|
||||
{
|
||||
entflags |= EF_ANIMATE;
|
||||
entflags |= ECF_ANIMATE;
|
||||
|
||||
syncTime = 0.0f;
|
||||
syncRate = 1.0f;
|
||||
@@ -198,7 +198,7 @@ Animate::Animate()
|
||||
|
||||
Animate::~Animate()
|
||||
{
|
||||
entflags &= ~EF_ANIMATE;
|
||||
entflags &= ~ECF_ANIMATE;
|
||||
}
|
||||
|
||||
void Animate::ForwardExec(Event *ev)
|
||||
|
||||
@@ -169,22 +169,24 @@ inline void Animate::PauseSyncTime(int pause)
|
||||
|
||||
inline void Animate::Archive(Archiver& arc)
|
||||
{
|
||||
int i;
|
||||
|
||||
Entity::Archive(arc);
|
||||
|
||||
for (int i = MAX_FRAMEINFOS - 1; i >= 0; i--) {
|
||||
for (i = 0; i < MAX_FRAMEINFOS; i++) {
|
||||
arc.ArchiveInteger(&animFlags[i]);
|
||||
}
|
||||
arc.ArchiveFloat(&syncTime);
|
||||
arc.ArchiveFloat(&syncRate);
|
||||
arc.ArchiveInteger(&pauseSyncTime);
|
||||
arc.ArchiveBool(&is_paused);
|
||||
for (int i = MAX_FRAMEINFOS - 1; i >= 0; i--) {
|
||||
for (i = 0; i < MAX_FRAMEINFOS; i++) {
|
||||
arc.ArchiveEventPointer(&doneEvents[i]);
|
||||
}
|
||||
for (int i = MAX_FRAMEINFOS - 1; i >= 0; i--) {
|
||||
for (i = 0; i < MAX_FRAMEINFOS; i++) {
|
||||
arc.ArchiveFloat(&animtimes[i]);
|
||||
}
|
||||
for (int i = MAX_FRAMEINFOS - 1; i >= 0; i--) {
|
||||
for (i = 0; i < MAX_FRAMEINFOS; i++) {
|
||||
arc.ArchiveFloat(&frametimes[i]);
|
||||
}
|
||||
arc.ArchiveVector(&frame_delta);
|
||||
|
||||
+20
-3
@@ -276,7 +276,7 @@ void Container<Type>::Archive(Archiver& arc)
|
||||
template<typename key, typename value>
|
||||
void con_set<key, value>::Archive(Archiver& arc)
|
||||
{
|
||||
Entry *e;
|
||||
Entry *e = NULL;
|
||||
int hash;
|
||||
int i;
|
||||
|
||||
@@ -295,17 +295,34 @@ void con_set<key, value>::Archive(Archiver& arc)
|
||||
e = new Entry;
|
||||
e->Archive(arc);
|
||||
|
||||
hash = HashCode<key>(e->key) % tableLength;
|
||||
hash = HashCode<key>(e->GetKey()) % tableLength;
|
||||
|
||||
e->next = table[hash];
|
||||
table[hash] = e;
|
||||
}
|
||||
|
||||
defaultEntry = e;
|
||||
} else {
|
||||
for (i = tableLength - 1; i >= 0; i--) {
|
||||
#ifndef NDEBUG
|
||||
int total;
|
||||
|
||||
total = 0;
|
||||
|
||||
for (i = 0; i < tableLength; i++) {
|
||||
for (e = table[i]; e != NULL; e = e->next) {
|
||||
e->Archive(arc);
|
||||
total++;
|
||||
}
|
||||
}
|
||||
// it must match the number of elements
|
||||
assert(total == count);
|
||||
#else
|
||||
for (i = 0; i < tableLength; i++) {
|
||||
for (e = table[i]; e != NULL; e = e->next) {
|
||||
e->Archive(arc);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -389,6 +389,7 @@ movement on the server game.
|
||||
|
||||
// entityState_t->eFlags
|
||||
// su44: eFlags used in MoHAA
|
||||
#define EF_EVERYFRAME 0x00000008
|
||||
#define EF_CLIMBWALL 0x00000010
|
||||
#define EF_UNARMED 0x00000020 // su44: this player has his weapon holstered
|
||||
#define EF_LINKANGLES 0x00000040
|
||||
@@ -422,7 +423,6 @@ movement on the server game.
|
||||
#define EF_AWARD_ASSIST 0x00020000 // draw a assist sprite
|
||||
#define EF_AWARD_DENIED 0x00040000 // denied
|
||||
#define EF_TEAMVOTED 0x00080000 // already cast a team vote
|
||||
#define EF_EVERYFRAME 0x00100000 // def commands will be run every client frame
|
||||
#define EF_ANTISBJUICE 0x00200000 // anti sucknblow juice
|
||||
#define EF_DONT_PROCESS_COMMANDS 0x00400000 // don't process client commands for this entity
|
||||
|
||||
|
||||
@@ -542,7 +542,7 @@ CLASS_DECLARATION(Entity, SplinePath, "info_splinepath") {
|
||||
|
||||
SplinePath::SplinePath()
|
||||
{
|
||||
entflags |= EF_SPLINEPATH;
|
||||
entflags |= ECF_SPLINEPATH;
|
||||
|
||||
AddWaitTill(STRING_REACH);
|
||||
|
||||
|
||||
@@ -702,7 +702,7 @@ Camera::Camera()
|
||||
{
|
||||
Vector ang;
|
||||
|
||||
entflags |= EF_CAMERA;
|
||||
entflags |= ECF_CAMERA;
|
||||
|
||||
AddWaitTill(STRING_START);
|
||||
AddWaitTill(STRING_TRIGGER);
|
||||
|
||||
@@ -101,7 +101,7 @@ CLASS_DECLARATION(Entity, CrateObject, "func_crate") {
|
||||
|
||||
CrateObject::CrateObject()
|
||||
{
|
||||
entflags |= EF_CRATEOBJECT;
|
||||
entflags |= ECF_CRATEOBJECT;
|
||||
|
||||
AddWaitTill(STRING_DEATH);
|
||||
|
||||
|
||||
@@ -310,6 +310,8 @@ void DamageModel::EventSetKillThread(Event *ev)
|
||||
|
||||
void DamageModel::Archive(Archiver& arc)
|
||||
{
|
||||
Animate::Archive(arc);
|
||||
|
||||
label.Archive(arc);
|
||||
arc.ArchiveSafePointer(&boundingBoxEnt);
|
||||
}
|
||||
@@ -321,7 +321,7 @@ Door::Door()
|
||||
{
|
||||
float t;
|
||||
|
||||
entflags |= EF_DOOR;
|
||||
entflags |= ECF_DOOR;
|
||||
if (LoadingSavegame) {
|
||||
return;
|
||||
}
|
||||
|
||||
+17
-18
@@ -1686,7 +1686,7 @@ Entity::Entity()
|
||||
entnum = edict->s.number;
|
||||
radnum = -1;
|
||||
|
||||
entflags |= EF_ENTITY;
|
||||
entflags |= ECF_ENTITY;
|
||||
|
||||
AddWaitTill(STRING_DAMAGE);
|
||||
AddWaitTill(STRING_SPAWN);
|
||||
@@ -1780,9 +1780,6 @@ Entity::Entity()
|
||||
m_BlockedPaths = NULL;
|
||||
|
||||
m_bHintRequiresLookAt = true;
|
||||
|
||||
// Misc
|
||||
m_bBindChilds = false;
|
||||
}
|
||||
|
||||
Entity::~Entity()
|
||||
@@ -1852,7 +1849,7 @@ Entity::~Entity()
|
||||
|
||||
level.FreeEdict(edict);
|
||||
|
||||
entflags &= ~EF_ENTITY;
|
||||
entflags &= ~ECF_ENTITY;
|
||||
}
|
||||
|
||||
void Entity::ClassnameEvent(Event *ev)
|
||||
@@ -4704,7 +4701,7 @@ qboolean Entity::isBoundTo(Entity *master)
|
||||
return false;
|
||||
}
|
||||
|
||||
void Entity::bind(Entity *master, qboolean use_my_angles, qboolean bBindChilds)
|
||||
void Entity::bind(Entity *master, qboolean use_my_angles)
|
||||
{
|
||||
float mat[3][3];
|
||||
float local[3][3];
|
||||
@@ -4721,8 +4718,6 @@ void Entity::bind(Entity *master, qboolean use_my_angles, qboolean bBindChilds)
|
||||
return;
|
||||
}
|
||||
|
||||
m_bBindChilds = bBindChilds;
|
||||
|
||||
// unbind myself from my master
|
||||
unbind();
|
||||
|
||||
@@ -4885,17 +4880,10 @@ void Entity::EventUnbind(Event *ev)
|
||||
void Entity::BindEvent(Event *ev)
|
||||
{
|
||||
Entity *ent;
|
||||
bool bBindChilds;
|
||||
|
||||
ent = ev->GetEntity(1);
|
||||
if (ent) {
|
||||
if (ev->NumArgs() > 1) {
|
||||
bBindChilds = ev->GetBoolean(2);
|
||||
} else {
|
||||
bBindChilds = false;
|
||||
}
|
||||
|
||||
bind(ent, false, bBindChilds);
|
||||
bind(ent, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5783,8 +5771,13 @@ void Entity::Archive(Archiver& arc)
|
||||
arc.ArchiveInteger(&spawnflags);
|
||||
|
||||
arc.ArchiveString(&model);
|
||||
if (arc.Loading() && model.length()) {
|
||||
setModel(model);
|
||||
if (arc.Loading() && AutoArchiveModel()) {
|
||||
if (model.length() && model[0] == '*') {
|
||||
// set the brush model
|
||||
edict->s.modelindex = atoi(model.c_str() + 1);
|
||||
} else {
|
||||
setModel(model);
|
||||
}
|
||||
}
|
||||
|
||||
arc.ArchiveVector(&mins);
|
||||
@@ -5849,6 +5842,11 @@ void Entity::Archive(Archiver& arc)
|
||||
|
||||
ArchiveEnum(takedamage, damage_t);
|
||||
|
||||
arc.ArchiveSafePointer(&enemy);
|
||||
arc.ArchiveFloat(&pain_finished);
|
||||
arc.ArchiveFloat(&damage_debounce_time);
|
||||
arc.ArchiveInteger(&damage_type);
|
||||
|
||||
arc.ArchiveInteger(&m_iNumGlues);
|
||||
|
||||
for (i = 0; i < MAX_GLUE_CHILDREN; i++) {
|
||||
@@ -5858,6 +5856,7 @@ void Entity::Archive(Archiver& arc)
|
||||
|
||||
arc.ArchiveObjectPointer((Class **)&m_pGlueMaster);
|
||||
arc.ArchiveBool(&m_bGlueAngles);
|
||||
arc.ArchiveBool(&m_bGlueDuckable);
|
||||
arc.ArchiveBoolean(&detach_at_death);
|
||||
|
||||
arc.ArchiveFloat(&stealthMovementScale);
|
||||
|
||||
+5
-2
@@ -285,10 +285,13 @@ public:
|
||||
// immune list
|
||||
Container<int> immunities;
|
||||
|
||||
//
|
||||
// Openmohaa additions
|
||||
//====
|
||||
// miscellaneous
|
||||
qboolean m_bBindChilds;
|
||||
bool m_bHintRequiresLookAt;
|
||||
str m_HintString;
|
||||
//====
|
||||
|
||||
Entity();
|
||||
virtual ~Entity();
|
||||
@@ -538,7 +541,7 @@ public:
|
||||
void joinTeam(Entity *teammember);
|
||||
void quitTeam(void);
|
||||
qboolean isBoundTo(Entity *master);
|
||||
virtual void bind(Entity *master, qboolean use_my_angles = qfalse, qboolean bBindChilds = qfalse);
|
||||
virtual void bind(Entity *master, qboolean use_my_angles = qfalse);
|
||||
virtual void unbind(void);
|
||||
virtual void glue(Entity *master, qboolean use_my_angles = qtrue, qboolean can_duck = qfalse);
|
||||
virtual void unglue(void);
|
||||
|
||||
@@ -904,6 +904,12 @@ void ScriptThreadLabel::Execute(const SafePtr<Listener>& listener, const SafePtr
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptThreadLabel::Clear()
|
||||
{
|
||||
m_Script = NULL;
|
||||
m_Label = STRING_EMPTY;
|
||||
}
|
||||
|
||||
void ScriptThreadLabel::Set(const char *label)
|
||||
{
|
||||
str script;
|
||||
|
||||
@@ -165,6 +165,7 @@ public:
|
||||
void Execute(Listener *listener, Event *ev);
|
||||
void Execute(const SafePtr<Listener> &listener, const SafePtr<Listener> ¶m);
|
||||
|
||||
void Clear();
|
||||
void Set(const char *label);
|
||||
void Set(const_str label);
|
||||
void SetScript(const ScriptVariable& label);
|
||||
|
||||
@@ -53,7 +53,7 @@ CLASS_DECLARATION( Weapon, InventoryItem, NULL )
|
||||
|
||||
InventoryItem::InventoryItem()
|
||||
{
|
||||
entflags |= EF_INVENTORYITEM;
|
||||
entflags |= ECF_INVENTORYITEM;
|
||||
|
||||
if ( LoadingSavegame )
|
||||
{
|
||||
@@ -65,7 +65,7 @@ InventoryItem::InventoryItem()
|
||||
|
||||
InventoryItem::~InventoryItem()
|
||||
{
|
||||
entflags &= ~EF_INVENTORYITEM;
|
||||
entflags &= ~ECF_INVENTORYITEM;
|
||||
}
|
||||
|
||||
void InventoryItem::ActivateItem
|
||||
|
||||
+2
-2
@@ -341,7 +341,7 @@ Item::Item()
|
||||
{
|
||||
str fullname;
|
||||
|
||||
entflags |= EF_ITEM;
|
||||
entflags |= ECF_ITEM;
|
||||
|
||||
AddWaitTill(STRING_PICKUP);
|
||||
|
||||
@@ -403,7 +403,7 @@ Item::~Item()
|
||||
owner = NULL;
|
||||
}
|
||||
|
||||
entflags &= ~EF_ITEM;
|
||||
entflags &= ~ECF_ITEM;
|
||||
}
|
||||
|
||||
void Item::RemoveFromOwner(void)
|
||||
|
||||
+3
-3
@@ -1960,7 +1960,7 @@ CLASS_DECLARATION(SimpleArchivedEntity, Waypoint, "info_waypoint") {
|
||||
|
||||
Waypoint::Waypoint()
|
||||
{
|
||||
entflags |= EF_WAYPOINT;
|
||||
entflags |= ECF_WAYPOINT;
|
||||
}
|
||||
|
||||
CLASS_DECLARATION(SimpleArchivedEntity, TempWaypoint, NULL) {
|
||||
@@ -1969,7 +1969,7 @@ CLASS_DECLARATION(SimpleArchivedEntity, TempWaypoint, NULL) {
|
||||
|
||||
TempWaypoint::TempWaypoint()
|
||||
{
|
||||
entflags |= EF_TEMPWAYPOINT;
|
||||
entflags |= ECF_TEMPWAYPOINT;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -1988,7 +1988,7 @@ CLASS_DECLARATION(Waypoint, VehiclePoint, "info_vehiclepoint") {
|
||||
|
||||
VehiclePoint::VehiclePoint()
|
||||
{
|
||||
entflags |= EF_VEHICLEPOINT;
|
||||
entflags |= ECF_VEHICLEPOINT;
|
||||
spawnflags = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1166,7 +1166,7 @@ void PathNode::operator delete(void *ptr)
|
||||
|
||||
PathNode::PathNode()
|
||||
{
|
||||
entflags |= EF_PATHNODE;
|
||||
entflags |= ECF_PATHNODE;
|
||||
findCount = 0;
|
||||
pLastClaimer = NULL;
|
||||
numChildren = 0;
|
||||
@@ -1186,7 +1186,7 @@ PathNode::PathNode()
|
||||
|
||||
PathNode::~PathNode()
|
||||
{
|
||||
entflags &= ~EF_PATHNODE;
|
||||
entflags &= ~ECF_PATHNODE;
|
||||
}
|
||||
|
||||
void PathNode::Remove(Event *ev)
|
||||
|
||||
+30
-24
@@ -1950,7 +1950,7 @@ Player::Player()
|
||||
//
|
||||
// set the entity type
|
||||
//
|
||||
entflags |= EF_PLAYER;
|
||||
entflags |= ECF_PLAYER;
|
||||
|
||||
mCurTrailOrigin = 0;
|
||||
mLastTrailTime = 0;
|
||||
@@ -1992,6 +1992,16 @@ Player::Player()
|
||||
m_iInvulnerableTimeRemaining = 0;
|
||||
m_fLastVoteTime = 0;
|
||||
|
||||
//
|
||||
// Openmohaa additions
|
||||
//====
|
||||
m_bShowingHint = false;
|
||||
disable_spectate = false;
|
||||
disable_team_change = false;
|
||||
m_fpsTiki = NULL;
|
||||
m_bConnected = false;
|
||||
//====
|
||||
|
||||
if (LoadingSavegame) {
|
||||
return;
|
||||
}
|
||||
@@ -2134,21 +2144,15 @@ Player::Player()
|
||||
|
||||
//
|
||||
// Openmohaa additions
|
||||
//
|
||||
m_bShowingHint = false;
|
||||
disable_spectate = false;
|
||||
disable_team_change = false;
|
||||
//====
|
||||
m_bFrozen = false;
|
||||
animDoneVM = true;
|
||||
m_fVMAtime = 0;
|
||||
m_fpsTiki = NULL;
|
||||
//====
|
||||
|
||||
for (int i = 0; i < MAX_SPEED_MULTIPLIERS; i++) {
|
||||
speed_multiplier[i] = 1.0f;
|
||||
}
|
||||
|
||||
m_pKilledEvent = NULL;
|
||||
m_bConnected = false;
|
||||
}
|
||||
|
||||
Player::~Player()
|
||||
@@ -2171,7 +2175,7 @@ Player::~Player()
|
||||
legs_conditionals.FreeObjectList();
|
||||
torso_conditionals.FreeObjectList();
|
||||
|
||||
entflags &= ~EF_PLAYER;
|
||||
entflags &= ~ECF_PLAYER;
|
||||
}
|
||||
|
||||
static qboolean logfile_started = qfalse;
|
||||
@@ -2480,6 +2484,11 @@ void Player::InitModel(void)
|
||||
}
|
||||
}
|
||||
|
||||
InitModelFps();
|
||||
}
|
||||
|
||||
void Player::InitModelFps(void)
|
||||
{
|
||||
char model_name[MAX_STRING_TOKENS];
|
||||
char *model_replace;
|
||||
|
||||
@@ -3036,18 +3045,19 @@ void Player::Killed(Event *ev)
|
||||
Entity *inflictor;
|
||||
int meansofdeath;
|
||||
int location;
|
||||
Event *event;
|
||||
Event *event;
|
||||
|
||||
//
|
||||
// This one is openmohaa-specific
|
||||
// Custom killed event will do the job
|
||||
//
|
||||
if (m_pKilledEvent) {
|
||||
event = new Event(*m_pKilledEvent);
|
||||
if (m_killedLabel.IsSet()) {
|
||||
event = new Event(0, ev->NumArgs());
|
||||
for (int i = 1; i <= ev->NumArgs(); i++) {
|
||||
event->AddValue(ev->GetValue(i));
|
||||
}
|
||||
ProcessEvent(event);
|
||||
m_killedLabel.Execute(this, event);
|
||||
delete event;
|
||||
|
||||
Unregister(STRING_DEATH);
|
||||
return;
|
||||
@@ -3077,7 +3087,7 @@ void Player::Killed(Event *ev)
|
||||
deadflag = DEAD_DYING;
|
||||
health = 0;
|
||||
|
||||
event = new Event(EV_Pain);
|
||||
event = new Event(EV_Pain, 10);
|
||||
|
||||
event->AddEntity(attacker);
|
||||
event->AddFloat(ev->GetFloat(2));
|
||||
@@ -3145,7 +3155,7 @@ void Player::Killed(Event *ev)
|
||||
//
|
||||
// Openmohaa scripted events
|
||||
//
|
||||
event = new Event;
|
||||
event = new Event(0, 11);
|
||||
|
||||
event->AddEntity(ev->GetEntity(1));
|
||||
event->AddFloat(ev->GetFloat(2));
|
||||
@@ -11742,8 +11752,8 @@ void Player::GetDeaths(Event *ev)
|
||||
|
||||
void Player::GetKillHandler(Event *ev)
|
||||
{
|
||||
if (m_pKilledEvent) {
|
||||
ev->AddValue(m_pKilledEvent->GetValue(1));
|
||||
if (m_killedLabel.IsSet()) {
|
||||
m_killedLabel.GetScriptValue(&ev->GetValue());
|
||||
} else {
|
||||
ev->AddNil();
|
||||
}
|
||||
@@ -12029,13 +12039,9 @@ void Player::SetEntityShader(Event *ev)
|
||||
void Player::SetKillHandler(Event *ev)
|
||||
{
|
||||
if (ev->IsNilAt(1) || (ev->IsStringAt(1) && !ev->GetString(1).icmp("none"))) {
|
||||
if (m_pKilledEvent != NULL) {
|
||||
delete m_pKilledEvent;
|
||||
m_pKilledEvent = NULL;
|
||||
}
|
||||
m_killedLabel.Clear();
|
||||
} else {
|
||||
m_pKilledEvent = new Event(EV_Listener_ExecuteScript);
|
||||
m_pKilledEvent->AddValue(ev->GetValue(1));
|
||||
m_killedLabel.SetScript(ev->GetValue(1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+17
-4
@@ -350,7 +350,7 @@ public:
|
||||
bool m_bFrozen; // if player is frozen
|
||||
bool animDoneVM;
|
||||
float speed_multiplier[MAX_SPEED_MULTIPLIERS];
|
||||
Event *m_pKilledEvent;
|
||||
ScriptThreadLabel m_killedLabel;
|
||||
con_map<str, vma_t> vmalist;
|
||||
str m_sVMAcurrent;
|
||||
str m_sVMcurrent;
|
||||
@@ -514,6 +514,7 @@ public:
|
||||
void InitWeapons(void);
|
||||
void InitView(void);
|
||||
void InitModel(void);
|
||||
void InitModelFps(void); // Added in openmohaa
|
||||
void InitState(void);
|
||||
void InitHealth(void);
|
||||
void InitInventory(void);
|
||||
@@ -1014,6 +1015,7 @@ inline void Player::Archive(Archiver& arc)
|
||||
|
||||
arc.ArchiveInteger(&buttons);
|
||||
arc.ArchiveInteger(&new_buttons);
|
||||
arc.ArchiveInteger(&server_new_buttons);
|
||||
arc.ArchiveFloat(&respawn_time);
|
||||
|
||||
arc.ArchiveInteger(&last_attack_button);
|
||||
@@ -1053,6 +1055,8 @@ inline void Player::Archive(Archiver& arc)
|
||||
arc.ArchiveBool(&take_pain);
|
||||
arc.ArchiveInteger(&nextpaintime);
|
||||
|
||||
arc.ArchiveFloat(&m_fHealRate);
|
||||
|
||||
arc.ArchiveBool(&knockdown);
|
||||
arc.ArchiveBool(&canfall);
|
||||
arc.ArchiveBool(&falling);
|
||||
@@ -1157,17 +1161,27 @@ inline void Player::Archive(Archiver& arc)
|
||||
|
||||
if (arc.Loading()) {
|
||||
UpdateWeapons();
|
||||
InitModelFps();
|
||||
}
|
||||
|
||||
//
|
||||
// Openmohaa additions
|
||||
//
|
||||
arc.ArchiveBool(&m_bFrozen);
|
||||
arc.ArchiveBool(&animDoneVM);
|
||||
arc.ArchiveFloat(&m_fVMAtime);
|
||||
|
||||
for (int i = 0; i < MAX_SPEED_MULTIPLIERS; i++) {
|
||||
arc.ArchiveFloat(&speed_multiplier[i]);
|
||||
}
|
||||
}
|
||||
|
||||
inline Camera *Player::CurrentCamera(void)
|
||||
|
||||
{
|
||||
return camera;
|
||||
}
|
||||
|
||||
inline void Player::CameraCut(void)
|
||||
|
||||
{
|
||||
//
|
||||
// toggle the camera cut bit
|
||||
@@ -1177,7 +1191,6 @@ inline void Player::CameraCut(void)
|
||||
}
|
||||
|
||||
inline void Player::CameraCut(Camera *ent)
|
||||
|
||||
{
|
||||
if (ent == camera) {
|
||||
// if the camera we are currently looking through cut, than toggle the cut bits
|
||||
|
||||
+216
-39
@@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "player.h"
|
||||
#include "g_phys.h"
|
||||
#include "portableturret.h"
|
||||
|
||||
extern Event EV_Player_AnimLoop_Torso;
|
||||
extern Event EV_Player_AnimLoop_Legs;
|
||||
@@ -32,7 +33,7 @@ extern Event EV_Player_AnimLoop_Legs;
|
||||
void Player::EndAnim_Legs(Event *ev)
|
||||
{
|
||||
animdone_Legs = true;
|
||||
|
||||
|
||||
if (IsRepeatType(m_iPartSlot[legs])) {
|
||||
SetAnimDoneEvent(EV_Player_AnimLoop_Legs, m_iPartSlot[legs]);
|
||||
}
|
||||
@@ -51,7 +52,7 @@ void Player::EndAnim_Torso(Event *ev)
|
||||
EvaluateState();
|
||||
}
|
||||
|
||||
void Player::EndAnim_Pain(Event* ev)
|
||||
void Player::EndAnim_Pain(Event *ev)
|
||||
{
|
||||
animdone_Pain = true;
|
||||
}
|
||||
@@ -166,15 +167,173 @@ int Player::CurrentPartAnim(bodypart_t part) const
|
||||
|
||||
void Player::AdjustAnimBlends(void)
|
||||
{
|
||||
int iPartSlot;
|
||||
int iOldPartSlot;
|
||||
float fWeightTotal;
|
||||
int iPartSlot;
|
||||
int iOldPartSlot;
|
||||
float fWeightTotal;
|
||||
qboolean playTurretAnim = false;
|
||||
|
||||
if (movetype == MOVETYPE_PORTABLE_TURRET) {
|
||||
PortableTurret *turret = static_cast<PortableTurret *>(m_pTurret.Pointer());
|
||||
|
||||
if (turret->IsReloading()) {
|
||||
if (partAnim[legs] != "mg42tripod_reload") {
|
||||
SetPartAnim("mg42tripod_reload", legs);
|
||||
StopAnimating(m_iPartSlot[torso]);
|
||||
StopAnimating(m_iPartSlot[torso] ^ 1);
|
||||
partAnim[torso] = "";
|
||||
}
|
||||
} else if (turret->IsSettingUp()) {
|
||||
if (partAnim[legs] != "mg42tripod_setup") {
|
||||
SetPartAnim("mg42tripod_setup", legs);
|
||||
StopAnimating(m_iPartSlot[torso]);
|
||||
StopAnimating(m_iPartSlot[torso] ^ 1);
|
||||
partAnim[torso] = "";
|
||||
}
|
||||
} else if (turret->IsPackingUp()) {
|
||||
if (partAnim[legs] != "mg42tripod_packup") {
|
||||
SetPartAnim("mg42tripod_packup", legs);
|
||||
StopAnimating(m_iPartSlot[torso]);
|
||||
StopAnimating(m_iPartSlot[torso] ^ 1);
|
||||
partAnim[torso] = "";
|
||||
}
|
||||
} else {
|
||||
playTurretAnim = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (playTurretAnim) {
|
||||
PortableTurret *turret = static_cast<PortableTurret *>(m_pTurret.Pointer());
|
||||
|
||||
if (partAnim[legs] != "mg42tripod_aim") {
|
||||
StopPartAnimating(legs);
|
||||
}
|
||||
|
||||
if (partAnim[torso] != "mg42tripod_aim") {
|
||||
StopPartAnimating(torso);
|
||||
}
|
||||
|
||||
partAnim[legs] = "mg42tripod_aim";
|
||||
partAnim[torso] = "mg42tripod_aim";
|
||||
|
||||
float pitch, yaw;
|
||||
float legsPitchAngle, torsoPitchAngle;
|
||||
float pitchAlpha, yawAlpha;
|
||||
float legsYawAngle, torsoYawAngle;
|
||||
float weight;
|
||||
int animNum;
|
||||
str vertLegsStr, vertTorsoStr;
|
||||
str horzLegsStr, horzTorsoStr;
|
||||
str anim;
|
||||
|
||||
pitch = AngleSubtract(turret->GetGroundPitch(), turret->angles[0]);
|
||||
yaw = AngleSubtract(turret->GetStartYaw(), turret->angles[1]);
|
||||
|
||||
if (pitch >= 0) {
|
||||
legsPitchAngle = 0.0;
|
||||
torsoPitchAngle = 15.0;
|
||||
vertLegsStr = "_straight";
|
||||
vertTorsoStr = "_up15";
|
||||
} else {
|
||||
legsPitchAngle = -15.0;
|
||||
torsoPitchAngle = 0.0;
|
||||
vertLegsStr = "_down15";
|
||||
vertTorsoStr = "_straight";
|
||||
}
|
||||
|
||||
pitchAlpha = (pitch - legsPitchAngle) / (torsoPitchAngle - legsPitchAngle);
|
||||
pitchAlpha = Q_clamp_float(pitchAlpha, 0, 1);
|
||||
|
||||
if (yaw < -20) {
|
||||
legsYawAngle = -40.0;
|
||||
torsoYawAngle = -20.0;
|
||||
horzLegsStr = "_left40";
|
||||
horzTorsoStr = "_left20";
|
||||
} else if (yaw < 0) {
|
||||
legsYawAngle = -20.0;
|
||||
torsoYawAngle = 0.0;
|
||||
horzLegsStr = "_left20";
|
||||
horzTorsoStr = "_straight";
|
||||
} else if (yaw <= 20) {
|
||||
legsYawAngle = 0.0;
|
||||
torsoYawAngle = 20.0;
|
||||
horzLegsStr = "_straight";
|
||||
horzTorsoStr = "_right20";
|
||||
} else {
|
||||
legsYawAngle = 20.0;
|
||||
torsoYawAngle = 40.0;
|
||||
horzLegsStr = "_right20";
|
||||
horzTorsoStr = "_right40";
|
||||
}
|
||||
|
||||
yawAlpha = (yaw - legsYawAngle) / (torsoYawAngle - legsYawAngle);
|
||||
yawAlpha = Q_clamp_float(yawAlpha, 0, 1);
|
||||
|
||||
anim = "mg42tripod_aim" + horzLegsStr + vertLegsStr;
|
||||
weight = (1 - pitchAlpha) * (1 - yawAlpha);
|
||||
animNum = gi.Anim_NumForName(edict->tiki, anim.c_str());
|
||||
if (animNum == -1) {
|
||||
gi.DPrintf("^~^~^ Warning: Can't find player animation '%s'.\n", anim.c_str());
|
||||
anim = "mg42tripod_aim_straight_straight";
|
||||
animNum = gi.Anim_NumForName(edict->tiki, anim.c_str());
|
||||
}
|
||||
|
||||
if (animNum == CurrentAnim(0)) {
|
||||
SetWeight(0, weight);
|
||||
} else {
|
||||
NewAnim(animNum, 0, weight);
|
||||
}
|
||||
|
||||
anim = "mg42tripod_aim" + horzLegsStr + vertTorsoStr;
|
||||
weight = (1.0 - yawAlpha) * pitchAlpha;
|
||||
animNum = gi.Anim_NumForName(edict->tiki, anim.c_str());
|
||||
if (animNum == -1) {
|
||||
gi.DPrintf("^~^~^ Warning: Can't find player animation '%s'.\n", anim.c_str());
|
||||
anim = "mg42tripod_aim_straight_straight";
|
||||
animNum = gi.Anim_NumForName(edict->tiki, anim.c_str());
|
||||
}
|
||||
|
||||
if (animNum == CurrentAnim(1)) {
|
||||
SetWeight(1, weight);
|
||||
} else {
|
||||
NewAnim(animNum, 1, weight);
|
||||
}
|
||||
|
||||
anim = "mg42tripod_aim" + horzTorsoStr + vertTorsoStr;
|
||||
weight = pitchAlpha * yawAlpha;
|
||||
animNum = gi.Anim_NumForName(edict->tiki, anim.c_str());
|
||||
if (animNum == -1) {
|
||||
gi.DPrintf("^~^~^ Warning: Can't find player animation '%s'.\n", anim.c_str());
|
||||
anim = "mg42tripod_aim_straight_straight";
|
||||
animNum = gi.Anim_NumForName(edict->tiki, anim.c_str());
|
||||
}
|
||||
|
||||
if (animNum == CurrentAnim(2)) {
|
||||
SetWeight(2, weight);
|
||||
} else {
|
||||
NewAnim(animNum, 2, weight);
|
||||
}
|
||||
|
||||
anim = "mg42tripod_aim" + horzTorsoStr + vertTorsoStr;
|
||||
weight = (1.0 - pitchAlpha) * yawAlpha;
|
||||
animNum = gi.Anim_NumForName(edict->tiki, anim.c_str());
|
||||
if (animNum == -1) {
|
||||
gi.DPrintf("^~^~^ Warning: Can't find player animation '%s'.\n", anim.c_str());
|
||||
anim = "mg42tripod_aim_straight_straight";
|
||||
animNum = gi.Anim_NumForName(edict->tiki, anim.c_str());
|
||||
}
|
||||
|
||||
if (animNum == CurrentAnim(3)) {
|
||||
SetWeight(3, weight);
|
||||
} else {
|
||||
NewAnim(animNum, 3, weight);
|
||||
}
|
||||
}
|
||||
|
||||
if (deadflag == DEAD_DEAD) {
|
||||
if (m_fPainBlend) {
|
||||
StopAnimating(ANIMSLOT_PAIN);
|
||||
edict->s.frameInfo[ANIMSLOT_PAIN].weight = 0;
|
||||
m_fPainBlend = 0;
|
||||
SetWeight(ANIMSLOT_PAIN, 0);
|
||||
m_fPainBlend = 0;
|
||||
animdone_Pain = false;
|
||||
}
|
||||
return;
|
||||
@@ -184,44 +343,56 @@ void Player::AdjustAnimBlends(void)
|
||||
iOldPartSlot = m_iPartSlot[legs] ^ 1;
|
||||
|
||||
if (m_fPartBlends[legs] <= 0.0f) {
|
||||
if (partOldAnim[legs] == "") {
|
||||
goto __blend_torso;
|
||||
}
|
||||
if (partOldAnim[legs] != "") {
|
||||
StopAnimating(iOldPartSlot);
|
||||
|
||||
StopAnimating(iOldPartSlot);
|
||||
if (partAnim[legs] == "") {
|
||||
SetWeight(iPartSlot, 0.0);
|
||||
} else {
|
||||
SetWeight(iPartSlot, 1.0);
|
||||
}
|
||||
} else {
|
||||
if (partAnim[legs] == "") {
|
||||
SetWeight(iPartSlot, 0.0);
|
||||
} else {
|
||||
SetWeight(iPartSlot, 1.0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
m_fPartBlends[legs] = m_fPartBlends[legs] - level.frametime * partBlendMult[legs];
|
||||
m_fPartBlends[legs] -= level.frametime * partBlendMult[legs];
|
||||
if (m_fPartBlends[legs] >= 0.01f) {
|
||||
if (partOldAnim[legs] != "") {
|
||||
edict->s.frameInfo[iOldPartSlot].weight = m_fPartBlends[legs];
|
||||
SetWeight(iOldPartSlot, m_fPartBlends[legs]);
|
||||
}
|
||||
if (partAnim[legs] != "") {
|
||||
edict->s.frameInfo[iPartSlot].weight = 1.0f - m_fPartBlends[legs];
|
||||
SetWeight(iPartSlot, 1.0f - m_fPartBlends[legs]);
|
||||
}
|
||||
} else {
|
||||
m_fPartBlends[legs] = 0.0f;
|
||||
StopAnimating(iOldPartSlot);
|
||||
partOldAnim[legs] = "";
|
||||
|
||||
goto __blend_torso;
|
||||
if (partAnim[legs] == "") {
|
||||
SetWeight(iPartSlot, 0.0);
|
||||
} else {
|
||||
SetWeight(iPartSlot, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
m_fPartBlends[legs] = 0.0f;
|
||||
StopAnimating(iOldPartSlot);
|
||||
partOldAnim[legs] = "";
|
||||
}
|
||||
|
||||
if (partAnim[legs] != "") {
|
||||
edict->s.frameInfo[iPartSlot].weight = 1.0f;
|
||||
} else {
|
||||
edict->s.frameInfo[iPartSlot].weight = 0.0f;
|
||||
}
|
||||
|
||||
__blend_torso:
|
||||
iPartSlot = m_iPartSlot[torso];
|
||||
iOldPartSlot = m_iPartSlot[torso] ^ 1;
|
||||
|
||||
|
||||
if (m_fPartBlends[torso] <= 0.0f) {
|
||||
if (partOldAnim[torso] != "") {
|
||||
StopAnimating(iOldPartSlot);
|
||||
partOldAnim[torso] = "";
|
||||
|
||||
if (partAnim[torso] == "") {
|
||||
SetWeight(iPartSlot, 0.0);
|
||||
} else {
|
||||
SetWeight(iPartSlot, 1.0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
m_fPartBlends[torso] = m_fPartBlends[torso] - level.frametime * partBlendMult[torso];
|
||||
@@ -229,11 +400,11 @@ __blend_torso:
|
||||
fWeightTotal = 0.0f;
|
||||
|
||||
if (partOldAnim[torso] != "") {
|
||||
edict->s.frameInfo[iOldPartSlot].weight = m_fPartBlends[torso];
|
||||
SetWeight(iOldPartSlot, m_fPartBlends[torso]);
|
||||
fWeightTotal += m_fPartBlends[torso];
|
||||
}
|
||||
if (partAnim[torso] != "") {
|
||||
edict->s.frameInfo[iPartSlot].weight = 1.0f - m_fPartBlends[torso];
|
||||
SetWeight(iPartSlot, m_fPartBlends[torso]);
|
||||
fWeightTotal += 1.0f - m_fPartBlends[torso];
|
||||
}
|
||||
|
||||
@@ -241,9 +412,15 @@ __blend_torso:
|
||||
} else {
|
||||
m_fPartBlends[torso] = 0.0f;
|
||||
StopAnimating(iOldPartSlot);
|
||||
partOldAnim[torso] = "";
|
||||
edict->s.frameInfo[iPartSlot].weight = partAnim[torso] != "" ? 1.0f : 0.0f;
|
||||
edict->s.actionWeight = partAnim[torso] != "" ? 1.0f : 0.0f;
|
||||
partOldAnim[torso] = "";
|
||||
|
||||
if (partAnim[torso] == "") {
|
||||
SetWeight(iPartSlot, 0.0);
|
||||
edict->s.actionWeight = 0.0;
|
||||
} else {
|
||||
SetWeight(iPartSlot, 1.0);
|
||||
edict->s.actionWeight = 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,24 +428,24 @@ __blend_torso:
|
||||
if (m_sPainAnim == "") {
|
||||
StopAnimating(ANIMSLOT_PAIN);
|
||||
edict->s.frameInfo[ANIMSLOT_PAIN].weight = 0;
|
||||
m_fPainBlend = 0;
|
||||
animdone_Pain = false;
|
||||
m_fPainBlend = 0;
|
||||
animdone_Pain = false;
|
||||
} else if (animdone_Pain) {
|
||||
m_fPainBlend -= level.frametime * (10.0 / 3.0);
|
||||
if (m_fPainBlend < 0.01f) {
|
||||
StopAnimating(ANIMSLOT_PAIN);
|
||||
edict->s.frameInfo[ANIMSLOT_PAIN].weight = 0;
|
||||
m_fPainBlend = 0;
|
||||
animdone_Pain = false;
|
||||
m_fPainBlend = 0;
|
||||
animdone_Pain = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_fPainBlend) {
|
||||
int i;
|
||||
int i;
|
||||
float w;
|
||||
|
||||
edict->s.frameInfo[ANIMSLOT_PAIN].weight = m_fPainBlend;
|
||||
w = 1.0 - m_fPainBlend * 0.5;
|
||||
w = 1.0 - m_fPainBlend * 0.5;
|
||||
|
||||
for (i = 0; i < ANIMSLOT_PAIN; i++) {
|
||||
if (edict->s.frameInfo[i].weight) {
|
||||
@@ -336,7 +513,7 @@ void Player::PlayerAnimDelta(float *vDelta)
|
||||
}
|
||||
}
|
||||
|
||||
void Player::EventTestAnim(Event* ev)
|
||||
void Player::EventTestAnim(Event *ev)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
@@ -44,7 +44,7 @@ PlayerBot::botfunc_t PlayerBot::botfuncs[MAX_BOT_FUNCTIONS];
|
||||
|
||||
PlayerBot::PlayerBot()
|
||||
{
|
||||
entflags |= EF_BOT;
|
||||
entflags |= ECF_BOT;
|
||||
|
||||
if (LoadingSavegame) {
|
||||
return;
|
||||
|
||||
+40
-25
@@ -925,44 +925,59 @@ void ScriptMaster::ArchiveString(Archiver& arc, const_str& s)
|
||||
|
||||
void ScriptMaster::Archive(Archiver& arc)
|
||||
{
|
||||
ScriptClass *scr;
|
||||
ScriptVM *m_current;
|
||||
ScriptThread *m_thread;
|
||||
int numClasses;
|
||||
int numThreads;
|
||||
int i, j;
|
||||
int count;
|
||||
int i, j;
|
||||
ScriptClass *c;
|
||||
int num;
|
||||
ScriptVM *scriptVM;
|
||||
ScriptVM *prevScriptVM;
|
||||
|
||||
if (arc.Saving()) {
|
||||
numClasses = (int)ScriptClass_allocator.Count();
|
||||
arc.ArchiveInteger(&numClasses);
|
||||
count = (int)ScriptClass_allocator.Count();
|
||||
arc.ArchiveInteger(&count);
|
||||
|
||||
MEM_BlockAlloc_enum<ScriptClass> en = ScriptClass_allocator;
|
||||
for (scr = en.NextElement(); scr != NULL; scr = en.NextElement()) {
|
||||
scr->ArchiveInternal(arc);
|
||||
for (c = en.NextElement(); c != NULL; c = en.NextElement()) {
|
||||
c->ArchiveInternal(arc);
|
||||
|
||||
numThreads = 0;
|
||||
for (m_current = scr->m_Threads; m_current != NULL; m_current = m_current->next) {
|
||||
numThreads++;
|
||||
num = 0;
|
||||
for (scriptVM = c->m_Threads; scriptVM != NULL; scriptVM = scriptVM->next) {
|
||||
num++;
|
||||
}
|
||||
|
||||
arc.ArchiveInteger(&numThreads);
|
||||
arc.ArchiveInteger(&num);
|
||||
|
||||
for (m_current = scr->m_Threads; m_current != NULL; m_current = m_current->next) {
|
||||
m_current->m_Thread->ArchiveInternal(arc);
|
||||
for (scriptVM = c->m_Threads; scriptVM != NULL; scriptVM = scriptVM->next) {
|
||||
scriptVM->m_Thread->ArchiveInternal(arc);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
arc.ArchiveInteger(&numClasses);
|
||||
arc.ArchiveInteger(&count);
|
||||
|
||||
for (i = 0; i < numClasses; i++) {
|
||||
scr = new ScriptClass();
|
||||
scr->ArchiveInternal(arc);
|
||||
for (i = 0; i < count; i++) {
|
||||
c = new ScriptClass();
|
||||
c->ArchiveInternal(arc);
|
||||
|
||||
arc.ArchiveInteger(&numThreads);
|
||||
arc.ArchiveInteger(&num);
|
||||
|
||||
for (j = 0; j < numThreads; j++) {
|
||||
m_thread = new ScriptThread(scr, NULL);
|
||||
m_thread->ArchiveInternal(arc);
|
||||
c->m_Threads = NULL;
|
||||
prevScriptVM = NULL;
|
||||
|
||||
for (j = 0; j < num; j++) {
|
||||
scriptVM = new ScriptVM;
|
||||
scriptVM->m_Thread = new ScriptThread;
|
||||
scriptVM->m_Thread->m_ScriptVM = scriptVM;
|
||||
scriptVM->m_ScriptClass = c;
|
||||
scriptVM->next = NULL;
|
||||
|
||||
if (prevScriptVM) {
|
||||
prevScriptVM->next = scriptVM;
|
||||
} else {
|
||||
c->m_Threads = scriptVM;
|
||||
}
|
||||
|
||||
prevScriptVM = scriptVM;
|
||||
scriptVM->m_Thread->ArchiveInternal(arc);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1184,7 +1199,7 @@ void ScriptMaster::PrintThread(int iThreadNum)
|
||||
int i = 0;
|
||||
|
||||
for (entry = en.NextElement(); entry != NULL; entry = en.NextElement()) {
|
||||
str& name = Director.GetString(entry->key);
|
||||
str& name = Director.GetString(entry->GetKey());
|
||||
|
||||
if (i > 0) {
|
||||
status += ", ";
|
||||
|
||||
+107
-75
@@ -465,6 +465,15 @@ Event EV_ScriptSlave_FollowPath
|
||||
"normalangles, loop, and a number specifying the start time.",
|
||||
EV_NORMAL
|
||||
);
|
||||
Event EV_ScriptSlave_FollowPath_RelativeYaw(
|
||||
"path_relativeyaw",
|
||||
EV_DEFAULT,
|
||||
"f"
|
||||
"f",
|
||||
"relativeYaw",
|
||||
"Makes the script slave follow the specified path with a yaw offset,",
|
||||
EV_NORMAL
|
||||
);
|
||||
Event EV_ScriptSlave_EndPath
|
||||
(
|
||||
"endpath",
|
||||
@@ -584,72 +593,83 @@ Event EV_ScriptSlave_ModifyFlyPath
|
||||
EV_NORMAL
|
||||
);
|
||||
|
||||
CLASS_DECLARATION(Mover, ScriptSlave, "script_object") {
|
||||
{&EV_Bind, &ScriptSlave::BindEvent },
|
||||
{&EV_Unbind, &ScriptSlave::EventUnbind },
|
||||
{&EV_ScriptSlave_DoMove, &ScriptSlave::DoMove },
|
||||
{&EV_ScriptSlave_WaitMove, &ScriptSlave::WaitMove },
|
||||
{&EV_ScriptSlave_Angles, &ScriptSlave::SetAnglesEvent },
|
||||
{&EV_SetAngle, &ScriptSlave::SetAngleEvent },
|
||||
{&EV_Model, &ScriptSlave::SetModelEvent },
|
||||
{&EV_ScriptSlave_Trigger, &ScriptSlave::TriggerEvent },
|
||||
{&EV_ScriptSlave_Next, &ScriptSlave::GotoNextWaypoint },
|
||||
{&EV_ScriptSlave_JumpTo, &ScriptSlave::JumpTo },
|
||||
{&EV_ScriptSlave_MoveTo, &ScriptSlave::MoveToEvent },
|
||||
{&EV_ScriptSlave_Speed, &ScriptSlave::SetSpeed },
|
||||
{&EV_ScriptSlave_Time, &ScriptSlave::SetTime },
|
||||
{&EV_ScriptSlave_MoveUp, &ScriptSlave::MoveUp },
|
||||
{&EV_ScriptSlave_MoveDown, &ScriptSlave::MoveDown },
|
||||
{&EV_ScriptSlave_MoveNorth, &ScriptSlave::MoveNorth },
|
||||
{&EV_ScriptSlave_MoveSouth, &ScriptSlave::MoveSouth },
|
||||
{&EV_ScriptSlave_MoveEast, &ScriptSlave::MoveEast },
|
||||
{&EV_ScriptSlave_MoveWest, &ScriptSlave::MoveWest },
|
||||
{&EV_ScriptSlave_MoveForward, &ScriptSlave::MoveForward },
|
||||
{&EV_ScriptSlave_MoveBackward, &ScriptSlave::MoveBackward },
|
||||
{&EV_ScriptSlave_MoveLeft, &ScriptSlave::MoveLeft },
|
||||
{&EV_ScriptSlave_MoveRight, &ScriptSlave::MoveRight },
|
||||
{&EV_ScriptSlave_RotateXDownTo, &ScriptSlave::RotateXdownto },
|
||||
{&EV_ScriptSlave_RotateYDownTo, &ScriptSlave::RotateYdownto },
|
||||
{&EV_ScriptSlave_RotateZDownTo, &ScriptSlave::RotateZdownto },
|
||||
{&EV_ScriptSlave_RotateXUpTo, &ScriptSlave::RotateXupto },
|
||||
{&EV_ScriptSlave_RotateYUpTo, &ScriptSlave::RotateYupto },
|
||||
{&EV_ScriptSlave_RotateZUpTo, &ScriptSlave::RotateZupto },
|
||||
{&EV_ScriptSlave_RotateXDown, &ScriptSlave::RotateXdown },
|
||||
{&EV_ScriptSlave_RotateYDown, &ScriptSlave::RotateYdown },
|
||||
{&EV_ScriptSlave_RotateZDown, &ScriptSlave::RotateZdown },
|
||||
{&EV_ScriptSlave_RotateXUp, &ScriptSlave::RotateXup },
|
||||
{&EV_ScriptSlave_RotateYUp, &ScriptSlave::RotateYup },
|
||||
{&EV_ScriptSlave_RotateZUp, &ScriptSlave::RotateZup },
|
||||
{&EV_ScriptSlave_RotateX, &ScriptSlave::RotateX },
|
||||
{&EV_ScriptSlave_RotateY, &ScriptSlave::RotateY },
|
||||
{&EV_ScriptSlave_RotateZ, &ScriptSlave::RotateZ },
|
||||
{&EV_ScriptSlave_RotateAxisDownTo, &ScriptSlave::RotateAxisdownto },
|
||||
{&EV_ScriptSlave_RotateAxisUpTo, &ScriptSlave::RotateAxisupto },
|
||||
{&EV_ScriptSlave_RotateAxisDown, &ScriptSlave::RotateAxisdown },
|
||||
{&EV_ScriptSlave_RotateAxisUp, &ScriptSlave::RotateAxisup },
|
||||
{&EV_ScriptSlave_RotateAxis, &ScriptSlave::RotateZ },
|
||||
{&EV_ScriptSlave_SetDamage, &ScriptSlave::SetDamage },
|
||||
{&EV_ScriptSlave_SetMeansOfDeath, &ScriptSlave::SetMeansOfDeath },
|
||||
{&EV_ScriptSlave_SetDamageSpawn, &ScriptSlave::SetDamage },
|
||||
{&EV_ScriptSlave_FollowPath, &ScriptSlave::FollowPath },
|
||||
{&EV_ScriptSlave_EndPath, &ScriptSlave::EndPath },
|
||||
{&EV_ScriptSlave_FollowingPath, &ScriptSlave::FollowingPath },
|
||||
{&EV_ScriptSlave_MoveDone, &ScriptSlave::MoveEnd },
|
||||
{&EV_Damage, &ScriptSlave::DamageFunc },
|
||||
{&EV_ScriptSlave_RotateDownTo, &ScriptSlave::Rotatedownto },
|
||||
{&EV_ScriptSlave_RotateUpTo, &ScriptSlave::Rotateupto },
|
||||
{&EV_ScriptSlave_RotateTo, &ScriptSlave::Rotateto },
|
||||
{&EV_ScriptSlave_Explode, &ScriptSlave::Explode },
|
||||
{&EV_ScriptSlave_NotShootable, &ScriptSlave::NotShootable },
|
||||
{&EV_ScriptSlave_OpenAreaPortal, &ScriptSlave::OpenPortal },
|
||||
{&EV_ScriptSlave_CloseAreaPortal, &ScriptSlave::ClosePortal },
|
||||
{&EV_ScriptSlave_PhysicsOn, &ScriptSlave::PhysicsOn },
|
||||
{&EV_ScriptSlave_PhysicsOff, &ScriptSlave::PhysicsOff },
|
||||
{&EV_ScriptSlave_PhysicsVelocity, &ScriptSlave::PhysicsVelocity },
|
||||
{&EV_ScriptSlave_FlyPath, &ScriptSlave::EventFlyPath },
|
||||
{&EV_ScriptSlave_ModifyFlyPath, &ScriptSlave::EventModifyFlyPath},
|
||||
Event EV_ScriptSlave_NormalAngles
|
||||
(
|
||||
"normalangles",
|
||||
EV_DEFAULT,
|
||||
"b",
|
||||
"bUseNormalAngles",
|
||||
"Sets the object to use normal angles when travelling on a spline path",
|
||||
EV_NORMAL
|
||||
);
|
||||
|
||||
{NULL, NULL }
|
||||
CLASS_DECLARATION(Mover, ScriptSlave, "script_object") {
|
||||
{&EV_Bind, &ScriptSlave::BindEvent },
|
||||
{&EV_Unbind, &ScriptSlave::EventUnbind },
|
||||
{&EV_ScriptSlave_DoMove, &ScriptSlave::DoMove },
|
||||
{&EV_ScriptSlave_WaitMove, &ScriptSlave::WaitMove },
|
||||
{&EV_ScriptSlave_Angles, &ScriptSlave::SetAnglesEvent },
|
||||
{&EV_SetAngle, &ScriptSlave::SetAngleEvent },
|
||||
{&EV_Model, &ScriptSlave::SetModelEvent },
|
||||
{&EV_ScriptSlave_Trigger, &ScriptSlave::TriggerEvent },
|
||||
{&EV_ScriptSlave_Next, &ScriptSlave::GotoNextWaypoint },
|
||||
{&EV_ScriptSlave_JumpTo, &ScriptSlave::JumpTo },
|
||||
{&EV_ScriptSlave_MoveTo, &ScriptSlave::MoveToEvent },
|
||||
{&EV_ScriptSlave_Speed, &ScriptSlave::SetSpeed },
|
||||
{&EV_ScriptSlave_Time, &ScriptSlave::SetTime },
|
||||
{&EV_ScriptSlave_MoveUp, &ScriptSlave::MoveUp },
|
||||
{&EV_ScriptSlave_MoveDown, &ScriptSlave::MoveDown },
|
||||
{&EV_ScriptSlave_MoveNorth, &ScriptSlave::MoveNorth },
|
||||
{&EV_ScriptSlave_MoveSouth, &ScriptSlave::MoveSouth },
|
||||
{&EV_ScriptSlave_MoveEast, &ScriptSlave::MoveEast },
|
||||
{&EV_ScriptSlave_MoveWest, &ScriptSlave::MoveWest },
|
||||
{&EV_ScriptSlave_MoveForward, &ScriptSlave::MoveForward },
|
||||
{&EV_ScriptSlave_MoveBackward, &ScriptSlave::MoveBackward },
|
||||
{&EV_ScriptSlave_MoveLeft, &ScriptSlave::MoveLeft },
|
||||
{&EV_ScriptSlave_MoveRight, &ScriptSlave::MoveRight },
|
||||
{&EV_ScriptSlave_RotateXDownTo, &ScriptSlave::RotateXdownto },
|
||||
{&EV_ScriptSlave_RotateYDownTo, &ScriptSlave::RotateYdownto },
|
||||
{&EV_ScriptSlave_RotateZDownTo, &ScriptSlave::RotateZdownto },
|
||||
{&EV_ScriptSlave_RotateXUpTo, &ScriptSlave::RotateXupto },
|
||||
{&EV_ScriptSlave_RotateYUpTo, &ScriptSlave::RotateYupto },
|
||||
{&EV_ScriptSlave_RotateZUpTo, &ScriptSlave::RotateZupto },
|
||||
{&EV_ScriptSlave_RotateXDown, &ScriptSlave::RotateXdown },
|
||||
{&EV_ScriptSlave_RotateYDown, &ScriptSlave::RotateYdown },
|
||||
{&EV_ScriptSlave_RotateZDown, &ScriptSlave::RotateZdown },
|
||||
{&EV_ScriptSlave_RotateXUp, &ScriptSlave::RotateXup },
|
||||
{&EV_ScriptSlave_RotateYUp, &ScriptSlave::RotateYup },
|
||||
{&EV_ScriptSlave_RotateZUp, &ScriptSlave::RotateZup },
|
||||
{&EV_ScriptSlave_RotateX, &ScriptSlave::RotateX },
|
||||
{&EV_ScriptSlave_RotateY, &ScriptSlave::RotateY },
|
||||
{&EV_ScriptSlave_RotateZ, &ScriptSlave::RotateZ },
|
||||
{&EV_ScriptSlave_RotateAxisDownTo, &ScriptSlave::RotateAxisdownto },
|
||||
{&EV_ScriptSlave_RotateAxisUpTo, &ScriptSlave::RotateAxisupto },
|
||||
{&EV_ScriptSlave_RotateAxisDown, &ScriptSlave::RotateAxisdown },
|
||||
{&EV_ScriptSlave_RotateAxisUp, &ScriptSlave::RotateAxisup },
|
||||
{&EV_ScriptSlave_RotateAxis, &ScriptSlave::RotateZ },
|
||||
{&EV_ScriptSlave_SetDamage, &ScriptSlave::SetDamage },
|
||||
{&EV_ScriptSlave_SetMeansOfDeath, &ScriptSlave::SetMeansOfDeath },
|
||||
{&EV_ScriptSlave_SetDamageSpawn, &ScriptSlave::SetDamage },
|
||||
{&EV_ScriptSlave_FollowPath, &ScriptSlave::FollowPath },
|
||||
{&EV_ScriptSlave_FollowPath_RelativeYaw, &ScriptSlave::FollowPathRelativeYaw},
|
||||
{&EV_ScriptSlave_EndPath, &ScriptSlave::EndPath },
|
||||
{&EV_ScriptSlave_FollowingPath, &ScriptSlave::FollowingPath },
|
||||
{&EV_ScriptSlave_MoveDone, &ScriptSlave::MoveEnd },
|
||||
{&EV_Damage, &ScriptSlave::DamageFunc },
|
||||
{&EV_ScriptSlave_RotateDownTo, &ScriptSlave::Rotatedownto },
|
||||
{&EV_ScriptSlave_RotateUpTo, &ScriptSlave::Rotateupto },
|
||||
{&EV_ScriptSlave_RotateTo, &ScriptSlave::Rotateto },
|
||||
{&EV_ScriptSlave_Explode, &ScriptSlave::Explode },
|
||||
{&EV_ScriptSlave_NotShootable, &ScriptSlave::NotShootable },
|
||||
{&EV_ScriptSlave_OpenAreaPortal, &ScriptSlave::OpenPortal },
|
||||
{&EV_ScriptSlave_CloseAreaPortal, &ScriptSlave::ClosePortal },
|
||||
{&EV_ScriptSlave_PhysicsOn, &ScriptSlave::PhysicsOn },
|
||||
{&EV_ScriptSlave_PhysicsOff, &ScriptSlave::PhysicsOff },
|
||||
{&EV_ScriptSlave_PhysicsVelocity, &ScriptSlave::PhysicsVelocity },
|
||||
{&EV_ScriptSlave_FlyPath, &ScriptSlave::EventFlyPath },
|
||||
{&EV_ScriptSlave_ModifyFlyPath, &ScriptSlave::EventModifyFlyPath },
|
||||
{&EV_ScriptSlave_NormalAngles, &ScriptSlave::EventNormalAngles },
|
||||
{NULL, NULL }
|
||||
};
|
||||
|
||||
cvar_t *g_showflypath;
|
||||
@@ -689,16 +709,17 @@ ScriptSlave::ScriptSlave()
|
||||
edict->s.renderfx = RF_ALWAYSDRAW;
|
||||
}
|
||||
|
||||
splinePath = NULL;
|
||||
m_pCurPath = NULL;
|
||||
m_iCurNode = 0;
|
||||
m_fLookAhead = 0;
|
||||
m_fCurSpeed = 0;
|
||||
m_fIdealSpeed = 0;
|
||||
m_fIdealAccel = 0;
|
||||
m_fIdealDistance = 100;
|
||||
splineangles = false;
|
||||
attack_finished = 0;
|
||||
splinePath = NULL;
|
||||
m_pCurPath = NULL;
|
||||
m_iCurNode = 0;
|
||||
m_fLookAhead = 0;
|
||||
m_fCurSpeed = 0;
|
||||
m_fIdealSpeed = 0;
|
||||
m_fIdealAccel = 0;
|
||||
m_fIdealDistance = 100;
|
||||
splineangles = false;
|
||||
m_fFollowRelativeYaw = 0;
|
||||
attack_finished = 0;
|
||||
|
||||
setSolidType(SOLID_NOT);
|
||||
|
||||
@@ -1367,6 +1388,11 @@ void ScriptSlave::FollowPath(Event *ev)
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptSlave::FollowPathRelativeYaw(Event *ev)
|
||||
{
|
||||
m_fFollowRelativeYaw = ev->GetFloat(1);
|
||||
}
|
||||
|
||||
void ScriptSlave::EndPath(Event *ev)
|
||||
{
|
||||
if (!splinePath) {
|
||||
@@ -1723,6 +1749,12 @@ void ScriptSlave::EventModifyFlyPath(Event *ev)
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptSlave::EventNormalAngles(Event *ev)
|
||||
{
|
||||
splineangles = !ev->GetBoolean(1);
|
||||
ignoreangles = false;
|
||||
}
|
||||
|
||||
void ScriptSlave::SetupPath(cSpline<4, 512> *pPath, SimpleEntity *se)
|
||||
{
|
||||
str name;
|
||||
|
||||
@@ -77,6 +77,7 @@ public:
|
||||
qboolean splineangles;
|
||||
qboolean ignoreangles;
|
||||
qboolean ignorevelocity;
|
||||
float m_fFollowRelativeYaw;
|
||||
qboolean moving; // is the script object currently moving?
|
||||
|
||||
protected:
|
||||
@@ -138,6 +139,7 @@ protected:
|
||||
void SetDamage(Event *ev);
|
||||
void SetMeansOfDeath(Event *ev);
|
||||
void FollowPath(Event *ev);
|
||||
void FollowPathRelativeYaw(Event *ev); // Added in 2.0
|
||||
void EndPath(Event *ev);
|
||||
void FollowingPath(Event *ev);
|
||||
void CreatePath(SplinePath *path, splinetype_t type);
|
||||
@@ -151,6 +153,7 @@ protected:
|
||||
void DamageFunc(Event *ev);
|
||||
void EventFlyPath(Event *ev);
|
||||
void EventModifyFlyPath(Event *ev);
|
||||
void EventNormalAngles(Event *ev); // Added in 2.0
|
||||
void SetupPath(cSpline<4, 512> *pPath, SimpleEntity *se);
|
||||
|
||||
void Archive(Archiver& arc) override;
|
||||
@@ -220,6 +223,16 @@ inline void ScriptSlave::Archive(Archiver& arc)
|
||||
m_pCurPath = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
arc.ArchiveInteger(&m_iCurNode);
|
||||
arc.ArchiveFloat(&m_fCurSpeed);
|
||||
arc.ArchiveFloat(&m_fIdealSpeed);
|
||||
arc.ArchiveVector(&m_vIdealPosition);
|
||||
arc.ArchiveVector(&m_vIdealDir);
|
||||
arc.ArchiveFloat(&m_fIdealAccel);
|
||||
arc.ArchiveFloat(&m_fIdealDistance);
|
||||
arc.ArchiveFloat(&m_fLookAhead);
|
||||
arc.ArchiveFloat(&m_fFollowRelativeYaw);
|
||||
}
|
||||
|
||||
class ScriptModel : public ScriptSlave
|
||||
|
||||
@@ -3576,13 +3576,20 @@ void ScriptThread::Angles_PointAt(Event *ev)
|
||||
|
||||
void ScriptThread::EventIsAlive(Event *ev)
|
||||
{
|
||||
Entity *ent = ev->GetEntity(1);
|
||||
Entity* ent;
|
||||
|
||||
if (ent) {
|
||||
ev->AddInteger(!ent->IsDead());
|
||||
} else {
|
||||
ev->AddInteger(0);
|
||||
if (!ev->IsEntityAt(1)) {
|
||||
ev->AddInteger(false);
|
||||
return;
|
||||
}
|
||||
|
||||
ent = ev->GetEntity(1);
|
||||
if (!ent) {
|
||||
ev->AddInteger(false);
|
||||
return;
|
||||
}
|
||||
|
||||
ev->AddInteger(ent->health > 0);
|
||||
}
|
||||
|
||||
void ScriptThread::EventPopmenu(Event *ev)
|
||||
|
||||
@@ -693,7 +693,7 @@ Sentient::Sentient()
|
||||
: m_bIsAnimal(false)
|
||||
{
|
||||
SentientList.AddObject((Sentient *)this);
|
||||
entflags |= EF_SENTIENT;
|
||||
entflags |= ECF_SENTIENT;
|
||||
|
||||
m_bOvercookDied = false;
|
||||
|
||||
@@ -824,7 +824,7 @@ Sentient::~Sentient()
|
||||
SentientList.RemoveObject((Sentient *)this);
|
||||
FreeInventory();
|
||||
|
||||
entflags &= ~EF_SENTIENT;
|
||||
entflags &= ~ECF_SENTIENT;
|
||||
}
|
||||
|
||||
void Sentient::Link()
|
||||
@@ -2128,6 +2128,11 @@ void Sentient::Archive(Archiver& arc)
|
||||
Holster(true);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Openmohaa additions
|
||||
//
|
||||
arc.ArchiveInteger(&iNextLandTime);
|
||||
}
|
||||
|
||||
static bool IsItemName(const char *name)
|
||||
|
||||
@@ -219,6 +219,9 @@ public:
|
||||
|
||||
bool m_bFootOnGround_Right;
|
||||
bool m_bFootOnGround_Left;
|
||||
//
|
||||
// Openmohaa additions
|
||||
//
|
||||
int iNextLandTime;
|
||||
|
||||
CLASS_PROTOTYPE(Sentient);
|
||||
|
||||
+22
-22
@@ -253,112 +253,112 @@ SimpleEntity::~SimpleEntity()
|
||||
|
||||
int SimpleEntity::IsSubclassOfEntity(void) const
|
||||
{
|
||||
return (entflags & EF_ENTITY);
|
||||
return (entflags & ECF_ENTITY);
|
||||
}
|
||||
|
||||
int SimpleEntity::IsSubclassOfAnimate(void) const
|
||||
{
|
||||
return (entflags & EF_ANIMATE);
|
||||
return (entflags & ECF_ANIMATE);
|
||||
}
|
||||
|
||||
int SimpleEntity::IsSubclassOfSentient(void) const
|
||||
{
|
||||
return (entflags & EF_SENTIENT);
|
||||
return (entflags & ECF_SENTIENT);
|
||||
}
|
||||
|
||||
int SimpleEntity::IsSubclassOfPlayer(void) const
|
||||
{
|
||||
return (entflags & EF_PLAYER);
|
||||
return (entflags & ECF_PLAYER);
|
||||
}
|
||||
|
||||
int SimpleEntity::IsSubclassOfActor(void) const
|
||||
{
|
||||
return (entflags & EF_ACTOR);
|
||||
return (entflags & ECF_ACTOR);
|
||||
}
|
||||
|
||||
int SimpleEntity::IsSubclassOfItem(void) const
|
||||
{
|
||||
return (entflags & EF_ITEM);
|
||||
return (entflags & ECF_ITEM);
|
||||
}
|
||||
|
||||
int SimpleEntity::IsSubclassOfInventoryItem(void) const
|
||||
{
|
||||
return (entflags & EF_INVENTORYITEM);
|
||||
return (entflags & ECF_INVENTORYITEM);
|
||||
}
|
||||
|
||||
int SimpleEntity::IsSubclassOfWeapon(void) const
|
||||
{
|
||||
return (entflags & EF_WEAPON);
|
||||
return (entflags & ECF_WEAPON);
|
||||
}
|
||||
|
||||
int SimpleEntity::IsSubclassOfProjectile(void) const
|
||||
{
|
||||
return (entflags & EF_PROJECTILE);
|
||||
return (entflags & ECF_PROJECTILE);
|
||||
}
|
||||
|
||||
int SimpleEntity::IsSubclassOfDoor(void) const
|
||||
{
|
||||
return (entflags & EF_DOOR);
|
||||
return (entflags & ECF_DOOR);
|
||||
}
|
||||
|
||||
int SimpleEntity::IsSubclassOfCamera(void) const
|
||||
{
|
||||
return (entflags & EF_CAMERA);
|
||||
return (entflags & ECF_CAMERA);
|
||||
}
|
||||
|
||||
int SimpleEntity::IsSubclassOfVehicle(void) const
|
||||
{
|
||||
return (entflags & EF_VEHICLE);
|
||||
return (entflags & ECF_VEHICLE);
|
||||
}
|
||||
|
||||
int SimpleEntity::IsSubclassOfVehicleTank(void) const
|
||||
{
|
||||
return (entflags & EF_VEHICLETANK);
|
||||
return (entflags & ECF_VEHICLETANK);
|
||||
}
|
||||
|
||||
int SimpleEntity::IsSubclassOfVehicleTurretGun(void) const
|
||||
{
|
||||
return (entflags & EF_VEHICLETURRET);
|
||||
return (entflags & ECF_VEHICLETURRET);
|
||||
}
|
||||
|
||||
int SimpleEntity::IsSubclassOfTurretGun(void) const
|
||||
{
|
||||
return (entflags & EF_TURRET);
|
||||
return (entflags & ECF_TURRET);
|
||||
}
|
||||
|
||||
int SimpleEntity::IsSubclassOfPathNode(void) const
|
||||
{
|
||||
return (entflags & EF_PATHNODE);
|
||||
return (entflags & ECF_PATHNODE);
|
||||
}
|
||||
|
||||
int SimpleEntity::IsSubclassOfWaypoint(void) const
|
||||
{
|
||||
return (entflags & EF_WAYPOINT);
|
||||
return (entflags & ECF_WAYPOINT);
|
||||
}
|
||||
|
||||
int SimpleEntity::IsSubclassOfTempWaypoint(void) const
|
||||
{
|
||||
return (entflags & EF_TEMPWAYPOINT);
|
||||
return (entflags & ECF_TEMPWAYPOINT);
|
||||
}
|
||||
|
||||
int SimpleEntity::IsSubclassOfVehiclePoint(void) const
|
||||
{
|
||||
return (entflags & EF_VEHICLEPOINT);
|
||||
return (entflags & ECF_VEHICLEPOINT);
|
||||
}
|
||||
|
||||
int SimpleEntity::IsSubclassOfSplinePath(void) const
|
||||
{
|
||||
return (entflags & EF_SPLINEPATH);
|
||||
return (entflags & ECF_SPLINEPATH);
|
||||
}
|
||||
|
||||
int SimpleEntity::IsSubclassOfCrateObject(void) const
|
||||
{
|
||||
return (entflags & EF_CRATEOBJECT);
|
||||
return (entflags & ECF_CRATEOBJECT);
|
||||
}
|
||||
|
||||
int SimpleEntity::IsSubclassOfBot(void) const
|
||||
{
|
||||
return (entflags & EF_BOT);
|
||||
return (entflags & ECF_BOT);
|
||||
}
|
||||
|
||||
void SimpleEntity::SetTargetName(str targetname)
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ void cSpline<cGrids, cPoints>::Archive(Archiver& arc)
|
||||
arc.ArchiveInteger(&m_iPoints);
|
||||
|
||||
for (int i = 0; i < cPoints; i++) {
|
||||
for (int j = 0; i < cGrids; i++) {
|
||||
for (int j = 0; j < cGrids; j++) {
|
||||
arc.ArchiveFloat(&m_vPoints[i][j]);
|
||||
}
|
||||
|
||||
|
||||
@@ -810,6 +810,7 @@ void Trigger::Archive(Archiver& arc)
|
||||
SetNoise(Director.GetString(noise).c_str());
|
||||
}
|
||||
Director.ArchiveString(arc, message);
|
||||
m_Thread.Archive(arc);
|
||||
arc.ArchiveSafePointer(&activator);
|
||||
arc.ArchiveInteger(&respondto);
|
||||
arc.ArchiveBoolean(&useTriggerDir);
|
||||
|
||||
@@ -960,7 +960,7 @@ Vehicle::Vehicle()
|
||||
{
|
||||
int i;
|
||||
|
||||
entflags |= EF_VEHICLE;
|
||||
entflags |= ECF_VEHICLE;
|
||||
|
||||
AddWaitTill(STRING_DRIVE);
|
||||
AddWaitTill(STRING_VEHICLEANIMDONE);
|
||||
@@ -1204,7 +1204,7 @@ Vehicle::~Vehicle()
|
||||
m_pCollisionEntity->ProcessEvent(EV_Remove);
|
||||
}
|
||||
|
||||
entflags &= ~EF_VEHICLE;
|
||||
entflags &= ~ECF_VEHICLE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -210,7 +210,7 @@ CLASS_DECLARATION(TurretGun, VehicleTurretGun, NULL) {
|
||||
|
||||
VehicleTurretGun::VehicleTurretGun()
|
||||
{
|
||||
entflags |= EF_VEHICLETURRET;
|
||||
entflags |= ECF_VEHICLETURRET;
|
||||
|
||||
AddWaitTill(STRING_DEATH);
|
||||
|
||||
@@ -300,7 +300,7 @@ VehicleTurretGun::~VehicleTurretGun()
|
||||
m_pCollisionEntity->PostEvent(EV_Remove, 0);
|
||||
}
|
||||
|
||||
entflags &= ~EF_VEHICLETURRET;
|
||||
entflags &= ~ECF_VEHICLETURRET;
|
||||
}
|
||||
|
||||
void VehicleTurretGun::Think(void)
|
||||
|
||||
@@ -974,7 +974,7 @@ CLASS_DECLARATION(Item, Weapon, NULL) {
|
||||
//======================
|
||||
Weapon::Weapon()
|
||||
{
|
||||
entflags |= EF_WEAPON;
|
||||
entflags |= ECF_WEAPON;
|
||||
|
||||
mAIRange = RANGE_SHORT;
|
||||
|
||||
@@ -1192,7 +1192,7 @@ Weapon::~Weapon()
|
||||
RemoveFromOwner();
|
||||
}
|
||||
|
||||
entflags &= ~EF_WEAPON;
|
||||
entflags &= ~ECF_WEAPON;
|
||||
}
|
||||
|
||||
//======================
|
||||
|
||||
@@ -590,6 +590,7 @@ inline void Weapon::Archive(Archiver& arc)
|
||||
|
||||
ArchiveEnum(firemodeindex, firemode_t);
|
||||
|
||||
arc.ArchiveInteger(&weapon_class);
|
||||
Director.ArchiveString(arc, m_csWeaponGroup);
|
||||
arc.ArchiveFloat(&m_fMovementSpeed);
|
||||
arc.ArchiveFloat(&m_fMaxFireMovement);
|
||||
|
||||
@@ -394,7 +394,7 @@ CLASS_DECLARATION(Weapon, TurretGun, NULL) {
|
||||
|
||||
TurretGun::TurretGun()
|
||||
{
|
||||
entflags |= EF_TURRET;
|
||||
entflags |= ECF_TURRET;
|
||||
|
||||
AddWaitTill(STRING_ONTARGET);
|
||||
|
||||
@@ -522,7 +522,7 @@ TurretGun::~TurretGun()
|
||||
player->ExitTurret();
|
||||
}
|
||||
|
||||
entflags &= ~EF_TURRET;
|
||||
entflags &= ~ECF_TURRET;
|
||||
}
|
||||
|
||||
void TurretGun::PlaceTurret(Event *ev)
|
||||
|
||||
@@ -595,7 +595,7 @@ CLASS_DECLARATION(Animate, Projectile, NULL) {
|
||||
|
||||
Projectile::Projectile()
|
||||
{
|
||||
entflags |= EF_PROJECTILE;
|
||||
entflags |= ECF_PROJECTILE;
|
||||
|
||||
if (LoadingSavegame) {
|
||||
// Archive function will setup all necessary data
|
||||
|
||||
+98
-107
@@ -29,162 +29,153 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Event EV_Window_Setup
|
||||
(
|
||||
"_Windowsetup",
|
||||
EV_CODEONLY,
|
||||
NULL,
|
||||
NULL,
|
||||
"Does the post spawn setup of the Window"
|
||||
"_Windowsetup",
|
||||
EV_CODEONLY,
|
||||
NULL,
|
||||
NULL,
|
||||
"Does the post spawn setup of the Window"
|
||||
);
|
||||
|
||||
Event EV_Window_SetDebris
|
||||
(
|
||||
"debristype",
|
||||
EV_DEFAULT,
|
||||
"i",
|
||||
"type",
|
||||
"Sets the debris type of the Window"
|
||||
"debristype",
|
||||
EV_DEFAULT,
|
||||
"i",
|
||||
"type",
|
||||
"Sets the debris type of the Window"
|
||||
);
|
||||
|
||||
CLASS_DECLARATION( Entity, WindowObject, "func_window" )
|
||||
{
|
||||
{ &EV_Window_Setup, &WindowObject::WindowSetup },
|
||||
{ &EV_Damage, &WindowObject::WindowDamaged },
|
||||
{ &EV_Killed, &WindowObject::WindowKilled },
|
||||
{ &EV_Window_SetDebris, &WindowObject::WindowDebrisType },
|
||||
{ NULL, NULL }
|
||||
CLASS_DECLARATION(Entity, WindowObject, "func_window") {
|
||||
{&EV_Window_Setup, &WindowObject::WindowSetup },
|
||||
{&EV_Damage, &WindowObject::WindowDamaged },
|
||||
{&EV_Killed, &WindowObject::WindowKilled },
|
||||
{&EV_Window_SetDebris, &WindowObject::WindowDebrisType},
|
||||
{NULL, NULL }
|
||||
};
|
||||
|
||||
WindowObject::WindowObject()
|
||||
{
|
||||
m_iDebrisType = WINDOW_GLASS;
|
||||
m_iDebrisType = WINDOW_GLASS;
|
||||
|
||||
PostEvent( EV_Window_Setup, EV_POSTSPAWN );
|
||||
PostEvent(EV_Window_Setup, EV_POSTSPAWN);
|
||||
}
|
||||
|
||||
void WindowObject::Archive( Archiver& arc )
|
||||
void WindowObject::Archive(Archiver& arc)
|
||||
{
|
||||
arc.ArchiveInteger( &m_iDebrisType );
|
||||
arc.ArchiveString( &m_sBrokenModel );
|
||||
Entity::Archive(arc);
|
||||
|
||||
arc.ArchiveInteger(&m_iDebrisType);
|
||||
arc.ArchiveString(&m_sBrokenModel);
|
||||
}
|
||||
|
||||
void WindowObject::WindowSetup( Event *ev )
|
||||
void WindowObject::WindowSetup(Event *ev)
|
||||
{
|
||||
Entity *pEnt;
|
||||
Entity *pEnt;
|
||||
|
||||
setSolidType( SOLID_BSP );
|
||||
setSolidType(SOLID_BSP);
|
||||
|
||||
if( Target().length() )
|
||||
{
|
||||
pEnt = ( Entity * )G_FindTarget( NULL, Target() );
|
||||
if (Target().length()) {
|
||||
pEnt = (Entity *)G_FindTarget(NULL, Target());
|
||||
|
||||
if( pEnt )
|
||||
{
|
||||
// set the broken model to the target model
|
||||
m_sBrokenModel = pEnt->model;
|
||||
if (pEnt) {
|
||||
// set the broken model to the target model
|
||||
m_sBrokenModel = pEnt->model;
|
||||
|
||||
pEnt->PostEvent( EV_Remove, 0 );
|
||||
}
|
||||
}
|
||||
pEnt->PostEvent(EV_Remove, 0);
|
||||
}
|
||||
}
|
||||
|
||||
takedamage = DAMAGE_YES;
|
||||
takedamage = DAMAGE_YES;
|
||||
|
||||
if( health <= 0.1f ) {
|
||||
health = 100.0f;
|
||||
}
|
||||
if (health <= 0.1f) {
|
||||
health = 100.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void WindowObject::WindowDebrisType( Event *ev )
|
||||
void WindowObject::WindowDebrisType(Event *ev)
|
||||
{
|
||||
m_iDebrisType = ev->GetInteger( 1 );
|
||||
m_iDebrisType = ev->GetInteger(1);
|
||||
}
|
||||
|
||||
void WindowObject::WindowDamaged( Event *ev )
|
||||
void WindowObject::WindowDamaged(Event *ev)
|
||||
{
|
||||
int iMeansOfDeath;
|
||||
int iDamage;
|
||||
Vector vRight;
|
||||
Vector vForward;
|
||||
Vector vDir;
|
||||
Event *event;
|
||||
int iMeansOfDeath;
|
||||
int iDamage;
|
||||
Vector vRight;
|
||||
Vector vForward;
|
||||
Vector vDir;
|
||||
Event *event;
|
||||
|
||||
if( !takedamage ) {
|
||||
return;
|
||||
}
|
||||
if (!takedamage) {
|
||||
return;
|
||||
}
|
||||
|
||||
iDamage = ev->GetInteger( 2 );
|
||||
iMeansOfDeath = ev->GetInteger( 9 );
|
||||
iDamage = ev->GetInteger(2);
|
||||
iMeansOfDeath = ev->GetInteger(9);
|
||||
|
||||
if( iMeansOfDeath == MOD_BASH )
|
||||
{
|
||||
// double damage for bash
|
||||
iDamage *= 2;
|
||||
}
|
||||
else if( iMeansOfDeath == MOD_EXPLOSION )
|
||||
{
|
||||
// instant break
|
||||
iDamage = health;
|
||||
}
|
||||
if (iMeansOfDeath == MOD_BASH) {
|
||||
// double damage for bash
|
||||
iDamage *= 2;
|
||||
} else if (iMeansOfDeath == MOD_EXPLOSION) {
|
||||
// instant break
|
||||
iDamage = health;
|
||||
}
|
||||
|
||||
health -= iDamage;
|
||||
health -= iDamage;
|
||||
|
||||
if( health <= 0.0f )
|
||||
{
|
||||
event = new Event( EV_Killed );
|
||||
if (health <= 0.0f) {
|
||||
event = new Event(EV_Killed);
|
||||
|
||||
event->AddEntity( ev->GetEntity( 1 ) );
|
||||
event->AddInteger( ev->GetInteger( 2 ) );
|
||||
event->AddEntity( ev->GetEntity( 3 ) );
|
||||
event->AddEntity(ev->GetEntity(1));
|
||||
event->AddInteger(ev->GetInteger(2));
|
||||
event->AddEntity(ev->GetEntity(3));
|
||||
|
||||
ProcessEvent( event );
|
||||
}
|
||||
ProcessEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void WindowObject::WindowKilled( Event *ev )
|
||||
void WindowObject::WindowKilled(Event *ev)
|
||||
{
|
||||
Vector vCenter;
|
||||
Vector vCenter;
|
||||
|
||||
setSolidType( SOLID_NOT );
|
||||
setSolidType(SOLID_NOT);
|
||||
|
||||
hideModel();
|
||||
takedamage = DAMAGE_NO;
|
||||
hideModel();
|
||||
takedamage = DAMAGE_NO;
|
||||
|
||||
vCenter = origin + mins + maxs;
|
||||
vCenter = origin + mins + maxs;
|
||||
|
||||
gi.SetBroadcastVisible( vCenter, vCenter );
|
||||
gi.MSG_StartCGM(BG_MapCGMToProtocol(g_protocol, CGM_MAKE_WINDOW_DEBRIS));
|
||||
gi.MSG_WriteCoord( vCenter[ 0 ] );
|
||||
gi.MSG_WriteCoord( vCenter[ 1 ] );
|
||||
gi.MSG_WriteCoord( vCenter[ 2 ] );
|
||||
gi.MSG_WriteByte( m_iDebrisType );
|
||||
gi.MSG_EndCGM();
|
||||
gi.SetBroadcastVisible(vCenter, vCenter);
|
||||
gi.MSG_StartCGM(BG_MapCGMToProtocol(g_protocol, CGM_MAKE_WINDOW_DEBRIS));
|
||||
gi.MSG_WriteCoord(vCenter[0]);
|
||||
gi.MSG_WriteCoord(vCenter[1]);
|
||||
gi.MSG_WriteCoord(vCenter[2]);
|
||||
gi.MSG_WriteByte(m_iDebrisType);
|
||||
gi.MSG_EndCGM();
|
||||
|
||||
if( m_sBrokenModel.length() )
|
||||
{
|
||||
Entity *ent = new Entity;
|
||||
if (m_sBrokenModel.length()) {
|
||||
Entity *ent = new Entity;
|
||||
|
||||
ent->takedamage = DAMAGE_NO;
|
||||
ent->setModel( m_sBrokenModel );
|
||||
ent->takedamage = DAMAGE_NO;
|
||||
ent->setModel(m_sBrokenModel);
|
||||
|
||||
ent->setMoveType( MOVETYPE_NONE );
|
||||
ent->setSolidType( SOLID_BSP );
|
||||
ent->setMoveType(MOVETYPE_NONE);
|
||||
ent->setSolidType(SOLID_BSP);
|
||||
|
||||
setModel( m_sBrokenModel );
|
||||
setModel(m_sBrokenModel);
|
||||
|
||||
if( spawnflags & WINDOW_BROKEN_BLOCK )
|
||||
{
|
||||
ent->setContents( CONTENTS_MONSTERCLIP | CONTENTS_PLAYERCLIP );
|
||||
}
|
||||
else
|
||||
{
|
||||
ent->setContents( CONTENTS_SHOOTONLY );
|
||||
}
|
||||
if (spawnflags & WINDOW_BROKEN_BLOCK) {
|
||||
ent->setContents(CONTENTS_MONSTERCLIP | CONTENTS_PLAYERCLIP);
|
||||
} else {
|
||||
ent->setContents(CONTENTS_SHOOTONLY);
|
||||
}
|
||||
|
||||
ent->setOrigin( origin );
|
||||
ent->showModel();
|
||||
}
|
||||
ent->setOrigin(origin);
|
||||
ent->showModel();
|
||||
}
|
||||
|
||||
deadflag = DEAD_DEAD;
|
||||
deadflag = DEAD_DEAD;
|
||||
|
||||
// remove the window
|
||||
PostEvent( EV_Remove, 0 );
|
||||
// remove the window
|
||||
PostEvent(EV_Remove, 0);
|
||||
}
|
||||
+16
-14
@@ -23,29 +23,31 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
// windows.h: Window class
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "entity.h"
|
||||
|
||||
#define WINDOW_BROKEN_BLOCK 1
|
||||
#define WINDOW_BROKEN_BLOCK 1
|
||||
|
||||
enum
|
||||
{
|
||||
WINDOW_GLASS
|
||||
enum {
|
||||
WINDOW_GLASS
|
||||
};
|
||||
|
||||
class WindowObject : public Entity {
|
||||
class WindowObject : public Entity
|
||||
{
|
||||
private:
|
||||
int m_iDebrisType;
|
||||
str m_sBrokenModel;
|
||||
int m_iDebrisType;
|
||||
str m_sBrokenModel;
|
||||
|
||||
public:
|
||||
CLASS_PROTOTYPE( WindowObject );
|
||||
CLASS_PROTOTYPE(WindowObject);
|
||||
|
||||
WindowObject();
|
||||
WindowObject();
|
||||
|
||||
void Archive( Archiver& arc ) override;
|
||||
void Archive(Archiver& arc) override;
|
||||
|
||||
void WindowSetup( Event *ev );
|
||||
void WindowDebrisType( Event *ev );
|
||||
void WindowDamaged( Event *ev );
|
||||
void WindowKilled( Event *ev );
|
||||
void WindowSetup(Event *ev);
|
||||
void WindowDebrisType(Event *ev);
|
||||
void WindowDamaged(Event *ev);
|
||||
void WindowKilled(Event *ev);
|
||||
};
|
||||
@@ -479,7 +479,7 @@ CM_WritePortalState
|
||||
void CM_WritePortalState( fileHandle_t f )
|
||||
{
|
||||
FS_Write( &cm.numAreas, sizeof( int ), f );
|
||||
FS_Write( &cm.areaPortals, cm.numAreas * cm.numAreas * sizeof( *cm.areaPortals ), f );
|
||||
FS_Write( cm.areaPortals, cm.numAreas * cm.numAreas * sizeof( *cm.areaPortals ), f );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -494,7 +494,7 @@ void CM_ReadPortalState( fileHandle_t f )
|
||||
if (numareaportals != cm.numAreas) {
|
||||
Com_Error(ERR_DROP, "numareaportals differs from save game");
|
||||
}
|
||||
FS_Read(&cm.areaPortals, cm.numAreas * cm.numAreas * sizeof(*cm.areaPortals), f);
|
||||
FS_Read(cm.areaPortals, cm.numAreas * cm.numAreas * sizeof(*cm.areaPortals), f);
|
||||
CM_FloodAreaConnections();
|
||||
}
|
||||
|
||||
|
||||
+87
-55
@@ -29,6 +29,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
class Class;
|
||||
class Archiver;
|
||||
|
||||
template<typename k, typename v>
|
||||
class con_set;
|
||||
|
||||
template<typename key, typename value>
|
||||
class con_map;
|
||||
|
||||
template<typename key, typename value>
|
||||
class con_map_enum;
|
||||
|
||||
@@ -45,30 +51,51 @@ struct con_set_is_pointer<T *> {
|
||||
static const bool con_value = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* This class was originally inside con_set (con_set::Entry).
|
||||
* But because GCC is being extremely annoying and is moaning
|
||||
* because of specialization after instantiation,
|
||||
* the class is now laying there.
|
||||
*/
|
||||
template<typename k, typename v>
|
||||
class con_set_Entry
|
||||
{
|
||||
friend con_set<k, v>;
|
||||
friend con_set_enum<k, v>;
|
||||
|
||||
private:
|
||||
con_set_Entry *next;
|
||||
k key;
|
||||
|
||||
public:
|
||||
v value;
|
||||
|
||||
public:
|
||||
void *operator new(size_t size) { return con_set<k, v>::NewEntry(size); }
|
||||
|
||||
void operator delete(void *ptr) { con_set<k, v>::DeleteEntry(ptr); }
|
||||
|
||||
con_set_Entry()
|
||||
: key(k())
|
||||
, value(v())
|
||||
, next(NULL)
|
||||
{}
|
||||
|
||||
#ifdef ARCHIVE_SUPPORTED
|
||||
void Archive(Archiver& arc);
|
||||
#endif
|
||||
k& GetKey() { return key; }
|
||||
|
||||
void SetKey(const k& newKey) { key = newKey; }
|
||||
};
|
||||
|
||||
template<typename k, typename v>
|
||||
class con_set
|
||||
{
|
||||
friend class con_set_enum<k, v>;
|
||||
|
||||
public:
|
||||
class Entry
|
||||
{
|
||||
public:
|
||||
k key;
|
||||
v value;
|
||||
|
||||
Entry *next;
|
||||
|
||||
public:
|
||||
void *operator new(size_t size);
|
||||
void operator delete(void *ptr);
|
||||
|
||||
Entry();
|
||||
|
||||
#ifdef ARCHIVE_SUPPORTED
|
||||
void Archive(Archiver& arc);
|
||||
#endif
|
||||
};
|
||||
using Entry = con_set_Entry<k, v>;
|
||||
|
||||
public:
|
||||
static MEM_BlockAlloc<Entry> Entry_allocator;
|
||||
@@ -86,6 +113,10 @@ protected:
|
||||
Entry *addKeyEntry(const k& key);
|
||||
Entry *addNewKeyEntry(const k& key);
|
||||
|
||||
public:
|
||||
static void *NewEntry(size_t size);
|
||||
static void DeleteEntry(void *entry);
|
||||
|
||||
public:
|
||||
con_set();
|
||||
~con_set();
|
||||
@@ -113,29 +144,20 @@ public:
|
||||
template<typename k, typename v>
|
||||
MEM_BlockAlloc<typename con_set<k, v>::Entry> con_set<k, v>::Entry_allocator;
|
||||
|
||||
template<typename k>
|
||||
int HashCode(const k& key);
|
||||
|
||||
template<typename k, typename v>
|
||||
void *con_set<k, v>::Entry::operator new(size_t size)
|
||||
void *con_set<k, v>::NewEntry(size_t size)
|
||||
{
|
||||
return Entry_allocator.Alloc();
|
||||
}
|
||||
|
||||
template<typename k, typename v>
|
||||
void con_set<k, v>::Entry::operator delete(void *ptr)
|
||||
void con_set<k, v>::DeleteEntry(void *entry)
|
||||
{
|
||||
Entry_allocator.Free(ptr);
|
||||
Entry_allocator.Free(entry);
|
||||
}
|
||||
|
||||
template<typename k, typename v>
|
||||
con_set<k, v>::Entry::Entry()
|
||||
{
|
||||
this->key = k();
|
||||
this->value = v();
|
||||
|
||||
next = NULL;
|
||||
}
|
||||
template<typename k>
|
||||
int HashCode(const k& key);
|
||||
|
||||
template<typename key, typename value>
|
||||
con_set<key, value>::con_set()
|
||||
@@ -217,7 +239,7 @@ void con_set<key, value>::resize(int count)
|
||||
old = e->next;
|
||||
|
||||
// insert the old entry to the table hashindex
|
||||
index = HashCode<key>(e->key) % tableLength;
|
||||
index = HashCode<key>(e->GetKey()) % tableLength;
|
||||
|
||||
e->next = table[index];
|
||||
table[index] = e;
|
||||
@@ -238,7 +260,7 @@ typename con_set<k, v>::Entry *con_set<k, v>::findKeyEntry(const k& key) const
|
||||
entry = table[HashCode<k>(key) % tableLength];
|
||||
|
||||
for (; entry != NULL; entry = entry->next) {
|
||||
if (entry->key == key) {
|
||||
if (entry->GetKey() == key) {
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
@@ -264,28 +286,25 @@ template<typename k, typename v>
|
||||
typename con_set<k, v>::Entry *con_set<k, v>::addNewKeyEntry(const k& key)
|
||||
{
|
||||
Entry *entry;
|
||||
int index;
|
||||
int hash;
|
||||
|
||||
if (count >= threshold) {
|
||||
resize();
|
||||
}
|
||||
|
||||
index = HashCode<k>(key) % tableLength;
|
||||
|
||||
count++;
|
||||
|
||||
entry = new Entry;
|
||||
entry->SetKey(key);
|
||||
hash = HashCode<k>(entry->GetKey()) % tableLength;
|
||||
|
||||
if (defaultEntry == NULL) {
|
||||
defaultEntry = entry;
|
||||
entry->next = NULL;
|
||||
} else {
|
||||
entry->next = table[index];
|
||||
entry->next = table[hash];
|
||||
}
|
||||
|
||||
entry->key = key;
|
||||
|
||||
table[index] = entry;
|
||||
table[hash] = entry;
|
||||
|
||||
return entry;
|
||||
}
|
||||
@@ -299,25 +318,38 @@ bool con_set<key, value>::isEmpty(void)
|
||||
template<typename k, typename v>
|
||||
bool con_set<k, v>::remove(const k& key)
|
||||
{
|
||||
int index = HashCode<k>(key) % tableLength;
|
||||
Entry *prev = NULL;
|
||||
Entry *entry;
|
||||
int hash;
|
||||
int i;
|
||||
Entry *prev = NULL;
|
||||
Entry *entry, *e;
|
||||
|
||||
for (entry = table[index]; entry != NULL; entry = entry->next) {
|
||||
// just to make sure we're using the correct overloaded operator
|
||||
if (!(entry->key == key)) {
|
||||
hash = HashCode<k>(key) % tableLength;
|
||||
|
||||
for (entry = table[hash]; entry != NULL; entry = entry->next) {
|
||||
// just to make sure we're using the correct overloaded operator for the key
|
||||
if (!(entry->GetKey() == key)) {
|
||||
prev = entry;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (defaultEntry == entry) {
|
||||
defaultEntry = prev;
|
||||
defaultEntry = prev ? prev : table[hash];
|
||||
// find a default entry
|
||||
for (i = 0; i < tableLength && !defaultEntry; i++) {
|
||||
for (e = table[i]; e; e = e->next) {
|
||||
if (e == entry) {
|
||||
continue;
|
||||
}
|
||||
defaultEntry = e;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (prev) {
|
||||
prev->next = entry->next;
|
||||
} else {
|
||||
table[index] = entry->next;
|
||||
table[hash] = entry->next;
|
||||
}
|
||||
|
||||
count--;
|
||||
@@ -345,7 +377,7 @@ template<typename key, typename value>
|
||||
key *con_set<key, value>::firstKeyValue(void)
|
||||
{
|
||||
if (defaultEntry) {
|
||||
return &defaultEntry->key;
|
||||
return &defaultEntry->GetKey();
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
@@ -373,7 +405,7 @@ bool con_set<k, v>::keyExists(const k& key)
|
||||
Entry *entry;
|
||||
|
||||
for (entry = table; entry != NULL; entry = entry->next) {
|
||||
if (entry->key == key) {
|
||||
if (entry->GetKey() == key) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -491,7 +523,7 @@ public:
|
||||
value& operator[](const key& index);
|
||||
|
||||
value *find(const key& index);
|
||||
bool remove(const key &index);
|
||||
bool remove(const key& index);
|
||||
|
||||
unsigned int size();
|
||||
};
|
||||
@@ -582,7 +614,7 @@ key *con_map_enum<key, value>::CurrentKey(void)
|
||||
Entry *entry = m_Set_Enum.CurrentElement();
|
||||
|
||||
if (entry) {
|
||||
return &entry->key;
|
||||
return &entry->GetKey();
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
@@ -606,7 +638,7 @@ key *con_map_enum<key, value>::NextKey(void)
|
||||
Entry *entry = m_Set_Enum.NextElement();
|
||||
|
||||
if (entry) {
|
||||
return &entry->key;
|
||||
return &entry->GetKey();
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -3204,7 +3204,7 @@ void Listener::CancelWaitingAll()
|
||||
ConList stoppedListeners;
|
||||
|
||||
for (e = en.NextElement(); e != NULL; e = en.NextElement()) {
|
||||
CancelWaitingSources(e->key, e->value, stoppedListeners);
|
||||
CancelWaitingSources(e->GetKey(), e->value, stoppedListeners);
|
||||
}
|
||||
|
||||
delete m_WaitForList;
|
||||
@@ -3504,7 +3504,7 @@ void Listener::UnregisterAll(void)
|
||||
en = *m_NotifyList;
|
||||
|
||||
for (e = en.NextElement(); e != NULL; e = en.NextElement()) {
|
||||
UnregisterTargets(e->key, e->value, stoppedListeners, stoppedNames);
|
||||
UnregisterTargets(e->GetKey(), e->value, stoppedListeners, stoppedNames);
|
||||
}
|
||||
|
||||
delete m_NotifyList;
|
||||
|
||||
+22
-22
@@ -42,28 +42,28 @@ class Archiver;
|
||||
class EventQueueNode;
|
||||
|
||||
// entity subclass
|
||||
#define EF_ENTITY (1 << 0)
|
||||
#define EF_ANIMATE (1 << 1)
|
||||
#define EF_SENTIENT (1 << 2)
|
||||
#define EF_PLAYER (1 << 3)
|
||||
#define EF_ACTOR (1 << 4)
|
||||
#define EF_ITEM (1 << 5)
|
||||
#define EF_INVENTORYITEM (1 << 6)
|
||||
#define EF_WEAPON (1 << 7)
|
||||
#define EF_PROJECTILE (1 << 8)
|
||||
#define EF_DOOR (1 << 9)
|
||||
#define EF_CAMERA (1 << 10)
|
||||
#define EF_VEHICLE (1 << 11)
|
||||
#define EF_VEHICLETANK (1 << 12)
|
||||
#define EF_VEHICLETURRET (1 << 13)
|
||||
#define EF_TURRET (1 << 14)
|
||||
#define EF_PATHNODE (1 << 15)
|
||||
#define EF_WAYPOINT (1 << 16)
|
||||
#define EF_TEMPWAYPOINT (1 << 17)
|
||||
#define EF_VEHICLEPOINT (1 << 18)
|
||||
#define EF_SPLINEPATH (1 << 19)
|
||||
#define EF_CRATEOBJECT (1 << 20)
|
||||
#define EF_BOT (1 << 21)
|
||||
#define ECF_ENTITY (1 << 0)
|
||||
#define ECF_ANIMATE (1 << 1)
|
||||
#define ECF_SENTIENT (1 << 2)
|
||||
#define ECF_PLAYER (1 << 3)
|
||||
#define ECF_ACTOR (1 << 4)
|
||||
#define ECF_ITEM (1 << 5)
|
||||
#define ECF_INVENTORYITEM (1 << 6)
|
||||
#define ECF_WEAPON (1 << 7)
|
||||
#define ECF_PROJECTILE (1 << 8)
|
||||
#define ECF_DOOR (1 << 9)
|
||||
#define ECF_CAMERA (1 << 10)
|
||||
#define ECF_VEHICLE (1 << 11)
|
||||
#define ECF_VEHICLETANK (1 << 12)
|
||||
#define ECF_VEHICLETURRET (1 << 13)
|
||||
#define ECF_TURRET (1 << 14)
|
||||
#define ECF_PATHNODE (1 << 15)
|
||||
#define ECF_WAYPOINT (1 << 16)
|
||||
#define ECF_TEMPWAYPOINT (1 << 17)
|
||||
#define ECF_VEHICLEPOINT (1 << 18)
|
||||
#define ECF_SPLINEPATH (1 << 19)
|
||||
#define ECF_CRATEOBJECT (1 << 20)
|
||||
#define ECF_BOT (1 << 21)
|
||||
|
||||
// Event flags
|
||||
#define EV_CONSOLE (1 << 0) // Allow entry from console
|
||||
|
||||
@@ -1453,6 +1453,8 @@ typedef struct {
|
||||
// trace->entityNum can also be 0 to (MAX_GENTITIES-1)
|
||||
// or ENTITYNUM_NONE, ENTITYNUM_WORLD
|
||||
|
||||
#define SAVEGAME_STRUCT_VERSION 4
|
||||
|
||||
typedef struct {
|
||||
int version;
|
||||
int time;
|
||||
|
||||
@@ -32,7 +32,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
// These values are the only one that must be set for the version
|
||||
#define PRODUCT_VERSION_MAJOR 0
|
||||
#define PRODUCT_VERSION_MINOR 60
|
||||
#define PRODUCT_VERSION_PATCH 1
|
||||
#define PRODUCT_VERSION_PATCH 2
|
||||
#define PRODUCT_VERSION_SUFFIX "alpha"
|
||||
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015 the OpenMoHAA team
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
@@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#include "scriptvariable.h"
|
||||
#include "scriptexception.h"
|
||||
#include "../qcommon/str.h"
|
||||
#include "../qcommon/con_set.h"
|
||||
|
||||
#ifdef GAME_DLL
|
||||
# include "../fgame/archive.h"
|
||||
@@ -77,19 +78,6 @@ void con_set<ScriptVariable, ScriptVariable>::Entry::Archive(Archiver& arc)
|
||||
value.ArchiveInternal(arc);
|
||||
}
|
||||
|
||||
template<>
|
||||
void con_set<short3, ScriptVariable>::Entry::Archive(Archiver& arc)
|
||||
{
|
||||
if (arc.Loading()) {
|
||||
value.Archive(arc);
|
||||
# ifdef WITH_SCRIPT_ENGINE
|
||||
key = value.GetKey();
|
||||
# endif
|
||||
} else {
|
||||
value.Archive(arc);
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptArrayHolder::Archive(Archiver& arc)
|
||||
{
|
||||
arc.ArchiveUnsigned(&refCount);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015 the OpenMoHAA team
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
@@ -64,7 +64,8 @@ static const char *typenames[] = {
|
||||
"array",
|
||||
"pointer",
|
||||
"vector",
|
||||
"double"};
|
||||
"double"
|
||||
};
|
||||
|
||||
class ScriptArrayHolder;
|
||||
class ScriptConstArrayHolder;
|
||||
@@ -110,9 +111,9 @@ public:
|
||||
|
||||
~ScriptVariable();
|
||||
|
||||
void Archive(Archiver &arc);
|
||||
void Archive(Archiver& arc);
|
||||
static void Archive(Archiver& arc, ScriptVariable **obj);
|
||||
void ArchiveInternal(Archiver &arc);
|
||||
void ArchiveInternal(Archiver& arc);
|
||||
|
||||
void CastBoolean(void);
|
||||
void CastConstArrayValue(void);
|
||||
@@ -152,7 +153,7 @@ public:
|
||||
str& getName(void);
|
||||
|
||||
short3& GetKey();
|
||||
void SetKey(const short3 &key);
|
||||
void SetKey(const short3& key);
|
||||
#endif
|
||||
|
||||
Entity *entityValue(void);
|
||||
@@ -201,7 +202,7 @@ public:
|
||||
#endif
|
||||
|
||||
Vector vectorValue(void) const;
|
||||
void setVectorValue(const Vector &newvector);
|
||||
void setVectorValue(const Vector& newvector);
|
||||
|
||||
class PathNode *pathNodeValue(void) const;
|
||||
class Waypoint *waypointValue(void) const;
|
||||
@@ -218,16 +219,16 @@ public:
|
||||
ScriptVariable& operator[](ScriptVariable& index);
|
||||
ScriptVariable *operator[](unsigned index) const;
|
||||
ScriptVariable *operator*();
|
||||
void operator+=(const ScriptVariable &value);
|
||||
void operator-=(const ScriptVariable &value);
|
||||
void operator*=(const ScriptVariable &value);
|
||||
void operator/=(const ScriptVariable &value);
|
||||
void operator%=(const ScriptVariable &value);
|
||||
void operator&=(const ScriptVariable &value);
|
||||
void operator^=(const ScriptVariable &value);
|
||||
void operator|=(const ScriptVariable &value);
|
||||
void operator<<=(const ScriptVariable &value);
|
||||
void operator>>=(const ScriptVariable &value);
|
||||
void operator+=(const ScriptVariable& value);
|
||||
void operator-=(const ScriptVariable& value);
|
||||
void operator*=(const ScriptVariable& value);
|
||||
void operator/=(const ScriptVariable& value);
|
||||
void operator%=(const ScriptVariable& value);
|
||||
void operator&=(const ScriptVariable& value);
|
||||
void operator^=(const ScriptVariable& value);
|
||||
void operator|=(const ScriptVariable& value);
|
||||
void operator<<=(const ScriptVariable& value);
|
||||
void operator>>=(const ScriptVariable& value);
|
||||
|
||||
bool operator!=(const ScriptVariable& value);
|
||||
bool operator==(const ScriptVariable& value);
|
||||
@@ -245,7 +246,7 @@ public:
|
||||
public:
|
||||
ScriptArrayHolder();
|
||||
|
||||
void Archive(Archiver &arc);
|
||||
void Archive(Archiver& arc);
|
||||
static void Archive(Archiver& arc, ScriptArrayHolder *& arrayValue);
|
||||
};
|
||||
|
||||
@@ -257,7 +258,7 @@ public:
|
||||
unsigned int size;
|
||||
|
||||
public:
|
||||
void Archive(Archiver &arc);
|
||||
void Archive(Archiver& arc);
|
||||
static void Archive(Archiver& arc, ScriptConstArrayHolder *& constArrayValue);
|
||||
|
||||
ScriptConstArrayHolder(ScriptVariable *pVar, unsigned int size);
|
||||
@@ -272,7 +273,7 @@ public:
|
||||
Container<ScriptVariable *> list;
|
||||
|
||||
public:
|
||||
void Archive(Archiver &arc);
|
||||
void Archive(Archiver& arc);
|
||||
static void Archive(Archiver& arc, ScriptPointer *& pointerValue);
|
||||
|
||||
void Clear();
|
||||
@@ -284,6 +285,29 @@ public:
|
||||
|
||||
#ifdef WITH_SCRIPT_ENGINE
|
||||
|
||||
template<>
|
||||
class con_set_Entry<short3, ScriptVariable>
|
||||
{
|
||||
friend con_set<short3, ScriptVariable>;
|
||||
friend con_set_enum<short3, ScriptVariable>;
|
||||
|
||||
private:
|
||||
con_set_Entry *next;
|
||||
ScriptVariable value;
|
||||
|
||||
public:
|
||||
void *operator new(size_t size) { return con_set<short3, ScriptVariable>::NewEntry(size); }
|
||||
|
||||
void operator delete(void *ptr) { con_set<short3, ScriptVariable>::DeleteEntry(ptr); }
|
||||
|
||||
# ifdef ARCHIVE_SUPPORTED
|
||||
void Archive(Archiver& arc) { value.Archive(arc); }
|
||||
# endif
|
||||
short3& GetKey() { return value.GetKey(); }
|
||||
|
||||
void SetKey(const short3& newKey) { value.SetKey(newKey); }
|
||||
};
|
||||
|
||||
class ScriptVariableList : public Class
|
||||
{
|
||||
private:
|
||||
|
||||
+78
-11
@@ -82,18 +82,9 @@ ScriptVMStack::ScriptVMStack()
|
||||
{}
|
||||
|
||||
ScriptVMStack::ScriptVMStack(size_t stackSize)
|
||||
: ScriptVMStack()
|
||||
{
|
||||
if (!stackSize) {
|
||||
stackSize = 1;
|
||||
}
|
||||
|
||||
// allocate at once
|
||||
uint8_t *data = (uint8_t *)gi.Malloc((sizeof(ScriptVariable) + sizeof(ScriptVariable *)) * stackSize);
|
||||
localStack = new (data) ScriptVariable[stackSize];
|
||||
data += sizeof(ScriptVariable) * stackSize;
|
||||
|
||||
pTop = localStack;
|
||||
stackBottom = localStack + stackSize;
|
||||
Allocate(stackSize);
|
||||
}
|
||||
|
||||
ScriptVMStack::ScriptVMStack(ScriptVMStack&& other)
|
||||
@@ -117,6 +108,31 @@ ScriptVMStack& ScriptVMStack::operator=(ScriptVMStack&& other)
|
||||
}
|
||||
|
||||
ScriptVMStack::~ScriptVMStack()
|
||||
{
|
||||
Free();
|
||||
}
|
||||
|
||||
void ScriptVMStack::Allocate(size_t stackSize)
|
||||
{
|
||||
if (localStack) {
|
||||
// free the current local stack
|
||||
Free();
|
||||
}
|
||||
|
||||
if (!stackSize) {
|
||||
stackSize = 1;
|
||||
}
|
||||
|
||||
// allocate at once
|
||||
uint8_t *data = (uint8_t *)gi.Malloc((sizeof(ScriptVariable) + sizeof(ScriptVariable *)) * stackSize);
|
||||
localStack = new (data) ScriptVariable[stackSize];
|
||||
data += sizeof(ScriptVariable) * stackSize;
|
||||
|
||||
pTop = localStack;
|
||||
stackBottom = localStack + stackSize;
|
||||
}
|
||||
|
||||
void ScriptVMStack::Free()
|
||||
{
|
||||
const size_t localStackSize = GetStackSize();
|
||||
for (uintptr_t i = 0; i < localStackSize; ++i) {
|
||||
@@ -215,6 +231,36 @@ ScriptVariable& ScriptVMStack::PushAndGet(size_t offset)
|
||||
return *pTop;
|
||||
}
|
||||
|
||||
void ScriptVMStack::Archive(Archiver& arc)
|
||||
{
|
||||
unsigned int size;
|
||||
unsigned int offset;
|
||||
unsigned int numVars;
|
||||
unsigned int i;
|
||||
|
||||
if (arc.Saving()) {
|
||||
size = stackBottom - localStack;
|
||||
offset = pTop - localStack;
|
||||
numVars = offset + 1;
|
||||
|
||||
arc.ArchiveUnsigned(&size);
|
||||
arc.ArchiveUnsigned(&offset);
|
||||
} else {
|
||||
arc.ArchiveUnsigned(&size);
|
||||
arc.ArchiveUnsigned(&offset);
|
||||
numVars = offset + 1;
|
||||
|
||||
Allocate(size);
|
||||
pTop = localStack + offset;
|
||||
}
|
||||
|
||||
if (localStack) {
|
||||
for (i = 0; i < numVars; i++) {
|
||||
localStack[i].ArchiveInternal(arc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptVMStack::MoveTop(ScriptVariable&& other)
|
||||
{
|
||||
*pTop = std::move(other);
|
||||
@@ -246,6 +292,23 @@ void ScriptVM::operator delete(void *ptr)
|
||||
ScriptVM_allocator.Free(ptr);
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
ScriptVM
|
||||
====================
|
||||
*/
|
||||
ScriptVM::ScriptVM()
|
||||
{
|
||||
m_Stack = NULL;
|
||||
|
||||
m_PrevCodePos = NULL;
|
||||
m_pOldData = NULL;
|
||||
m_OldDataSize = 0;
|
||||
|
||||
m_bMarkStack = false;
|
||||
m_StackPos = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
ScriptVM
|
||||
@@ -318,6 +381,8 @@ void ScriptVM::Archive(Archiver& arc)
|
||||
m_Stack = new ScriptStack;
|
||||
m_Stack->m_Array = new ScriptVariable[stack];
|
||||
m_Stack->m_Count = stack;
|
||||
} else {
|
||||
m_Stack = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,6 +395,8 @@ void ScriptVM::Archive(Archiver& arc)
|
||||
m_ScriptClass->ArchiveCodePos(arc, &m_CodePos);
|
||||
arc.ArchiveByte(&state);
|
||||
arc.ArchiveByte(&m_ThreadState);
|
||||
|
||||
m_VMStack.Archive(arc);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
ScriptVariable *GetTopPtr(size_t offset) const;
|
||||
ScriptVariable *GetTopArray(size_t offset = 0) const;
|
||||
uintptr_t GetIndex() const;
|
||||
void MoveTop(ScriptVariable &&other);
|
||||
void MoveTop(ScriptVariable&& other);
|
||||
|
||||
/** Pop and return the previous value. */
|
||||
ScriptVariable& Pop();
|
||||
@@ -111,6 +111,12 @@ public:
|
||||
ScriptVariable& PushAndGet();
|
||||
ScriptVariable& PushAndGet(size_t offset);
|
||||
|
||||
void Archive(Archiver& arc);
|
||||
|
||||
private:
|
||||
void Allocate(size_t stackSize);
|
||||
void Free();
|
||||
|
||||
private:
|
||||
/** The VM's local stack. */
|
||||
ScriptVariable *localStack;
|
||||
@@ -181,12 +187,13 @@ private:
|
||||
bool Switch(StateScript *stateScript, ScriptVariable& var);
|
||||
|
||||
unsigned char *ProgBuffer();
|
||||
void HandleScriptException(ScriptException &exc);
|
||||
void HandleScriptException(ScriptException& exc);
|
||||
|
||||
public:
|
||||
void *operator new(size_t size);
|
||||
void operator delete(void *ptr);
|
||||
|
||||
ScriptVM();
|
||||
ScriptVM(ScriptClass *scriptClass, unsigned char *pCodePos, ScriptThread *thread);
|
||||
~ScriptVM();
|
||||
|
||||
|
||||
@@ -1884,7 +1884,7 @@ qboolean SV_ArchiveLevelFile(qboolean loading, qboolean autosave)
|
||||
if (f)
|
||||
{
|
||||
FS_Read(&save, sizeof(savegamestruct_t), f);
|
||||
if (save.version != 4)
|
||||
if (save.version != SAVEGAME_STRUCT_VERSION)
|
||||
{
|
||||
FS_FCloseFile(f);
|
||||
return qfalse;
|
||||
@@ -1986,7 +1986,7 @@ qboolean SV_ArchiveServerFile( qboolean loading, qboolean autosave )
|
||||
|
||||
SV_SetConfigstring( CS_SAVENAME, "" );
|
||||
|
||||
save.version = 3;
|
||||
save.version = SAVEGAME_STRUCT_VERSION;
|
||||
save.time = aclock;
|
||||
strncpy( save.mapName, svs.mapName, sizeof( save.mapName ) );
|
||||
strncpy( save.saveName, svs.gameName, sizeof( save.saveName ) );
|
||||
@@ -2010,8 +2010,8 @@ qboolean SV_ArchiveServerFile( qboolean loading, qboolean autosave )
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
FS_Read( &save, sizeof( savegamestruct_t ), f );
|
||||
if( save.version != 3 )
|
||||
FS_Read(&save, sizeof(savegamestruct_t), f);
|
||||
if (save.version != SAVEGAME_STRUCT_VERSION)
|
||||
{
|
||||
Com_Printf("Invalid or Old Server SaveGame Version\n");
|
||||
return qfalse;
|
||||
|
||||
Reference in new issue
Block a user