Deathmatch tweaks and fixes.

This commit is contained in:
Mari the Deer 2021-06-04 18:59:04 +02:00
commit e3d2158a0a
5 changed files with 19 additions and 8 deletions

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.11b-pre r524 \cu(Fri 4 Jun 17:33:09 CEST 2021)\c-";
SWWM_SHORTVER="\cw0.9.11b-pre r524 \cu(2021-06-04 17:33:09)\c-";
SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.11b-pre r525 \cu(Fri 4 Jun 18:59:04 CEST 2021)\c-";
SWWM_SHORTVER="\cw0.9.11b-pre r525 \cu(2021-06-04 18:59:04)\c-";

View file

@ -195,8 +195,8 @@ extend Class SWWMHandler
SWWMUtility.MarkAchievement('swwm_achievement_shame',src.player);
SWWMUtility.AchievementProgressInc('swwm_progress_mega',1,src.player);
}
// no credits unless it's a counted kill or marine (that isn't friendly)
if ( e.Thing.IsFriend(src) || (!e.Thing.default.bCountKill && !(e.Thing is 'ScriptedMarine')) )
// no credits unless it's a counted kill or marine (that isn't friendly) or another player in DM
if ( e.Thing.IsFriend(src) || (!e.Thing.default.bCountKill && !(e.Thing is 'ScriptedMarine') && !(deathmatch && e.Thing.player)) )
return;
int pnum = src.PlayerNumber();
if ( level.maptime < (lastkill[pnum]+5*GameTicRate) )
@ -207,6 +207,8 @@ extend Class SWWMHandler
lastkill[pnum] = level.maptime;
// scoring
int score = min(1000,int(ceil(e.Thing.GetSpawnHealth()*.05)*10));
// player score is always the same
if ( e.Thing.player ) score = 1000;
SWWMScoreObj scr = null;
if ( src.player == players[consoleplayer] )
scr = SWWMScoreObj.Spawn(score,e.Thing.Vec3Offset(0,0,e.Thing.Height/2));
@ -315,7 +317,7 @@ extend Class SWWMHandler
}
SWWMCredits.Give(src.player,score);
if ( scr ) scr.score = score; // update final score
if ( (level.killed_monsters+1 == level.total_monsters) && !allkills )
if ( !deathmatch && (level.killed_monsters+1 == level.total_monsters) && !allkills )
{
allkills = true;
SWWMCredits.Give(src.player,1000);

View file

@ -50,7 +50,7 @@ extend Class SWWMHandler
if ( players[i].itemcount > lastitemcount[i] )
{
int score = 10*(players[i].itemcount-lastitemcount[i]);
if ( (level.total_items == level.found_items) && !allitems )
if ( !deathmatch && (level.total_items == level.found_items) && !allitems )
{
allitems = true;
Console.Printf(StringTable.Localize("$SWWM_LASTITEM"),players[i].GetUserName(),500);
@ -125,6 +125,8 @@ extend Class SWWMHandler
private void OneHundredPercentCheck()
{
// not in DM
if ( !deathmatch ) return;
if ( !mapclear && (restartmus > 0) )
{
restartmus--;

View file

@ -2024,6 +2024,9 @@ Class SWWMStatusBar : BaseStatusBar
len = fnt.StringWidth(str);
xx = int((ss.x-len)/2.);
yy = (ss.y-fnt.GetHeight()*4)/2.;
// shift down if scoreboard is shown
if ( (deathmatch && sb_deathmatch_enable && (!teamplay || sb_teamdeathmatch_enable)) || (multiplayer && sb_cooperative_enable) )
yy += ss.y/3.+fnt.GetHeight();
Screen.DrawText(fnt,Font.CR_RED,xx,yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph);
if ( multiplayer || level.AllowRespawn || sv_singleplayerrespawn || G_SkillPropertyInt(SKILLP_PlayerRespawn) )
{
@ -2034,6 +2037,9 @@ Class SWWMStatusBar : BaseStatusBar
len = fnt.StringWidth(str);
xx = int((ss.x-len)/2.);
yy = ss.y/2.;
// shift down if scoreboard is shown
if ( (deathmatch && sb_deathmatch_enable && (!teamplay || sb_teamdeathmatch_enable)) || (multiplayer && sb_cooperative_enable) )
yy += ss.y/3.;
Screen.DrawText(fnt,Font.CR_WHITE,xx,yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph);
return (1.-dimalph);
}

View file

@ -1971,7 +1971,8 @@ Class Demolitionist : PlayerPawn
if ( multiplayer || level.AllowRespawn || sv_singleplayerrespawn || G_SkillPropertyInt(SKILLP_PlayerRespawn) )
{
// standard behaviour, respawn normally
if ( (((player.cmd.buttons&BT_USE) && !player.Bot) || ((deathmatch || alwaysapplydmflags) && sv_forcerespawn && (Level.maptime >= player.respawn_time))) && !sv_norespawn )
if ( (((player.cmd.buttons&BT_USE) || ((deathmatch || alwaysapplydmflags) && sv_forcerespawn)) && !sv_norespawn)
&& ((Level.maptime >= player.respawn_time) || ((player.cmd.buttons&BT_USE) && !player.Bot)) )
{
player.cls = null;
player.playerstate = PST_REBORN;
@ -2462,7 +2463,7 @@ Class Demolitionist : PlayerPawn
int score = 100;
// last secret (this is called before counting it up, so have to subtract)
let hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
if ( (level.found_secrets == level.total_secrets-1) && (!hnd || !hnd.allsecrets) )
if ( !deathmatch && (level.found_secrets == level.total_secrets-1) && (!hnd || !hnd.allsecrets) )
{
if ( hnd ) hnd.allsecrets = true;
score = 1000;