fixed bug at21983

This commit is contained in:
Borja Ferrer 2005-11-26 20:38:58 +00:00
parent e9db0c8c76
commit 8112fbe161
5 changed files with 30 additions and 24 deletions

View File

@ -49,7 +49,6 @@ void OnAmxxAttach()
MF_AddNatives(global_Natives); MF_AddNatives(global_Natives);
memset(glinfo.szLastLights, 0x0, 128); memset(glinfo.szLastLights, 0x0, 128);
memset(glinfo.szRealLights, 0x0, 128); memset(glinfo.szRealLights, 0x0, 128);
glinfo.bLights = false;
glinfo.fNextLights = 0; glinfo.fNextLights = 0;
glinfo.bCheckLights = false; glinfo.bCheckLights = false;
} }
@ -203,7 +202,7 @@ void ServerDeactivate()
{ {
memset(glinfo.szLastLights, 0x0, 128); memset(glinfo.szLastLights, 0x0, 128);
memset(glinfo.szRealLights, 0x0, 128); memset(glinfo.szRealLights, 0x0, 128);
glinfo.bLights = false; glinfo.bCheckLights = false;
glinfo.fNextLights = 0; glinfo.fNextLights = 0;
// Reset all forwarding function tables (so that forwards won't be called before plugins are initialized) // Reset all forwarding function tables (so that forwards won't be called before plugins are initialized)
@ -218,6 +217,7 @@ void ServerDeactivate()
g_pFunctionTable->pfnThink=NULL; // "pfn_think", "register_think" g_pFunctionTable->pfnThink=NULL; // "pfn_think", "register_think"
g_pFunctionTable->pfnStartFrame=NULL; // "server_frame","ServerFrame" g_pFunctionTable->pfnStartFrame=NULL; // "server_frame","ServerFrame"
g_pFunctionTable->pfnTouch=NULL; // "pfn_touch","vexd_pfntouch" g_pFunctionTable->pfnTouch=NULL; // "pfn_touch","vexd_pfntouch"
g_pFunctionTable_Post->pfnStartFrame = NULL; // "set_lights"
ClearHooks(); ClearHooks();

View File

@ -559,15 +559,15 @@ static cell AMX_NATIVE_CALL set_view(AMX *amx, cell *params) {
static cell AMX_NATIVE_CALL set_lights(AMX *amx, cell *params) { static cell AMX_NATIVE_CALL set_lights(AMX *amx, cell *params) {
int iLength; int iLength;
char *szLights = MF_GetAmxString(amx, params[1], 0, &iLength); char *szLights = MF_GetAmxString(amx, params[1], 0, &iLength);
g_pFunctionTable_Post->pfnStartFrame = StartFrame_Post;
if (FStrEq(szLights, "#OFF")) { if (FStrEq(szLights, "#OFF")) {
glinfo.bLights = false; glinfo.bCheckLights = false;
memset(glinfo.szLastLights, 0x0, 128); memset(glinfo.szLastLights, 0x0, 128);
(g_engfuncs.pfnLightStyle)(0, (char *)glinfo.szRealLights); (g_engfuncs.pfnLightStyle)(0, (char *)glinfo.szRealLights);
return 1; return 1;
} }
glinfo.bLights = true;
glinfo.bCheckLights = true; glinfo.bCheckLights = true;
//Reset LastLights //Reset LastLights

View File

@ -108,7 +108,6 @@ struct PlayerInfo {
}; };
struct GlobalInfo { struct GlobalInfo {
bool bLights;
float fNextLights; float fNextLights;
char *szLastLights[128]; char *szLastLights[128];
char *szRealLights[128]; char *szRealLights[128];

View File

@ -109,13 +109,6 @@ void KeyValue(edict_t *pEntity, KeyValueData *pkvd)
void StartFrame() void StartFrame()
{ {
if (glinfo.bCheckLights) {
if (!FStrEq((const char*)glinfo.szLastLights, "")) {
(g_engfuncs.pfnLightStyle)(0, (char *)glinfo.szLastLights);
glinfo.fNextLights = gpGlobals->time + 1;
}
}
if (StartFrameForward != -1) if (StartFrameForward != -1)
MF_ExecuteForward(StartFrameForward); MF_ExecuteForward(StartFrameForward);
else if (VexdServerForward != -1) else if (VexdServerForward != -1)
@ -124,6 +117,20 @@ void StartFrame()
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
void StartFrame_Post()
{
if (glinfo.bCheckLights)
{
if (glinfo.fNextLights < gpGlobals->time)
{
(g_engfuncs.pfnLightStyle)(0, (char *)glinfo.szLastLights);
glinfo.fNextLights = gpGlobals->time + 1;
}
}
RETURN_META(MRES_IGNORED);
}
void CmdStart(const edict_t *player, const struct usercmd_s *_cmd, unsigned int random_seed) void CmdStart(const edict_t *player, const struct usercmd_s *_cmd, unsigned int random_seed)
{ {
unsigned int i = 0; unsigned int i = 0;

View File

@ -54,12 +54,12 @@
// (wd) are Will Day's notes // (wd) are Will Day's notes
// - GetEntityAPI2 functions // - GetEntityAPI2 functions
// #define FN_GameDLLInit GameDLLInit /* pfnGameInit() */ // #define FN_GameDLLInit GameDLLInit /* pfnGameInit() */
//#define FN_DispatchSpawn Spawn /* pfnSpawn() */ // #define FN_DispatchSpawn Spawn /* pfnSpawn() */
//#define FN_DispatchThink Think /* pfnThink() */ // #define FN_DispatchThink Think /* pfnThink() */
// #define FN_DispatchUse Use /* pfnUse() */ // #define FN_DispatchUse Use /* pfnUse() */
//#define FN_DispatchTouch pfnTouch /* pfnTouch() */ // #define FN_DispatchTouch pfnTouch /* pfnTouch() */
// #define FN_DispatchBlocked DispatchBlocked /* pfnBlocked() */ // #define FN_DispatchBlocked DispatchBlocked /* pfnBlocked() */
//#define FN_DispatchKeyValue KeyValue /* pfnKeyValue() */ // #define FN_DispatchKeyValue KeyValue /* pfnKeyValue() */
// #define FN_DispatchSave DispatchSave /* pfnSave() */ // #define FN_DispatchSave DispatchSave /* pfnSave() */
// #define FN_DispatchRestore DispatchRestore /* pfnRestore() */ // #define FN_DispatchRestore DispatchRestore /* pfnRestore() */
// #define FN_DispatchObjectCollsionBox DispatchObjectCollsionBox /* pfnSetAbsBox() */ // #define FN_DispatchObjectCollsionBox DispatchObjectCollsionBox /* pfnSetAbsBox() */
@ -70,15 +70,15 @@
// #define FN_ResetGlobalState ResetGlobalState /* pfnResetGlobalState() */ // #define FN_ResetGlobalState ResetGlobalState /* pfnResetGlobalState() */
#define FN_ClientConnect ClientConnect /* pfnClientConnect() (wd) Client has connected */ #define FN_ClientConnect ClientConnect /* pfnClientConnect() (wd) Client has connected */
#define FN_ClientDisconnect ClientDisconnect /* pfnClientDisconnect() (wd) Player has left the game */ #define FN_ClientDisconnect ClientDisconnect /* pfnClientDisconnect() (wd) Player has left the game */
//#define FN_ClientKill ClientKill /* pfnClientKill() (wd) Player has typed "kill" */ // #define FN_ClientKill ClientKill /* pfnClientKill() (wd) Player has typed "kill" */
// #define FN_ClientPutInServer ClientPutInServer /* pfnClientPutInServer() (wd) Client is entering the game */ // #define FN_ClientPutInServer ClientPutInServer /* pfnClientPutInServer() (wd) Client is entering the game */
// #define FN_ClientCommand ClientCommand /* pfnClientCommand() (wd) Player has sent a command (typed or from a bind) */ // #define FN_ClientCommand ClientCommand /* pfnClientCommand() (wd) Player has sent a command (typed or from a bind) */
// #define FN_ClientUserInfoChanged ClientUserInfoChanged /* pfnClientUserInfoChanged() (wd) Client has updated their setinfo structure */ // #define FN_ClientUserInfoChanged ClientUserInfoChanged /* pfnClientUserInfoChanged() (wd) Client has updated their setinfo structure */
#define FN_ServerActivate ServerActivate /* pfnServerActivate() (wd) Server is starting a new map */ #define FN_ServerActivate ServerActivate /* pfnServerActivate() (wd) Server is starting a new map */
#define FN_ServerDeactivate ServerDeactivate /* pfnServerDeactivate() (wd) Server is leaving the map (shutdown or changelevel); SDK2 */ #define FN_ServerDeactivate ServerDeactivate /* pfnServerDeactivate() (wd) Server is leaving the map (shutdown or changelevel); SDK2 */
//#define FN_PlayerPreThink PlayerPreThink /* pfnPlayerPreThink() */ // #define FN_PlayerPreThink PlayerPreThink /* pfnPlayerPreThink() */
// #define FN_PlayerPostThink PlayerPostThink /* pfnPlayerPostThink() */ // #define FN_PlayerPostThink PlayerPostThink /* pfnPlayerPostThink() */
//#define FN_StartFrame StartFrame /* pfnStartFrame() */ // #define FN_StartFrame StartFrame /* pfnStartFrame() */
// #define FN_ParmsNewLevel ParmsNewLevel /* pfnParmsNewLevel() */ // #define FN_ParmsNewLevel ParmsNewLevel /* pfnParmsNewLevel() */
// #define FN_ParmsChangeLevel ParmsChangeLevel /* pfnParmsChangeLevel() */ // #define FN_ParmsChangeLevel ParmsChangeLevel /* pfnParmsChangeLevel() */
// #define FN_GetGameDescription GetGameDescription /* pfnGetGameDescription() Returns string describing current .dll. E.g. "TeamFotrress 2" "Half-Life" */ // #define FN_GetGameDescription GetGameDescription /* pfnGetGameDescription() Returns string describing current .dll. E.g. "TeamFotrress 2" "Half-Life" */
@ -96,7 +96,7 @@
// #define FN_CreateBaseline CreateBaseline /* pfnCreateBaseline() Tweak entity baseline for network encoding allows setup of player baselines too.; (wd) SDK2 */ // #define FN_CreateBaseline CreateBaseline /* pfnCreateBaseline() Tweak entity baseline for network encoding allows setup of player baselines too.; (wd) SDK2 */
// #define FN_RegisterEncoders RegisterEncoders /* pfnRegisterEncoders() Callbacks for network encoding; (wd) SDK2 */ // #define FN_RegisterEncoders RegisterEncoders /* pfnRegisterEncoders() Callbacks for network encoding; (wd) SDK2 */
// #define FN_GetWeaponData GetWeaponData /* pfnGetWeaponData() (wd) SDK2 */ // #define FN_GetWeaponData GetWeaponData /* pfnGetWeaponData() (wd) SDK2 */
//#define FN_CmdStart CmdStart /* pfnCmdStart() (wd) SDK2 */ // #define FN_CmdStart CmdStart /* pfnCmdStart() (wd) SDK2 */
// #define FN_CmdEnd CmdEnd /* pfnCmdEnd() (wd) SDK2 */ // #define FN_CmdEnd CmdEnd /* pfnCmdEnd() (wd) SDK2 */
// #define FN_ConnectionlessPacket ConnectionlessPacket /* pfnConnectionlessPacket() (wd) SDK2 */ // #define FN_ConnectionlessPacket ConnectionlessPacket /* pfnConnectionlessPacket() (wd) SDK2 */
// #define FN_GetHullBounds GetHullBounds /* pfnGetHullBounds() (wd) SDK2 */ // #define FN_GetHullBounds GetHullBounds /* pfnGetHullBounds() (wd) SDK2 */
@ -129,8 +129,8 @@
// #define FN_ServerActivate_Post ServerActivate_Post // #define FN_ServerActivate_Post ServerActivate_Post
// #define FN_ServerDeactivate_Post ServerDeactivate_Post // #define FN_ServerDeactivate_Post ServerDeactivate_Post
// #define FN_PlayerPreThink_Post PlayerPreThink_Post // #define FN_PlayerPreThink_Post PlayerPreThink_Post
//#define FN_PlayerPostThink_Post PlayerPostThink_Post // #define FN_PlayerPostThink_Post PlayerPostThink_Post
// #define FN_StartFrame_Post StartFrame_Post #define FN_StartFrame_Post StartFrame_Post
// #define FN_ParmsNewLevel_Post ParmsNewLevel_Post // #define FN_ParmsNewLevel_Post ParmsNewLevel_Post
// #define FN_ParmsChangeLevel_Post ParmsChangeLevel_Post // #define FN_ParmsChangeLevel_Post ParmsChangeLevel_Post
// #define FN_GetGameDescription_Post GetGameDescription_Post // #define FN_GetGameDescription_Post GetGameDescription_Post
@ -280,7 +280,7 @@
// #define FN_SetPhysicsKeyValue SetPhysicsKeyValue // #define FN_SetPhysicsKeyValue SetPhysicsKeyValue
// #define FN_GetPhysicsInfoString GetPhysicsInfoString // #define FN_GetPhysicsInfoString GetPhysicsInfoString
// #define FN_PrecacheEvent PrecacheEvent // #define FN_PrecacheEvent PrecacheEvent
//#define FN_PlaybackEvent PlaybackEvent // #define FN_PlaybackEvent PlaybackEvent
// #define FN_SetFatPVS SetFatPVS // #define FN_SetFatPVS SetFatPVS
// #define FN_SetFatPAS SetFatPAS // #define FN_SetFatPAS SetFatPAS
// #define FN_CheckVisibility CheckVisibility // #define FN_CheckVisibility CheckVisibility