From 0da49cfc45f323d9d53f8e8b109e77b706c5418a Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 26 Feb 2006 06:45:44 +0000 Subject: [PATCH] reduced this module to a wrapper --- dlls/ts/tsfun/CMessage.cpp | 280 ------------- dlls/ts/tsfun/CMisc.cpp | 43 -- dlls/ts/tsfun/CNatives.h | 737 ----------------------------------- dlls/ts/tsfun/CPlayer.cpp | 108 ----- dlls/ts/tsfun/CPlayer.h | 163 -------- dlls/ts/tsfun/moduleconfig.h | 50 +-- dlls/ts/tsfun/tsfun.cpp | 311 --------------- dlls/ts/tsfun/tsfun.h | 106 ----- dlls/ts/tsfun/tsfun.vcproj | 77 ---- 9 files changed, 25 insertions(+), 1850 deletions(-) delete mode 100755 dlls/ts/tsfun/CMessage.cpp delete mode 100755 dlls/ts/tsfun/CMisc.cpp delete mode 100755 dlls/ts/tsfun/CNatives.h delete mode 100755 dlls/ts/tsfun/CPlayer.cpp delete mode 100755 dlls/ts/tsfun/CPlayer.h delete mode 100755 dlls/ts/tsfun/tsfun.cpp delete mode 100755 dlls/ts/tsfun/tsfun.h diff --git a/dlls/ts/tsfun/CMessage.cpp b/dlls/ts/tsfun/CMessage.cpp deleted file mode 100755 index 10c491cf..00000000 --- a/dlls/ts/tsfun/CMessage.cpp +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Copyright (c) 2003-2004 Lukasz Wlasinski - * - * This file is part of TS XMod. - * - * TS XMod is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * TS XMod is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with TS XMod; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, the author gives permission to - * link the code of this program with the Half-Life Game Engine ("HL - * Engine") and Modified Game Libraries ("MODs") developed by Valve, - * L.L.C ("Valve"). You must obey the GNU General Public License in all - * respects for all of the code used other than the HL Engine and MODs - * from Valve. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If - * you do not wish to do so, delete this exception statement from your - * version. - * - */ - -#include "amxxmodule.h" -#include "tsfun.h" - -void Client_ResetHUD_End(void* mValue) -{ - if ( mPlayer->IsAlive() ) - { - return; - } - else - { - mPlayer->items = 0; - mPlayer->is_specialist = 0; - mPlayer->killingSpree = 0; - mPlayer->killFlags = 0; - mPlayer->frags = (int)mPlayer->pEdict->v.frags; - } -} - -void Client_ScoreInfo(void* mValue) -{ - static int iId; - switch(mState++) - { - case 0: - iId = *(int*)mValue; - break; - case 4: - if ( iId && (iId < 33) ) - { - GET_PLAYER_POINTER_I(iId)->teamId = *(int*)mValue; - } - break; - } -} - -void Client_WeaponInfo(void* mValue) -{ - static int wpn; - switch(mState++){ - case 0: - wpn = *(int*)mValue; - if ( !wpn ) wpn = 36; // kung fu - mPlayer->current = wpn; - break; - case 1: - mPlayer->weapons[wpn].clip = *(int*)mValue; - break; - case 2: - mPlayer->weapons[wpn].ammo = *(int*)mValue; - break; - case 3: - mPlayer->weapons[wpn].mode = *(int*)mValue; - break; - case 4: - mPlayer->weapons[wpn].attach = *(int*)mValue; - break; - } -} - -void Client_ClipInfo(void* mValue) -{ - int iValue = *(int*)mValue; - mPlayer->weapons[mPlayer->current].clip = iValue; -} - -void Client_TSHealth_End(void* mValue) -{ - - edict_t *enemy = mPlayer->pEdict->v.dmg_inflictor; - int damage = (int)mPlayer->pEdict->v.dmg_take; - - if ( !damage || !enemy ) - return; - - int aim = 0; - int weapon = 0; - mPlayer->pEdict->v.dmg_take = 0.0; - - CPlayer* pAttacker = NULL; - - if ( enemy->v.flags & (FL_CLIENT | FL_FAKECLIENT) ) - { - pAttacker = GET_PLAYER_POINTER(enemy); - weapon = pAttacker->current; - aim = pAttacker->aiming; - } - else - { - char szCName[16]; - strcpy( szCName,STRING(enemy->v.classname) ); - - if ( szCName[0] == 'g' ) - { - if ( enemy->v.owner && enemy->v.owner->v.flags & (FL_CLIENT | FL_FAKECLIENT) ) - { - pAttacker = GET_PLAYER_POINTER(enemy->v.owner); - weapon = 24; // grenade - } - } - else if ( szCName[0] == 'k' ) - { - int pOwner = *( (int*)enemy->pvPrivateData + gKnifeOffset ); - - if ( FNullEnt( (edict_t*)pOwner) ) - return; - - pAttacker = GET_PLAYER_POINTER( (edict_t*)pOwner ); - - weapon = 37; // throwing knife - aim = pAttacker->aiming; - } - } - if ( !pAttacker ) pAttacker = mPlayer; - - int TA = 0; - if ( mPlayer->teamId ) - { - if ( (mPlayer->teamId == pAttacker->teamId ) && (mPlayer != pAttacker) ) - TA = 1; - } - - if ( mPlayer->IsAlive() ) - return; - - // death - - if ( (int)pAttacker->pEdict->v.frags - pAttacker->frags == 0 ) - pAttacker = mPlayer; - - int killFlags = 0; - - if ( !TA && mPlayer!=pAttacker ) - { - - int sflags = pAttacker->pEdict->v.iuser4; - - int stuntKill = 0; - int slpos = 0; - - if ( weapon == 24 ) // dla granata nie liczy sie sflags - ; // nic nie rob.. - else if ( sflags == 20 || sflags == 1028 || sflags == 2052 ) - stuntKill = 1; - else if ( sflags == 36) - slpos = 1; - - int doubleKill = 0; - - if ( gpGlobals->time - pAttacker->lastKill < 1.0 ) - doubleKill = 1; - - if ( stuntKill ) - killFlags |= TSKF_STUNTKILL; - - pAttacker->lastKill = gpGlobals->time; - - pAttacker->killingSpree++; - - if ( pAttacker->killingSpree == 10 ) - pAttacker->is_specialist = 1; - - pAttacker->lastFrag = weaponData[weapon].bonus + 2*stuntKill; - - if ( doubleKill ) - { - pAttacker->lastFrag *= 2; - killFlags |= TSKF_DOUBLEKILL; - } - - if ( pAttacker->is_specialist ) - { - pAttacker->lastFrag *= 2; - killFlags |= TSKF_ISSPEC; - } - - if ( mPlayer->is_specialist ) - { - pAttacker->lastFrag += 5; - killFlags |= TSKF_KILLEDSPEC; - } - - pAttacker->frags += pAttacker->lastFrag; - if ( pAttacker->frags != pAttacker->pEdict->v.frags ) - { - - if ( slpos ) - killFlags |= TSKF_SLIDINGKILL; - else - weapon = 36; - - pAttacker->lastFrag += (int)pAttacker->pEdict->v.frags - pAttacker->frags; - pAttacker->frags = (int)pAttacker->pEdict->v.frags; - } - } - - pAttacker->killFlags = killFlags; -} - - -void Client_TSState(void* mValue) -{ - mPlayer->oldstate = mPlayer->state; - mPlayer->checkstate = 1; - mPlayer->state = *(int*)mValue; -} - - -void Client_WStatus(void* mValue) -{ - switch(mState++) - { - case 1: - if ( !*(int*)mValue ) - { - mPlayer->current = 36; - } - break; - } -} - -void Client_PwUp(void* mValue) -{ - static int iPwType; - switch(mState++) - { - case 0: - iPwType = *(int*)mValue; - switch(iPwType) - { - case TSPWUP_KUNGFU : - mPlayer->items |= TSITEM_KUNGFU; - break; - - case TSPWUP_SJUMP: - mPlayer->items |= TSITEM_SUPERJUMP; - break; - - default: mPlayer->PwUp = iPwType; - } - break; - case 1: - - if ( iPwType != TSPWUP_KUNGFU && iPwType != TSPWUP_SJUMP ) - mPlayer->PwUpValue = *(int*)mValue; - - break; - } -} \ No newline at end of file diff --git a/dlls/ts/tsfun/CMisc.cpp b/dlls/ts/tsfun/CMisc.cpp deleted file mode 100755 index 027259c0..00000000 --- a/dlls/ts/tsfun/CMisc.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include "tsfun.h" - -weapon_t weaponData[] = { - { 1,"Kung Fu","kung_fu",3 }, // id 0 like in WeaponInfo , DeathMsg - { 0,"Glock-18","glock-18",1 }, - { 0,"Unk1","Unk1",0 }, // bomb ? - { 0,"Mini-Uzi","mini-uzi",1 }, - { 0,"BENELLI-M3","benelli_m3",1 }, - { 0,"M4A1","m4a1",1 }, - { 0,"MP5SD","mp5sd",1 }, - { 0,"MP5K","mp5k",1 }, - { 0,"Akimbo Berettas","akimbo_berettas",1 }, - { 0,"SOCOM-MK23","socom-mk23",1 }, - { 0,"Akimbo MK23","akimbo_mk23",1 }, - { 0,"USAS-12","usas-12",1 }, - { 0,"Desert Eagle","desert_eagle",1 }, - { 0,"AK47","ak47",1 }, - { 0,"Five-seveN","five-seven",1 }, - { 0,"STEYR-AUG","steyr-aug",1 }, - { 0,"Akimbo Mini-Uzi","akimbo_mini-uzi",1 }, - { 0,"STEYR-TMP","steyr-tmp",1 }, - { 0,"Barrett M82A1","barrett_m82a1",1 }, - { 0,"MP7-PDW","mp7-pdw",1 }, - { 0,"SPAS-12","spas-12",1 }, - { 0,"Golden Colts","golden_colts",1 }, - { 0,"Glock-20C","glock-20c",1 }, - { 0,"UMP", "ump",1 }, - { 0,"M61 Grenade","m61_grenade",1 }, - { 1,"Combat Knife","combat_knife",1 }, - { 0,"MOSSBERG 500","mossberg_500",1 }, - { 0,"M16A4","m16a4",1 }, - { 0,"Ruger-MK1","ruger-mk1",1 }, - { 0,"C4","c4",0 }, - { 0,"Akimbo Five-seveN","akimbo_five-seven",1 }, - { 0,"Raging Bull","raging_bull",1 }, - { 0,"M60E3","m60e3",1 }, - { 0,"Sawed-off","sawed-off",1 }, // 33 - { 1,"Katana", "katana",2 }, - { 1,"Seal Knife","seal_knife",1 }, // 35 - { 1,"Kung Fu","kung_fu",3 }, // Again new id 36 - { 1,"Throwing Knife","throwing_knife",2 }, // new id 37 - { 0,"breakable", "breakable", 1 }, -}; diff --git a/dlls/ts/tsfun/CNatives.h b/dlls/ts/tsfun/CNatives.h deleted file mode 100755 index 2da6ff8d..00000000 --- a/dlls/ts/tsfun/CNatives.h +++ /dev/null @@ -1,737 +0,0 @@ -/* - * Copyright (c) 2003-2004 Lukasz Wlasinski - * - * This file is part of TS XMod. - * - * TS XMod is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * TS XMod is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with TS XMod; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, the author gives permission to - * link the code of this program with the Half-Life Game Engine ("HL - * Engine") and Modified Game Libraries ("MODs") developed by Valve, - * L.L.C ("Valve"). You must obey the GNU General Public License in all - * respects for all of the code used other than the HL Engine and MODs - * from Valve. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If - * you do not wish to do so, delete this exception statement from your - * version. - * - */ - -#include "amxxmodule.h" - -#ifndef TSX_NATIVES -#define TSX_NATIVES - -#define TSPWUP_SLOWMO 1 -#define TSPWUP_INFAMMO 2 -#define TSPWUP_KUNGFU 4 -#define TSPWUP_SLOWPAUSE 8 -#define TSPWUP_DFIRERATE 16 -#define TSPWUP_GRENADE 32 -#define TSPWUP_HEALTH 64 -#define TSPWUP_ARMOR 128 -#define TSPWUP_SUPERJUMP 256 - -static cell AMX_NATIVE_CALL get_weapon_name(AMX *amx, cell *params) -{ // from id to name 3 params id, name, len - - int id = params[1]; - if (id<0 || id>=TSMAX_WEAPONS) - { - MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", id); - return 0; - } - return MF_SetAmxString(amx,params[2],weaponData[id].name,params[3]); -} - -static cell AMX_NATIVE_CALL wpnlog_to_name(AMX *amx, cell *params) -{ // from log to name - - int iLen; - char *log = MF_GetAmxString(amx,params[1],0,&iLen); - int i; - for ( i=1; i=TSMAX_WEAPONS) - { - MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", id); - return 0; - } - return MF_SetAmxString(amx,params[2],weaponData[id].logname,params[3]); -} - -static cell AMX_NATIVE_CALL is_melee(AMX *amx, cell *params) -{ - int id = params[1]; - if (id<1 || id>=TSMAX_WEAPONS) - { - MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", id); - return 0; - } - - if ( weaponData[id].melee ) - return 1; - - return 0; -} - -static cell AMX_NATIVE_CALL ts_get_user_weapon(AMX *amx, cell *params) -{ - int id = params[1]; - CHECK_PLAYER(id); - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - int wpn = pPlayer->current; - - cell *cpTemp = MF_GetAmxAddr(amx,params[2]); - *cpTemp = pPlayer->weapons[wpn].clip; - - cpTemp = MF_GetAmxAddr(amx,params[3]); - *cpTemp = pPlayer->weapons[wpn].ammo; - - cpTemp = MF_GetAmxAddr(amx,params[4]); - *cpTemp = pPlayer->weapons[wpn].mode; - - cpTemp = MF_GetAmxAddr(amx,params[5]); - *cpTemp = pPlayer->weapons[wpn].attach; - - return wpn; - -} - -static cell AMX_NATIVE_CALL get_user_weapon(AMX *amx, cell *params) -{ - int id = params[1]; - CHECK_PLAYER(id); - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - int wpn = pPlayer->current; - - cell *cpTemp = MF_GetAmxAddr(amx,params[2]); - *cpTemp = pPlayer->weapons[wpn].clip; - - cpTemp = MF_GetAmxAddr(amx,params[3]); - *cpTemp = pPlayer->weapons[wpn].ammo; - - return wpn; - -} - -static cell AMX_NATIVE_CALL get_user_state(AMX *amx, cell *params) -{ - int id = params[1]; - CHECK_PLAYER(id); - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - if(!pPlayer->ingame) return 0; - - return pPlayer->state; - -} - - -static cell AMX_NATIVE_CALL set_user_cash(AMX *amx, cell *params) -{ - int id = params[1]; - CHECK_PLAYER(id); - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - pPlayer->SetMoney(params[2]); - return 1; - -} - -static cell AMX_NATIVE_CALL get_user_cash(AMX *amx, cell *params) -{ - int id = params[1]; - CHECK_PLAYER(id); - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - return pPlayer->GetMoney(); - -} - -static cell AMX_NATIVE_CALL set_user_slots(AMX *amx, cell *params) -{ - int id = params[1]; - CHECK_PLAYER(id); - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - pPlayer->SetSlots(params[2]); - return 1; -} - -static cell AMX_NATIVE_CALL get_user_slots(AMX *amx, cell *params) -{ - int id = params[1]; - CHECK_PLAYER(id); - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - return pPlayer->GetSlots(); -} - - -static cell AMX_NATIVE_CALL get_user_pwup(AMX *amx, cell *params) -{ - int id = params[1]; - CHECK_PLAYER(id); - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - cell *cpTemp = MF_GetAmxAddr(amx,params[2]); - *cpTemp = pPlayer->PwUpValue; - - return pPlayer->PwUp; - -} - -static cell AMX_NATIVE_CALL get_user_items(AMX *amx, cell *params) -{ - int id = params[1]; - CHECK_PLAYER(id); - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - return pPlayer->items; - -} - -static cell AMX_NATIVE_CALL get_killingStreak(AMX *amx, cell *params) -{ - int id = params[1]; - CHECK_PLAYER(id); - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - return pPlayer->killingSpree; - -} - -static cell AMX_NATIVE_CALL get_lastFrag(AMX *amx, cell *params) -{ - int id = params[1]; - CHECK_PLAYER(id); - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - return pPlayer->lastFrag; - -} - -static cell AMX_NATIVE_CALL get_killflags(AMX *amx, cell *params) -{ - int id = params[1]; - CHECK_PLAYER(id); - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - return pPlayer->killFlags; - -} - -static cell AMX_NATIVE_CALL give_weapon(AMX *amx, cell *params) -{ - int id = params[1]; - CHECK_PLAYER(id); - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - if ( !pPlayer->IsAlive() ) - { - return 0; - } - - // can he carry this weapon check ? - - string_t item = MAKE_STRING("ts_groundweapon"); - edict_t *pent = CREATE_NAMED_ENTITY( item ); - if ( FNullEnt( pent ) ) - { - return 0; - } - - KeyValueData pkvd; - char szTemp[16]; - - sprintf(szTemp,"%d",(int)params[2]); - - pkvd.szClassName = (char *)STRING(pent->v.classname); - pkvd.szKeyName = "tsweaponid"; // weapon - pkvd.szValue = szTemp; - pkvd.fHandled = false; - MDLL_KeyValue(pent, &pkvd); - - pkvd.szClassName = (char *)STRING(pent->v.classname); - pkvd.szKeyName = "wduration"; // duration - pkvd.szValue = "180"; - pkvd.fHandled = false; - MDLL_KeyValue(pent, &pkvd); - - sprintf(szTemp,"%d",(int)params[3]); - - pkvd.szClassName = (char *)STRING(pent->v.classname); - pkvd.szKeyName = "wextraclip"; // clips - pkvd.szValue = szTemp; - pkvd.fHandled = false; - MDLL_KeyValue(pent, &pkvd); - - sprintf(szTemp,"%d",(int)params[4]); - - pkvd.szClassName = (char *)STRING(pent->v.classname); - pkvd.szKeyName = "spawnflags"; // attachements :flashlight,lasersight,scope.. - pkvd.szValue = szTemp; - pkvd.fHandled = false; - MDLL_KeyValue(pent, &pkvd); - -/* - pkvd.szClassName = "ts_groundweapon"; - pkvd.szKeyName = "message"; - pkvd.szValue = ""; - pMDLL_KeyValue(pEntity, &pkvd); -*/ - - MDLL_Spawn(pent); - - pent->v.origin = pPlayer->pEdict->v.origin; - - MDLL_Use(pent, pPlayer->pEdict); - - REMOVE_ENTITY(pent); - - return 1; - -} - -static cell AMX_NATIVE_CALL create_pwup(AMX *amx, cell *params) -{ - - string_t item = MAKE_STRING("ts_powerup"); - edict_t *pent = CREATE_NAMED_ENTITY( item ); - if ( FNullEnt( pent ) ) - { - return 0; - } - - KeyValueData pkvd; - char szTemp[16]; - - sprintf(szTemp,"%d",(int)params[1]); - - pkvd.szClassName = (char *)STRING(pent->v.classname); - pkvd.szKeyName = "pwuptype"; // type - pkvd.szValue = szTemp; - pkvd.fHandled = false; - MDLL_KeyValue(pent, &pkvd); - - pkvd.szClassName = (char *)STRING(pent->v.classname); - pkvd.szKeyName = "pwupduration"; // duration - pkvd.szValue = "60"; - pkvd.fHandled = false; - MDLL_KeyValue(pent, &pkvd); - -/* - pkvd.szClassName = (char *)STRING(pent->v.classname); - pkvd.szKeyName = "message"; - pkvd.szValue = ""; - pMDLL_KeyValue(pEntity, &pkvd); -*/ - cell *vInput = MF_GetAmxAddr(amx,params[2]); - - float fNewX = *(float *)((void *)&vInput[0]); - float fNewY = *(float *)((void *)&vInput[1]); - float fNewZ = *(float *)((void *)&vInput[2]); - - vec3_t vNewValue = vec3_t(fNewX, fNewY, fNewZ); - - MDLL_Spawn(pent); - pent->v.origin = vNewValue; - - return ENTINDEX(pent); -} - -// create_pwup -> !wait! -> give_pwup -static cell AMX_NATIVE_CALL give_pwup(AMX *amx, cell *params) -{ - - edict_t* pent = INDEXENT(params[2]); - if ( FNullEnt( pent ) || strcmp("ts_powerup",STRING(pent->v.classname))!=0 ) - { - return 0; - } - - int id = params[1]; - CHECK_PLAYER(id); - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - if ( !pPlayer->IsAlive() ) - { - REMOVE_ENTITY(pent); - return 0; - } - - pent->v.origin = pPlayer->pEdict->v.origin; - - MDLL_Touch(pent, pPlayer->pEdict); - - REMOVE_ENTITY(pent); - - return 1; - -} - -static cell AMX_NATIVE_CALL get_maxweapons(AMX *amx, cell *params) -{ - return TSMAX_WEAPONS; -} - -static cell AMX_NATIVE_CALL is_custom(AMX *amx, cell *params) -{ - int weapon = params[1]; - if ( weapon < TSMAX_WEAPONS-TSMAX_CUSTOMWPNS ) - { - return 0; - } - return 1; -} - -// set_fuattack(Float:time,Float:damage) -static cell AMX_NATIVE_CALL set_fuattack(AMX *amx, cell *params) -{ - int id = params[1]; - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - CHECK_PLAYER(id); - - pPlayer->SetOffsetFloat(454,amx_ctof(params[2]) ); - pPlayer->SetOffsetFloat(455,amx_ctof(params[3]) ); - - return 1; -} - -static cell AMX_NATIVE_CALL has_superjump(AMX *amx, cell *params) -{ - - int id = params[1]; - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - CHECK_PLAYER(id); - - int val3 = pPlayer->GetOffsetInt(433); - - if(val3 & 0x01000000) return 1; - - return 0; -} - -static cell AMX_NATIVE_CALL has_fupowerup(AMX *amx, cell *params) -{ - - int id = params[1]; - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - CHECK_PLAYER(id); - - int val3 = pPlayer->GetOffsetInt(433); - - if(val3 & 65536) return 1; - - return 0; -} - -static cell AMX_NATIVE_CALL get_usertime(AMX *amx, cell *params) -{ - int id = params[1]; - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - CHECK_PLAYER(id); - - return pPlayer->GetCurrentTime(); - -} - -static cell AMX_NATIVE_CALL set_usertime(AMX *amx, cell *params) -{ - int id = params[1]; - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - CHECK_PLAYER(id); - - pPlayer->SetCurrentTime(amx_ctof(params[2])); - return 1; -} - -static cell AMX_NATIVE_CALL get_consecutive_frags(AMX *amx, cell *params) -{ - int id = params[1]; - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - CHECK_PLAYER(id); - - return pPlayer->GetOffsetInt(433); -} - -static cell AMX_NATIVE_CALL set_consecutive_frags(AMX *amx, cell *params) -{ - int id = params[1]; - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - CHECK_PLAYER(id); - - pPlayer->SetOffsetInt(433,params[2]); - return 1; -} - -static cell AMX_NATIVE_CALL set_user_message(AMX *amx, cell *params) -{ - int id = params[1]; - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - CHECK_PLAYER(id); - - int message = params[2]; - if(message < 1 || message > 16) - { - MF_LogError(amx, AMX_ERR_NATIVE, "Invalid Message ID: %i",message ); - return 0; - } - - int val3 = pPlayer->GetOffsetInt(433); - - pPlayer->SetOffsetInt(433, (val3 & ~15)^message); - return 1; -} - -static cell AMX_NATIVE_CALL get_user_message(AMX *amx, cell *params) -{ - int id = params[1]; - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - CHECK_PLAYER(id); - - int val3 = pPlayer->GetOffsetInt(433); - - return (val3 & 15); -} - -static cell AMX_NATIVE_CALL set_bullettrail(AMX *amx, cell *params) -{ - - int id = params[1]; - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - CHECK_PLAYER(id); - - long bullettrail = params[2] * 256; - - pPlayer->SetOffsetInt(87,bullettrail); - return 1; -} - -static cell AMX_NATIVE_CALL set_fake_slowmo(AMX *amx, cell *params) -{ - - int id = params[1]; - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - CHECK_PLAYER(id); - - float time = amx_ctof(params[2]); - - pPlayer->SetOffsetInt(423,TSPWUP_SLOWMO); - - float prev = pPlayer->GetCurrentTime(); - - pPlayer->SetOffsetFloat(425,prev+time); - - return 1; -} - -static cell AMX_NATIVE_CALL set_fake_slowpause(AMX *amx, cell *params) -{ - - int id = params[1]; - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - CHECK_PLAYER(id); - - float time = amx_ctof(params[2]); - - pPlayer->SetOffsetInt(423,TSPWUP_SLOWPAUSE); - - float prev = pPlayer->GetCurrentTime(); - - pPlayer->SetOffsetFloat(425,prev+time); - - return 1; -} - -static cell AMX_NATIVE_CALL is_in_slowmo(AMX *amx, cell *params) -{ - - int id = params[1]; - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - CHECK_PLAYER(id); - - if(pPlayer->GetOffsetFloat(89) ) - return pPlayer->GetOffsetFloat(425); - - return 0; -} - -static cell AMX_NATIVE_CALL set_speed(AMX *amx, cell *params) -{ - - int id = params[1]; - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - CHECK_PLAYER(id); - - pPlayer->SetOffsetFloat(89, amx_ctof(params[2]) ); - pPlayer->SetOffsetFloat(90, amx_ctof(params[3]) ); - pPlayer->SetOffsetFloat(85, amx_ctof(params[3]) ); - pPlayer->SetOffsetFloat(425,amx_ctof(params[4]) ); - - return 1; -} - -static cell AMX_NATIVE_CALL set_physics_speed(AMX *amx, cell *params) -{ - - int id = params[1]; - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - CHECK_PLAYER(id); - - pPlayer->SetOffsetFloat(86,amx_ctof(params[2])); - - return 1; -} - -static cell AMX_NATIVE_CALL is_running_powerup(AMX *amx, cell *params) -{ - - int id = params[1]; - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - CHECK_PLAYER(id); - - return pPlayer->GetOffsetInt(423); -} - -static cell AMX_NATIVE_CALL force_powerup_run(AMX *amx, cell *params) -{ - - int id = params[1]; - CPlayer *pPlayer = GET_PLAYER_POINTER_I(id); - - CHECK_PLAYER(id); - - pPlayer->SetOffsetInt(423,params[2]); - return 1; -} - - -AMX_NATIVE_INFO base_Natives[] = { - - { "xmod_get_wpnname", get_weapon_name }, - { "xmod_get_wpnlogname", get_weapon_logname }, - { "xmod_is_melee_wpn", is_melee }, - { "xmod_get_maxweapons", get_maxweapons }, - { "xmod_is_custom_wpn", is_custom }, - - //**************************************** - - { "ts_giveweapon",give_weapon }, - { "ts_createpwup",create_pwup }, - { "ts_givepwup",give_pwup }, - - { "get_weaponname", get_weapon_name }, - { "get_user_weapon", get_user_weapon }, - - { "ts_wpnlogtoname", wpnlog_to_name }, - { "ts_wpnlogtoid", wpnlog_to_id }, - { "ts_getuserwpn", ts_get_user_weapon }, - - //**************************************** - - { "ts_getuserstate", get_user_state }, - - { "ts_getusercash", get_user_cash }, - { "ts_setusercash", set_user_cash }, - - { "ts_getuserslots", get_user_slots }, - { "ts_setuserslots", set_user_slots }, - - { "ts_getusertime",get_usertime }, - { "ts_setusertime",set_usertime}, - - { "ts_getuserspace", get_user_slots }, - { "ts_getuserpwup",get_user_pwup }, - { "ts_getuseritems",get_user_items }, - - { "ts_getkillingstreak",get_killingStreak }, - { "ts_getuserlastfrag",get_lastFrag }, - { "ts_getuserkillflags",get_killflags }, - - //**************************************** - - { "ts_set_fuattack", set_fuattack }, - { "ts_set_message", set_user_message }, - { "ts_get_message", get_user_message }, - - { "ts_has_superjump", has_superjump }, - { "ts_has_fupowerup", has_fupowerup }, - - { "ts_get_cons_frags", get_consecutive_frags }, - { "ts_set_cons_frags", set_consecutive_frags }, - - //**************************************** - - { "ts_set_bullettrail",set_bullettrail }, - { "ts_set_fakeslowmo",set_fake_slowmo }, - { "ts_set_fakeslowpause",set_fake_slowpause }, - { "ts_is_in_slowmo",is_in_slowmo }, - { "ts_set_speed",set_speed }, - { "ts_set_physics_speed",set_physics_speed }, - - //**************************************** - - { "ts_is_running_powerup",is_running_powerup}, - { "ts_force_run_powerup",force_powerup_run}, - - //"*******************" - { NULL, NULL } -}; - -#endif \ No newline at end of file diff --git a/dlls/ts/tsfun/CPlayer.cpp b/dlls/ts/tsfun/CPlayer.cpp deleted file mode 100755 index dbea5711..00000000 --- a/dlls/ts/tsfun/CPlayer.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2003-2004 Lukasz Wlasinski - * - * This file is part of TS XMod. - * - * TS XMod is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * TS XMod is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with TS XMod; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, the author gives permission to - * link the code of this program with the Half-Life Game Engine ("HL - * Engine") and Modified Game Libraries ("MODs") developed by Valve, - * L.L.C ("Valve"). You must obey the GNU General Public License in all - * respects for all of the code used other than the HL Engine and MODs - * from Valve. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If - * you do not wish to do so, delete this exception statement from your - * version. - * - */ - -#include "CPlayer.h" -#include "tsfun.h" - -// ***************************************************** -// class CPlayer -// ***************************************************** - -void CPlayer::Disconnect() -{ - ingame = false; -} -void CPlayer::PutInServer() -{ - ingame = true; - - killingSpree = 0; - items = 0; - lastFrag = 0; - lastKill = 0.0; - is_specialist = 0; - set_454 = -1.0; - set_455 = -1.0; - set_423 = -1; - - //debug - frags = 0; - -} -void CPlayer::Connect( const char* ippp ) -{ - strcpy(ip,ippp); -} - -void CPlayer::Init( int pi, edict_t* pe ) -{ - pEdict = pe; - index = pi; - current = 0; - ingame = true; -} - -long CPlayer::GetOffsetInt(long off) -{ -#ifdef __linux__ - off += 5; -#endif - - return *((int *)pEdict->pvPrivateData + off); -} - -float CPlayer::GetOffsetFloat(long off) -{ -#ifdef __linux__ - off += 5; -#endif - - return *((float *)pEdict->pvPrivateData + off); -} - - -void CPlayer::SetOffsetInt(long off, long set) -{ -#ifdef __linux__ - off += 5; -#endif - - *((int *)pEdict->pvPrivateData + off) = set; -} - -void CPlayer::SetOffsetFloat(long off, float set) -{ -#ifdef __linux__ - off += 5; -#endif - - *((float *)pEdict->pvPrivateData + off) = set; -} \ No newline at end of file diff --git a/dlls/ts/tsfun/CPlayer.h b/dlls/ts/tsfun/CPlayer.h deleted file mode 100755 index 014d9d5e..00000000 --- a/dlls/ts/tsfun/CPlayer.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2003-2004 Lukasz Wlasinski - * - * This file is part of TS XMod. - * - * TS XMod is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * TS XMod is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with TS XMod; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, the author gives permission to - * link the code of this program with the Half-Life Game Engine ("HL - * Engine") and Modified Game Libraries ("MODs") developed by Valve, - * L.L.C ("Valve"). You must obey the GNU General Public License in all - * respects for all of the code used other than the HL Engine and MODs - * from Valve. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If - * you do not wish to do so, delete this exception statement from your - * version. - * - */ - -#ifndef CMISC_H -#define CMISC_H - -#include "amxxmodule.h" - -#define TSMAX_CUSTOMWPNS 5 -#define TSMAX_WEAPONS 39 + TSMAX_CUSTOMWPNS - - -#ifndef __linux__ -#define TSKNIFE_OFFSET 31 // owner offset in knife entity -#else -#define TSKNIFE_OFFSET 36 -#endif - -#define TSPWUP_SLOWMO 1 -#define TSPWUP_INFAMMO 2 -#define TSPWUP_KUNGFU 4 -#define TSPWUP_SLOWPAUSE 8 -#define TSPWUP_DFIRERATE 16 -#define TSPWUP_SJUMP 256 - -#define TSITEM_KUNGFU 1<<0 -#define TSITEM_SUPERJUMP 1<<1 - -#define TSKF_STUNTKILL 1<<0 -#define TSKF_SLIDINGKILL 1<<1 -#define TSKF_DOUBLEKILL 1<<2 -#define TSKF_ISSPEC 1<<3 // is specialist -#define TSKF_KILLEDSPEC 1<<4 // killed specialist - -// ***************************************************** -// class CPlayer -// ***************************************************** - -struct CPlayer { - - float set_454; - float set_455; - int set_423; - - edict_t* pEdict; - char ip[32]; - int index; - int teamId; - int aiming; - int current; - - int checkstate; - int state; - int oldstate; - int PwUp; - int PwUpValue; - int items; // "stale" przedmioty , super jump i kung fu bonus - - // - int killingSpree; - int is_specialist; - int killFlags; - int lastFrag; // oblicz ostatni frag, sprawdza czy poprawna jest detekcja broni i bonusow - float lastKill; // kiedy ostatni , dla double kill - // - int frags; // suma dla kontroli ostatniego fraga, to - v.frags = lastfrag - - bool ingame; - - struct PlayerWeapon { - char* name; - int ammo; - int clip; - int mode; // burst , full auto .. - int attach; // scope ,laser - }; - - PlayerWeapon weapons[TSMAX_WEAPONS]; - PlayerWeapon attackers[33]; - PlayerWeapon victims[33]; - - void Init( int pi, edict_t* pe ); - void Connect( const char* ip ); - void PutInServer(); - void Disconnect(); - - long GetOffsetInt(long off); - float GetOffsetFloat(long off); - - void SetOffsetInt(long off,long set); - void SetOffsetFloat(long off, float set); - - inline long GetMoney() - { - return GetOffsetInt(301); - } - - inline void SetMoney(long money) - { - SetOffsetInt(301,money); - } - - inline float GetCurrentTime() - { - return GetOffsetFloat(444); - } - - inline void SetCurrentTime(float time) - { - SetOffsetFloat(444,time); - } - - inline long GetSlots() - { - return GetOffsetInt(304); - } - - inline void SetSlots(long slots) - { - SetOffsetInt(304,slots); - } - - inline bool IsBot() - { - const char* auth= (*g_engfuncs.pfnGetPlayerAuthId)(pEdict); - return ( auth && !strcmp( auth , "BOT" ) ); - } - inline bool IsAlive() - { - return ((pEdict->v.deadflag==DEAD_NO)&&(pEdict->v.health>0)); - } -}; - -#endif // CMISC_H - diff --git a/dlls/ts/tsfun/moduleconfig.h b/dlls/ts/tsfun/moduleconfig.h index b44ccdaf..904fe780 100755 --- a/dlls/ts/tsfun/moduleconfig.h +++ b/dlls/ts/tsfun/moduleconfig.h @@ -4,9 +4,9 @@ #define __MODULECONFIG_H__ // Module info -#define MODULE_NAME "TSFun" +#define MODULE_NAME "TSFun Wrapper" #define MODULE_VERSION "1.65" -#define MODULE_AUTHOR "Twilight Suzuka" +#define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_URL "http://www.amxmodx.org" #define MODULE_LOGTAG "TSFUN" // If you want the module not to be reloaded on mapchange, remove / comment out the next line @@ -19,7 +19,7 @@ #endif // __DATE__ // metamod plugin? -#define USE_METAMOD +// #define USE_METAMOD // - AMXX Init functions // Also consider using FN_META_* @@ -27,12 +27,12 @@ //#define FN_AMXX_QUERY OnAmxxQuery // AMXX attach // Do native functions init here (MF_AddNatives) -#define FN_AMXX_ATTACH OnAmxxAttach +// #define FN_AMXX_ATTACH OnAmxxAttach // AMXX dettach //#define FN_AMXX_DETACH OnAmxxDetach // All plugins loaded // Do forward functions init here (MF_RegisterForward) -#define FN_AMXX_PLUGINSLOADED OnPluginsLoaded +// #define FN_AMXX_PLUGINSLOADED OnPluginsLoaded /**** METAMOD ****/ // If your module doesn't use metamod, you may close the file now :) @@ -69,13 +69,13 @@ // #define FN_RestoreGlobalState RestoreGlobalState /* pfnRestoreGlobalState() */ // #define FN_ResetGlobalState ResetGlobalState /* pfnResetGlobalState() */ // #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_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_ClientUserInfoChanged ClientUserInfoChanged /* pfnClientUserInfoChanged() (wd) Client has updated their setinfo structure */ -//#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_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_PlayerPreThink PlayerPreThink /* pfnPlayerPreThink() */ // #define FN_PlayerPostThink PlayerPostThink /* pfnPlayerPostThink() */ // #define FN_StartFrame StartFrame /* pfnStartFrame() */ @@ -120,15 +120,15 @@ // #define FN_SaveGlobalState_Post SaveGlobalState_Post // #define FN_RestoreGlobalState_Post RestoreGlobalState_Post // #define FN_ResetGlobalState_Post ResetGlobalState_Post -//#define FN_ClientConnect_Post ClientConnect_Post +// #define FN_ClientConnect_Post ClientConnect_Post // #define FN_ClientDisconnect_Post ClientDisconnect_Post // #define FN_ClientKill_Post ClientKill_Post -//#define FN_ClientPutInServer_Post ClientPutInServer_Post +// #define FN_ClientPutInServer_Post ClientPutInServer_Post // #define FN_ClientCommand_Post ClientCommand_Post -//#define FN_ClientUserInfoChanged_Post ClientUserInfoChanged_Post -#define FN_ServerActivate_Post ServerActivate_Post +// #define FN_ClientUserInfoChanged_Post ClientUserInfoChanged_Post +// #define FN_ServerActivate_Post ServerActivate_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_StartFrame_Post StartFrame_Post // #define FN_ParmsNewLevel_Post ParmsNewLevel_Post @@ -334,7 +334,7 @@ // #define FN_SetOrigin_Post SetOrigin_Post // #define FN_EmitSound_Post EmitSound_Post // #define FN_EmitAmbientSound_Post EmitAmbientSound_Post -//#define FN_TraceLine_Post TraceLine_Post +// #define FN_TraceLine_Post TraceLine_Post // #define FN_TraceToss_Post TraceToss_Post // #define FN_TraceMonsterHull_Post TraceMonsterHull_Post // #define FN_TraceHull_Post TraceHull_Post @@ -349,16 +349,16 @@ // #define FN_LightStyle_Post LightStyle_Post // #define FN_DecalIndex_Post DecalIndex_Post // #define FN_PointContents_Post PointContents_Post -#define FN_MessageBegin_Post MessageBegin_Post -#define FN_MessageEnd_Post MessageEnd_Post -#define FN_WriteByte_Post WriteByte_Post -#define FN_WriteChar_Post WriteChar_Post -#define FN_WriteShort_Post WriteShort_Post -#define FN_WriteLong_Post WriteLong_Post -#define FN_WriteAngle_Post WriteAngle_Post -#define FN_WriteCoord_Post WriteCoord_Post -#define FN_WriteString_Post WriteString_Post -#define FN_WriteEntity_Post WriteEntity_Post +// #define FN_MessageBegin_Post MessageBegin_Post +// #define FN_MessageEnd_Post MessageEnd_Post +// #define FN_WriteByte_Post WriteByte_Post +// #define FN_WriteChar_Post WriteChar_Post +// #define FN_WriteShort_Post WriteShort_Post +// #define FN_WriteLong_Post WriteLong_Post +// #define FN_WriteAngle_Post WriteAngle_Post +// #define FN_WriteCoord_Post WriteCoord_Post +// #define FN_WriteString_Post WriteString_Post +// #define FN_WriteEntity_Post WriteEntity_Post // #define FN_CVarRegister_Post CVarRegister_Post // #define FN_CVarGetFloat_Post CVarGetFloat_Post // #define FN_CVarGetString_Post CVarGetString_Post @@ -378,7 +378,7 @@ // #define FN_PEntityOfEntIndex_Post PEntityOfEntIndex_Post // #define FN_FindEntityByVars_Post FindEntityByVars_Post // #define FN_GetModelPtr_Post GetModelPtr_Post -#define FN_RegUserMsg_Post RegUserMsg_Post +// #define FN_RegUserMsg_Post RegUserMsg_Post // #define FN_AnimationAutomove_Post AnimationAutomove_Post // #define FN_GetBonePosition_Post GetBonePosition_Post // #define FN_FunctionFromName_Post FunctionFromName_Post diff --git a/dlls/ts/tsfun/tsfun.cpp b/dlls/ts/tsfun/tsfun.cpp deleted file mode 100755 index 7f6f8dd8..00000000 --- a/dlls/ts/tsfun/tsfun.cpp +++ /dev/null @@ -1,311 +0,0 @@ -/* - * Copyright (c) 2003-2004 Lukasz Wlasinski - * - * This file is part of TS XMod. - * - * TS XMod is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * TS XMod is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with TS XMod; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, the author gives permission to - * link the code of this program with the Half-Life Game Engine ("HL - * Engine") and Modified Game Libraries ("MODs") developed by Valve, - * L.L.C ("Valve"). You must obey the GNU General Public License in all - * respects for all of the code used other than the HL Engine and MODs - * from Valve. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If - * you do not wish to do so, delete this exception statement from your - * version. - * - */ - -#include "tsfun.h" -#include "CNatives.h" - -funEventCall modMsgsEnd[MAX_REG_MSGS]; -funEventCall modMsgs[MAX_REG_MSGS]; -void (*function)(void*); -void (*endfunction)(void*); -CPlayer* mPlayer; -int mPlayerIndex; -int mState; -CPlayer players[33]; - -int gKnifeOffset; - -int gmsgResetHUD; -int gmsgWeaponInfo; -int gmsgClipInfo; -int gmsgScoreInfo; -int gmsgTSHealth; - -int gmsgWStatus; -int gmsgTSCash; -int gmsgTSState; -int gmsgPwUp; - -struct sUserMsg { - const char* name; - int* id; - funEventCall func; - bool endmsg; - -} g_user_msg[] = { - { "ResetHUD",&gmsgResetHUD,Client_ResetHUD_End,true }, - { "WeaponInfo",&gmsgWeaponInfo,Client_WeaponInfo,false }, - { "ClipInfo",&gmsgClipInfo,Client_ClipInfo,false }, - { "ScoreInfo",&gmsgScoreInfo,Client_ScoreInfo,false }, - - { "TSHealth",&gmsgTSHealth,Client_TSHealth_End,true }, - { "TSState",&gmsgTSState,Client_TSState,false }, - { "WStatus",&gmsgWStatus,Client_WStatus,false }, - { "PwUp",&gmsgPwUp,Client_PwUp,false}, - - { 0,0,0,false } -}; - -const char* get_localinfo( const char* name , const char* def = 0 ) -{ - const char* b = LOCALINFO( (char*)name ); - if (((b==0)||(*b==0)) && def ) - SET_LOCALINFO((char*)name,(char*)(b = def) ); - return b; -} - -int Powerup = -1; -int KungFoo = -1; //-1 is an invalid forward so initiate this to that -//int Death = -1; -//int Damage = -1; -int Stunt = -1; - -void OnPluginsLoaded() -{ - //mymodule_Touch - the forward name - //ET_IGNORE - means PLUGIN_HANDLED will be ignored (other option is ET_STOP) - //FP_CELL - first parameter is a normal cell - //FP_CELL - second parameter is a normal cell - //FP_DONE - that's the end of the parameter descriptions - KungFoo = MF_RegisterForward("Melee_Attack", ET_STOP, FP_CELL, FP_FLOAT,FP_FLOAT, FP_DONE); - //Death = MF_RegisterForward("client_death", ET_IGNORE, FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_CELL, FP_DONE); - //Damage = MF_RegisterForward("client_damage", ET_IGNORE, FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_CELL, FP_DONE); - Powerup = MF_RegisterForward("client_powerup", ET_IGNORE, FP_CELL, FP_CELL, FP_DONE); - Stunt = MF_RegisterForward("client_stunt", ET_IGNORE, FP_CELL, FP_CELL, FP_DONE); -} - -void check_powerup(edict_s *player) -{ - CPlayer *pPlayer = GET_PLAYER_POINTER(player); - int offset1 = 423; - -#ifdef __linux__ - offset1 += 5; -#endif - - int id = ENTINDEX(player); - int val3 = *((int *)player->pvPrivateData + offset1); - - if(pPlayer->set_423 == -1) - { - pPlayer->set_423 = val3; - return; - } - else if(pPlayer->set_423 != val3) MF_ExecuteForward(Powerup, id,val3); -} - -void check_kungfoo(edict_s *player) -{ - CPlayer *pPlayer = GET_PLAYER_POINTER(player); - int offset1 = 454; - int offset2 = 455; - -#ifdef __linux__ - offset1 += 5; - offset2 += 5; -#endif - - int id = ENTINDEX(player); - float val4 = *((float *)player->pvPrivateData + offset1); - float val5 = *((float *)player->pvPrivateData + offset2); - - if(pPlayer->set_454 == -1.0) - { - pPlayer->set_454 = val4; - pPlayer->set_455 = val5; - return; - } - else - { - if(pPlayer->set_454 != val4 || pPlayer->set_455 != val5) - { - int check = MF_ExecuteForward(KungFoo, id,val4,val5); - if(check) - { - *((float *)player->pvPrivateData + offset1) = 0.0; - *((float *)player->pvPrivateData + offset2) = 0.0; - - pPlayer->set_454 = -1.0; - pPlayer->set_455 = -1.0; - } - } - } -} - -void check_stunts(edict_s *player) -{ - CPlayer *pPlayer = GET_PLAYER_POINTER(player); - - if(pPlayer->checkstate == 0) return; - - int stunttype; - int newstate = pPlayer->state; - int oldstate = pPlayer->oldstate; - - if(newstate == 0) stunttype = STUNT_NONE; - else if(newstate == 2) stunttype = STUNT_DIVE; - else if(oldstate == 2) stunttype = STUNT_GETUP; - else if( pPlayer->GetOffsetInt(158) == 1) stunttype = STUNT_ROLL; - else if( pPlayer->GetOffsetInt(27) == 1 ) stunttype = STUNT_DUCK; - else stunttype = STUNT_FLIP; - - pPlayer->checkstate = 0; - - MF_ExecuteForward(Stunt,pPlayer->index,stunttype); -} - -void PlayerPreThink_Post(edict_s *player) -{ - check_powerup(player); - check_kungfoo(player); - check_stunts(player); - RETURN_META(MRES_IGNORED); -} - - -void MessageBegin_Post(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed) { - if (ed) - { - mPlayerIndex = ENTINDEX(ed); - mPlayer = GET_PLAYER_POINTER_I(mPlayerIndex); - } - else - { - - mPlayerIndex = 0; - mPlayer = NULL; - } - mState = 0; - if ( msg_type < 0 || msg_type >= MAX_REG_MSGS ) - msg_type = 0; - function=modMsgs[msg_type]; - endfunction=modMsgsEnd[msg_type]; - RETURN_META(MRES_IGNORED); -} - -void MessageEnd_Post(void) { - if (endfunction) (*endfunction)(NULL); - RETURN_META(MRES_IGNORED); -} - -void WriteByte_Post(int iValue) { - if (function) (*function)((void *)&iValue); - RETURN_META(MRES_IGNORED); -} - -void WriteChar_Post(int iValue) { - if (function) (*function)((void *)&iValue); - RETURN_META(MRES_IGNORED); -} - -void WriteShort_Post(int iValue) { - if (function) (*function)((void *)&iValue); - RETURN_META(MRES_IGNORED); -} - -void WriteLong_Post(int iValue) { - if (function) (*function)((void *)&iValue); - RETURN_META(MRES_IGNORED); -} - -void WriteAngle_Post(float flValue) { - if (function) (*function)((void *)&flValue); - RETURN_META(MRES_IGNORED); -} - -void WriteCoord_Post(float flValue) { - if (function) (*function)((void *)&flValue); - RETURN_META(MRES_IGNORED); -} - -void WriteString_Post(const char *sz) { - if (function) (*function)((void *)sz); - RETURN_META(MRES_IGNORED); -} - -void WriteEntity_Post(int iValue) { - if (function) (*function)((void *)&iValue); - RETURN_META(MRES_IGNORED); -} - -int RegUserMsg_Post(const char *pszName, int iSize) -{ - for (int i = 0; g_user_msg[ i ].name; ++i ) - { - if ( !*g_user_msg[i].id && strcmp( g_user_msg[ i ].name , pszName ) == 0 ) - { - int id = META_RESULT_ORIG_RET( int ); - - *g_user_msg[ i ].id = id; - - if ( g_user_msg[ i ].endmsg ) - modMsgsEnd[ id ] = g_user_msg[ i ].func; - - else - modMsgs[ id ] = g_user_msg[ i ].func; - - break; - } - } - - RETURN_META_VALUE(MRES_IGNORED, 0); -} - -void ServerActivate_Post( edict_t *pEdictList, int edictCount, int clientMax ) -{ - for( int i = 1; i <= gpGlobals->maxClients; ++i ) - GET_PLAYER_POINTER_I(i)->Init( i , pEdictList + i ); - - RETURN_META(MRES_IGNORED); -} - -void ServerDeactivate() -{ - int i; - for(i = 1;i<=gpGlobals->maxClients; ++i){ - CPlayer *pPlayer = GET_PLAYER_POINTER_I(i); - pPlayer->Disconnect(); - } - - // clear custom weapons info - for ( i=TSMAX_WEAPONS-TSMAX_CUSTOMWPNS;i gpGlobals->maxClients) { \ - MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \ - return 0; \ - } else { \ - if (!MF_IsPlayerIngame(x) || FNullEnt(MF_GetPlayerEdict(x))) { \ - MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", x); \ - return 0; \ - } \ - } diff --git a/dlls/ts/tsfun/tsfun.vcproj b/dlls/ts/tsfun/tsfun.vcproj index c9a5a995..51b64e39 100755 --- a/dlls/ts/tsfun/tsfun.vcproj +++ b/dlls/ts/tsfun/tsfun.vcproj @@ -160,74 +160,6 @@ UsePrecompiledHeader="0"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -