mirror of
https://github.com/unknownworlds/NS.git
synced 2024-11-22 04:31:14 +00:00
git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@286 67975925-1194-0748-b3d5-c16f83f1a3a1
This commit is contained in:
parent
9b78146ab5
commit
d7194eb748
5 changed files with 44 additions and 14 deletions
|
@ -27,7 +27,7 @@
|
|||
InlineFunctionExpansion="2"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)";U:\include\stlport;U:\include\nexus;U:\include\lua;U:\include\particle;U:\include"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;QUIVER;VOXEL;QUAKE2;VALVE_DLL;AVH_SERVER;AVH_PLAYTEST_BUILD;$(NOINHERIT);AVH_SECURE_PRERELEASE_BUILD;USE_OLDAUTH"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;QUIVER;VOXEL;QUAKE2;VALVE_DLL;AVH_SERVER;AVH_PLAYTEST_BUILD;$(NOINHERIT)"
|
||||
StringPooling="TRUE"
|
||||
MinimalRebuild="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
|
@ -99,7 +99,7 @@
|
|||
Optimization="0"
|
||||
OptimizeForProcessor="1"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)";U:\include\stlport;U:\include\nexus;U:\include\lua;U:\include\particle;U:\include"
|
||||
PreprocessorDefinitions="_DEBUG;DEBUG;WIN32;_WINDOWS;QUIVER;VOXEL;QUAKE2;VALVE_DLL;AVH_SERVER;$(NOINHERIT);AVH_SECURE_PRERELEASE_BUILD;USE_OLDAUTH"
|
||||
PreprocessorDefinitions="_DEBUG;DEBUG;WIN32;_WINDOWS;QUIVER;VOXEL;QUAKE2;VALVE_DLL;AVH_SERVER;$(NOINHERIT)"
|
||||
RuntimeLibrary="1"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
|
|
|
@ -993,7 +993,7 @@ void CBasePlayer::SetAnimation( PLAYER_ANIM playerAnim )
|
|||
float speed;
|
||||
char szAnim[64];
|
||||
bool theFoundAnim = true;
|
||||
int theDebugAnimations = BALANCE_VAR(kDebugAnimations);
|
||||
int theDebugAnimations = 0; // BALANCE_VAR(kDebugAnimations);
|
||||
bool reloadAnim = false;
|
||||
|
||||
// Make sure the model is set, as gestating models aren't set before the animation starts playing
|
||||
|
|
|
@ -1427,7 +1427,7 @@ const char* AvHGamerules::GetSpawnEntityName(AvHPlayer* inPlayer) const
|
|||
|
||||
// If there is no no avh start points, try to start up as CS. If that doesn't look
|
||||
// right, always return DM spawns.
|
||||
if((this->mMapMode == MAP_MODE_NS) || (this->mMapMode == MAP_MODE_CO))
|
||||
if((this->mMapMode == MAP_MODE_NS) || (this->mMapMode == MAP_MODE_CO) || (this->mMapMode == MAP_MODE_NSC))
|
||||
{
|
||||
// The different cases:
|
||||
// Player just connected to server and hasn't done anything yet OR
|
||||
|
@ -2171,6 +2171,11 @@ void AvHGamerules::PostWorldPrecacheReset(bool inNewMap)
|
|||
this->mStartedCountdown = true;
|
||||
}
|
||||
|
||||
// SCRIPTENGINE: Load map and execute OnLoad
|
||||
gLUA->Init();
|
||||
if (gLUA->LoadLUAForMap(STRING(gpGlobals->mapname)))
|
||||
gLUA->OnLoad();
|
||||
|
||||
//gVoiceHelper.Reset();
|
||||
}
|
||||
|
||||
|
@ -2210,6 +2215,12 @@ void AvHGamerules::JoinTeam(AvHPlayer* inPlayer, AvHTeamNumber inTeamToJoin, boo
|
|||
if(theServerPlayerData)
|
||||
theServerPlayerData->SetHasJoinedTeam(true);
|
||||
}
|
||||
|
||||
// SCRIPTENGINE: Join team
|
||||
if (this->GetIsScriptedMode())
|
||||
if (thePrevTeam != inTeamToJoin)
|
||||
gLUA->OnJointeam(inPlayer->entindex(), inTeamToJoin);
|
||||
// :SCRIPTENGINE
|
||||
}
|
||||
|
||||
// This is called before any entities are spawned, every time the map changes, including the first time
|
||||
|
@ -3117,6 +3128,11 @@ void AvHGamerules::SetGameStarted(bool inGameStarted)
|
|||
|
||||
this->mTeamA.SetGameStarted(inGameStarted);
|
||||
this->mTeamB.SetGameStarted(inGameStarted);
|
||||
|
||||
// SCRIPTENGINE: OnStart
|
||||
if (this->GetIsScriptedMode())
|
||||
gLUA->OnStarted();
|
||||
// :SCRIPTENGINE
|
||||
}
|
||||
|
||||
void AvHGamerules::SendMOTDToClient( edict_t *client )
|
||||
|
@ -3178,6 +3194,10 @@ void AvHGamerules::Think(void)
|
|||
// Tell all HUDs to reset
|
||||
NetMsg_GameStatus_State( kGameStatusReset, this->mMapMode );
|
||||
|
||||
// SCRIPTENGINE: Execute OnStart
|
||||
if (this->GetIsScriptedMode())
|
||||
gLUA->OnStart();
|
||||
|
||||
this->mFirstUpdate = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -133,6 +133,8 @@ float AvHLUA::GetTime()
|
|||
bool AvHLUA::LoadLUAForMap(const char *inMapName)
|
||||
{
|
||||
ASSERT(this->mGlobalContext != NULL);
|
||||
|
||||
this->mLoaded = true;
|
||||
std::string filename;
|
||||
filename = getModDirectory();
|
||||
filename += "/maps/";
|
||||
|
|
|
@ -22,7 +22,7 @@ void AvHLUA::OnLoad()
|
|||
return;
|
||||
}
|
||||
|
||||
if (int errorcode = lua_resume(threadState, 2))
|
||||
if (int errorcode = lua_resume(threadState, 0))
|
||||
AvHLUA_OnError(lua_tostring(threadState, -1));
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ bool AvHLUA::OnStartCheck()
|
|||
return false;
|
||||
}
|
||||
|
||||
if (int errorcode = lua_resume(threadState, 2))
|
||||
if (int errorcode = lua_resume(threadState, 0))
|
||||
AvHLUA_OnError(lua_tostring(threadState, -1));
|
||||
|
||||
// Return the team that won
|
||||
|
@ -65,7 +65,7 @@ void AvHLUA::OnStart()
|
|||
return;
|
||||
}
|
||||
|
||||
if (int errorcode = lua_resume(threadState, 2))
|
||||
if (int errorcode = lua_resume(threadState, 0))
|
||||
AvHLUA_OnError(lua_tostring(threadState, -1));
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ void AvHLUA::OnStarted()
|
|||
return;
|
||||
}
|
||||
|
||||
if (int errorcode = lua_resume(threadState, 2))
|
||||
if (int errorcode = lua_resume(threadState, 0))
|
||||
AvHLUA_OnError(lua_tostring(threadState, -1));
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ void AvHLUA::OnVictory(AvHTeamNumber inTeamNumber)
|
|||
}
|
||||
|
||||
lua_pushnumber(threadState, inTeamNumber);
|
||||
if (int errorcode = lua_resume(threadState, 2))
|
||||
if (int errorcode = lua_resume(threadState, 1))
|
||||
AvHLUA_OnError(lua_tostring(threadState, -1));
|
||||
}
|
||||
}
|
||||
|
@ -112,6 +112,11 @@ void AvHLUA::OnVictory(AvHTeamNumber inTeamNumber)
|
|||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
AvHTeamNumber AvHLUA::OnVictoryCheck()
|
||||
{
|
||||
// GC TEST
|
||||
//int limit = lua_getgcthreshold(this->mGlobalContext); /* previous limit */
|
||||
//lua_setgcthreshold(this->mGlobalContext, 0); /* force a GC cicle */
|
||||
//lua_setgcthreshold(this->mGlobalContext, limit);
|
||||
|
||||
if (this->mLoaded && this->definedOnVictoryCheck)
|
||||
{
|
||||
lua_State *threadState = lua_newthread(this->mGlobalContext);
|
||||
|
@ -119,16 +124,19 @@ AvHTeamNumber AvHLUA::OnVictoryCheck()
|
|||
if (!lua_isfunction(threadState, -1))
|
||||
{
|
||||
// not found, mark and exit
|
||||
this->definedOnJointeam = false;
|
||||
this->definedOnVictoryCheck = false;
|
||||
return TEAM_IND;
|
||||
}
|
||||
|
||||
if (int errorcode = lua_resume(threadState, 2))
|
||||
if (int errorcode = lua_resume(threadState, 0))
|
||||
AvHLUA_OnError(lua_tostring(threadState, -1));
|
||||
else
|
||||
{
|
||||
// Return the team that won
|
||||
if (lua_isnumber(threadState, -1))
|
||||
return (AvHTeamNumber)((int)lua_tonumber(threadState, -1));
|
||||
}
|
||||
|
||||
// Return the team that won
|
||||
if (lua_isnumber(threadState, -1))
|
||||
return (AvHTeamNumber)((int)lua_tonumber(threadState, -1));
|
||||
|
||||
}
|
||||
return TEAM_IND;
|
||||
|
|
Loading…
Reference in a new issue