Multiplayer end of support. Simplify for ease of maintenance.
This commit is contained in:
parent
1c1dcc00cb
commit
33f8e060b7
19 changed files with 32 additions and 271 deletions
|
|
@ -433,103 +433,6 @@ extend Class SWWMHandler
|
|||
players[e.Args[0]].mo.TakeInventory(item,amt);
|
||||
SWWMCredits.Give(players[e.Args[0]],e.Args[1]);
|
||||
}
|
||||
else if ( e.Name.Left(10) ~== "swwmtrade." )
|
||||
{
|
||||
Class<Inventory> item = e.Name.Mid(10);
|
||||
if ( !item ) return;
|
||||
let def = GetDefaultByType(item);
|
||||
int amt = def.Amount;
|
||||
// if it's an ammo, check the largest unit givable
|
||||
if ( item is 'Ammo' )
|
||||
{
|
||||
for ( int i=0; i<AllActorClasses.Size(); i++ )
|
||||
{
|
||||
let a = (Class<Ammo>)(AllActorClasses[i]);
|
||||
if ( !a || (a.GetParentClass() != item) || (GetDefaultByType(a).Amount < amt) ) continue;
|
||||
amt = GetDefaultByType(a).Amount;
|
||||
}
|
||||
}
|
||||
if ( item is 'MagAmmo' )
|
||||
{
|
||||
for ( int i=0; i<AllActorClasses.Size(); i++ )
|
||||
{
|
||||
let a = (Class<MagAmmo>)(AllActorClasses[i]);
|
||||
if ( !a || (a.GetParentClass() != item) || (GetDefaultByType(a).Amount < amt) ) continue;
|
||||
amt = GetDefaultByType(a).Amount;
|
||||
}
|
||||
}
|
||||
Inventory ritm = players[e.Args[1]].mo.FindInventory(item);
|
||||
if ( ritm )
|
||||
{
|
||||
int maxgive = ritm.MaxAmount-ritm.Amount;
|
||||
if ( amt > maxgive ) amt = maxgive;
|
||||
}
|
||||
else if ( amt > def.MaxAmount ) amt = def.MaxAmount;
|
||||
bool rslt = false;
|
||||
Class<Inventory> giveitem = item;
|
||||
if ( item is 'HammerspaceEmbiggener' ) giveitem = 'TradedHammerspaceEmbiggener';
|
||||
if ( (amt > 0) && players[e.Args[1]].mo.GiveInventory(giveitem,amt,true) )
|
||||
{
|
||||
// if player currently has the dual wield weapon selected, switch over
|
||||
if ( item is 'SWWMWeapon' )
|
||||
{
|
||||
let c = Weapon(players[e.Args[0]].mo.FindInventory(item));
|
||||
if ( c.SisterWeapon && (players[e.Args[0]].ReadyWeapon == c.SisterWeapon) )
|
||||
{
|
||||
players[e.Args[0]].ReadyWeapon = c;
|
||||
players[e.Args[0]].SetPSprite(PSP_WEAPON,c.FindState("Ready"));
|
||||
players[e.Args[0]].SetPSprite(PSP_WEAPON+1,null); // delete left weapon psprite
|
||||
}
|
||||
}
|
||||
// if we're trading an embiggener, we need to readjust ammo
|
||||
if ( item is 'HammerspaceEmbiggener' )
|
||||
{
|
||||
let ritm = players[e.Args[0]].mo.FindInventory(item);
|
||||
for ( Inventory i=players[e.Args[0]].mo.Inv; i; i=i.Inv )
|
||||
{
|
||||
if ( !(i is 'Ammo') ) continue;
|
||||
if ( Ammo(i).BackpackMaxAmount > 0 )
|
||||
{
|
||||
double factor = (Ammo(i).BackpackMaxAmount-i.default.MaxAmount)/double(ritm.MaxAmount);
|
||||
i.MaxAmount = int(i.default.MaxAmount+(ritm.Amount-amt)*factor);
|
||||
}
|
||||
// drop excess ammo
|
||||
int excess = i.Amount-i.MaxAmount;
|
||||
if ( excess > 0 ) i.CreateTossable(excess);
|
||||
}
|
||||
}
|
||||
if ( item is 'CandyGun' )
|
||||
{
|
||||
// see if we can take a fully loaded spare from us instead
|
||||
int n = players[e.Args[0]].mo.CountInv('CandyGunSpares');
|
||||
int na = players[e.Args[0]].mo.CountInv('CandyGunAmmo');
|
||||
if ( (n >= amt) && (na >= amt) )
|
||||
{
|
||||
players[e.Args[0]].mo.TakeInventory('CandyGunSpares',amt);
|
||||
players[e.Args[0]].mo.TakeInventory('CandyGunAmmo',amt);
|
||||
}
|
||||
else players[e.Args[0]].mo.TakeInventory('CandyGun',amt);
|
||||
}
|
||||
else players[e.Args[0]].mo.TakeInventory(item,amt);
|
||||
// add to history
|
||||
SWWMTradeHistory.RegisterSend(players[e.Args[0]],players[e.Args[1]],item,amt);
|
||||
SWWMTradeHistory.RegisterReceive(players[e.Args[1]],players[e.Args[0]],item,amt);
|
||||
// add messages
|
||||
if ( e.Args[0] == consoleplayer ) Console.Printf(StringTable.Localize("$SWWM_MSGSENT"),amt,def.GetTag(),players[e.Args[1]].GetUserName());
|
||||
if ( e.Args[1] == consoleplayer ) Console.Printf(StringTable.Localize("$SWWM_MSGRECV"),players[e.Args[0]].GetUserName(),amt,def.GetTag());
|
||||
rslt = true;
|
||||
}
|
||||
if ( e.Args[0] == consoleplayer )
|
||||
{
|
||||
let t = new("MenuTransaction");
|
||||
t.uid = e.Args[2];
|
||||
t.type = MenuTransaction.TT_ITEMSEND;
|
||||
t.result = rslt;
|
||||
t.used = item;
|
||||
t.usedup = (players[e.Args[1]].mo.CountInv(item)<=0);
|
||||
checklist.Push(t);
|
||||
}
|
||||
}
|
||||
else if ( e.Name.Left(17) ~== "swwmmarkloreread." )
|
||||
{
|
||||
let l = SWWMLoreLibrary.Find(players[e.Args[0]]);
|
||||
|
|
@ -633,14 +536,12 @@ extend Class SWWMHandler
|
|||
else if ( e.Name.Left(16) ~== "swwmremoteliner." )
|
||||
{
|
||||
if ( consoleplayer == e.Args[0] ) return;
|
||||
if ( !swwm_othervoice ) return;
|
||||
if ( swwm_mutevoice >= e.Args[1] ) return;
|
||||
players[e.Args[0]].mo.A_StartSound(e.Name.Mid(16),CHAN_DEMOVOICE,attenuation:.5);
|
||||
}
|
||||
else if ( e.Name.Left(19) ~== "swwmremotelinertxt." )
|
||||
{
|
||||
if ( consoleplayer == e.Args[0] ) return;
|
||||
if ( !swwm_othervoice ) return;
|
||||
if ( swwm_mutevoice >= e.Args[1] ) return;
|
||||
double dist = players[consoleplayer].Camera.Distance3D(players[e.Args[0]].mo);
|
||||
if ( dist < 2000 )
|
||||
|
|
|
|||
|
|
@ -92,10 +92,7 @@ Class SWWMArmor : Armor abstract
|
|||
}
|
||||
if ( !bNODRAIN ) amount -= saved;
|
||||
damage = newdamage;
|
||||
bool shouldautouse = false;
|
||||
if ( swwm_enforceautousearmor == 1 ) shouldautouse = true;
|
||||
else if ( swwm_enforceautousearmor == -1 ) shouldautouse = false;
|
||||
else shouldautouse = CVar.GetCVar('swwm_autousearmor',Owner.player).GetBool();
|
||||
bool shouldautouse = CVar.GetCVar('swwm_autousearmor',Owner.player).GetBool();
|
||||
if ( (amount <= (MaxAmount-default.Amount)) && (Owner.CountInv(parent) > 0) && shouldautouse )
|
||||
{
|
||||
if ( GetDefaultByType(parent).UseSound ) Owner.A_StartSound(GetDefaultByType(parent).UseSound,CHAN_ITEMEXTRA,CHANF_OVERLAP,.6);
|
||||
|
|
|
|||
|
|
@ -100,10 +100,7 @@ Class SWWMHealth : Inventory abstract
|
|||
return; // this damage type is ignored by the player, so it does not affect us
|
||||
if ( damageType == 'EndLevel' )
|
||||
return; // don't trigger on endlevel damage
|
||||
bool shouldautouse = false;
|
||||
if ( swwm_enforceautousehealth == 1 ) shouldautouse = true;
|
||||
else if ( swwm_enforceautousehealth == -1 ) shouldautouse = false;
|
||||
else shouldautouse = CVar.GetCVar('swwm_autousehealth',Owner.player).GetBool();
|
||||
bool shouldautouse = CVar.GetCVar('swwm_autousehealth',Owner.player).GetBool();
|
||||
if ( !shouldautouse && !bBIGPOWERUP ) return; // powerup health is always auto-used
|
||||
if ( (Owner.Health-damage <= (GetDefaultByType(giveme).MaxAmount-GetDefaultByType(giveme).Amount)) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2274,10 +2274,7 @@ Class EBarrier : Inventory
|
|||
else terrainwait++;
|
||||
if ( terrainwait <= 20 ) return;
|
||||
terrainwait = 0;
|
||||
bool shouldautouse = false;
|
||||
if ( swwm_enforceautousebarrier == 1 ) shouldautouse = true;
|
||||
else if ( swwm_enforceautousebarrier == -1 ) shouldautouse = false;
|
||||
else shouldautouse = CVar.GetCVar('swwm_autousebarrier',Owner.player).GetBool();
|
||||
bool shouldautouse = CVar.GetCVar('swwm_autousebarrier',Owner.player).GetBool();
|
||||
if ( shouldautouse ) Owner.UseInventory(self);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@ Class MenuTransaction
|
|||
enum ETransactionType
|
||||
{
|
||||
TT_ITEMUSE,
|
||||
TT_ITEMDROP,
|
||||
TT_ITEMSEND
|
||||
TT_ITEMDROP
|
||||
};
|
||||
|
||||
int uid, type;
|
||||
|
|
@ -185,7 +184,6 @@ Class DemolitionistMenu : GenericMenu
|
|||
'DemolitionistKeychainTab',
|
||||
'DemolitionistLibraryTab',
|
||||
'DemolitionistStoreTab',
|
||||
'DemolitionistTradeTab',
|
||||
'DemolitionistChatTab',
|
||||
'DemolitionistHelpTab',
|
||||
'DemolitionistSecretTab'
|
||||
|
|
|
|||
|
|
@ -401,19 +401,6 @@ Class DemolitionistMenuStoreItem : DemolitionistMenuListItem
|
|||
}
|
||||
}
|
||||
|
||||
// player item
|
||||
Class DemolitionistMenuPlayerItem : DemolitionistMenuListItem
|
||||
{
|
||||
PlayerInfo p;
|
||||
|
||||
DemolitionistMenuPlayerItem Init( DemolitionistMenu master, PlayerInfo p )
|
||||
{
|
||||
Super.Init(master,p.GetUserName());
|
||||
self.p = p;
|
||||
return self;
|
||||
}
|
||||
}
|
||||
|
||||
// chat message item
|
||||
Class DemolitionistMenuChatItem : DemolitionistMenuListItem
|
||||
{
|
||||
|
|
|
|||
|
|
@ -220,17 +220,6 @@ extend Class DemolitionistMenu
|
|||
MenuSound("menu/noinvuse");
|
||||
}
|
||||
}
|
||||
else if ( checklist[i].type == MenuTransaction.TT_ITEMSEND )
|
||||
{
|
||||
// check if trade succeeded
|
||||
if ( !hnd.checklist[j].result )
|
||||
{
|
||||
tmsg = StringTable.Localize("$SWWM_TRADEFULL");
|
||||
tmsgtic = gametic+70;
|
||||
MenuSound("menu/noinvuse");
|
||||
}
|
||||
else MenuSound("menu/demosel");
|
||||
}
|
||||
EventHandler.SendNetworkEvent("swwmcleartransaction",checklist[i].uid,consoleplayer);
|
||||
deleteme = true;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
// give 'em the stuff
|
||||
|
||||
Class DemolitionistTradeTab : DemolitionistMenuTab
|
||||
{
|
||||
override DemolitionistMenuTab Init( DemolitionistMenu master )
|
||||
{
|
||||
title = StringTable.Localize("$SWWM_TRADETAB");
|
||||
bHidden = true;
|
||||
for ( int i=0; i<MAXPLAYERS; i++ )
|
||||
{
|
||||
if ( !playeringame[i] || (i == consoleplayer) ) continue;
|
||||
if ( deathmatch && (!teamplay || (players[i].GetTeam() != players[consoleplayer].GetTeam())) ) continue;
|
||||
bHidden = false;
|
||||
break;
|
||||
}
|
||||
return Super.Init(master);
|
||||
}
|
||||
}
|
||||
|
|
@ -2795,7 +2795,6 @@ Class Demolitionist : PlayerPawn
|
|||
SWWMCredits.Give(player,score);
|
||||
SWWMScoreObj.Spawn(100,player.mo.Vec3Offset(0,0,Height/2));
|
||||
SWWMHandler.AddOneliner("keyget",2);
|
||||
if ( !swwm_sharekeys ) return;
|
||||
// share all keys in mp
|
||||
for ( int i=0; i<MAXPLAYERS; i++ )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ Class SWWMStaticHandler : StaticEventHandler
|
|||
ui Dictionary menustate; // used by Demolitionist Menu to restore old menu positions
|
||||
// title stuff
|
||||
bool titlefirst;
|
||||
// warnings
|
||||
bool mpwarned;
|
||||
|
||||
override void NewGame()
|
||||
{
|
||||
|
|
@ -42,6 +44,13 @@ Class SWWMStaticHandler : StaticEventHandler
|
|||
override void WorldTick()
|
||||
{
|
||||
maptime++;
|
||||
// in case we start late?
|
||||
if ( multiplayer && !mpwarned )
|
||||
{
|
||||
mpwarned = true;
|
||||
Console.Printf("\cgWARNING:\c- Multiplayer is no longer officially supported, desyncs and other issues may potentially happen. You are on your own.");
|
||||
S_StartSound("compat/warn",CHAN_YOUDONEFUCKEDUP,CHANF_UI|CHANF_NOPAUSE|CHANF_OVERLAP,1,ATTN_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
override void WorldLoaded( WorldEvent e )
|
||||
|
|
@ -113,6 +122,13 @@ Class SWWMStaticHandler : StaticEventHandler
|
|||
// load up the achievements
|
||||
if ( swwm_achievementstate == "" ) MigrateAchievements();
|
||||
else LoadAchievements();
|
||||
// warn: mp no longer officially maintained
|
||||
if ( multiplayer )
|
||||
{
|
||||
mpwarned = true;
|
||||
Console.Printf("\cgWARNING:\c- Multiplayer is no longer officially supported, desyncs and other issues may potentially happen. You are on your own.");
|
||||
S_StartSound("compat/warn",CHAN_YOUDONEFUCKEDUP,CHANF_UI|CHANF_NOPAUSE|CHANF_OVERLAP,1,ATTN_NONE);
|
||||
}
|
||||
// warning for unsupported
|
||||
if ( Wads.FindLump("swwmgamesupported.txt") != -1 ) return;
|
||||
Console.Printf(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue