Class UPlayer : UTPlayer { Default { Player.StartItem "Automag"; Player.StartItem "DispersionPistol"; Player.StartItem "UMiniAmmo", 30; } // Have to modify the give cheat to handle UT armor override void CheatGive( String name, int amount ) { if ( PlayerNumber() != consoleplayer ) A_Log(String.Format("%s is a cheater: give %s\n",player.GetUserName(),name)); if ( !player.mo || (player.health <= 0) ) return; int giveall = ALL_NO; if ( name ~== "all" ) giveall = ALL_YES; else if (name ~== "everything") giveall = ALL_YESYES; if ( name ~== "health" ) { if ( amount > 0 ) { health += amount; player.health = health; } else player.health = health = GetMaxHealth(true); } if ( giveall || (name ~== "backpack") ) { // Select the correct type of backpack based on the game let type = (class)(gameinfo.backpacktype); if ( type ) GiveInventory(type,1,true); if ( !giveall ) return; } if ( giveall || (name ~== "ammo") ) { // Find every unique type of ammo. Give it to the player if // he doesn't have it already, and set each to its maximum. for ( int i=0; i)(AllActorClasses[i]); if ( !type || (type.GetParentClass() != "Ammo") ) continue; // Only give if it's for a valid weapon, unless using "give everything" bool isvalid = false; for ( int j=0; j)(AllActorClasses[j]); if ( !type2 ) continue; let rep = GetReplacement(type2); if ( (rep != type2) && !(rep is "DehackedPickup") ) continue; readonly weap = GetDefaultByType(type2); if ( !player.weapons.LocateWeapon(type2) || (weap.bCheatNotWeapon && (giveall != ALL_YESYES)) ) continue; if ( (weap.AmmoType1 == type) || (weap.AmmoType2 == type) ) { isvalid = true; break; } } if ( !isvalid ) continue; let ammoitem = FindInventory(type); if ( !ammoitem ) { ammoitem = Inventory(Spawn(type)); ammoitem.AttachToOwner(self); ammoitem.Amount = ammoitem.MaxAmount; } else if ( ammoitem.Amount < ammoitem.MaxAmount ) ammoitem.Amount = ammoitem.MaxAmount; } if ( !giveall ) return; } if ( giveall || (name ~== "armor") ) { // Doomreal gives the player all subclasses of UnrealArmor for ( int i=0; i)(AllActorClasses[i]); if ( !type || (type == "Weapon") ) continue; // Don't give replaced weapons unless the replacement was done by Dehacked. let rep = GetReplacement(type); if ( (rep == type) || (rep is "DehackedPickup") ) { // Give the weapon only if it is set in a weapon slot. if ( !player.weapons.LocateWeapon(type) ) continue; readonly def = GetDefaultByType(type); if ( (giveall == ALL_YESYES) || !def.bCheatNotWeapon ) GiveInventory(type,1,true); } } player.PendingWeapon = savedpending; if ( !giveall ) return; } if ( giveall || (name ~== "artifacts") ) { for ( int i=0; i)(AllActorClasses[i]); if ( !type ) continue; let def = GetDefaultByType (type); if ( def.Icon.isValid() && (def.MaxAmount > 1) && !(type is "PuzzleItem") && !(type is "Powerup") && !(type is "Ammo") && !(type is "Armor")) { // Do not give replaced items unless using "give everything" if ( (giveall == ALL_YESYES) || (GetReplacement(type) == type) ) GiveInventory(type,(amount<=0)?def.MaxAmount:amount,true); } } if ( !giveall ) return; } if ( giveall || (name ~== "puzzlepieces") ) { for ( int i=0; i)(AllActorClasses[i]); if ( !type ) continue; let def = GetDefaultByType(type); if ( !def.Icon.isValid() ) continue; // Do not give replaced items unless using "give everything" if ( (giveall == ALL_YESYES) || (GetReplacement(type) == type) ) GiveInventory(type,(amount<=0)?def.MaxAmount:amount,true); } if ( !giveall ) return; } if ( giveall ) return; let type = name; if ( !type ) { if ( PlayerNumber() == consoleplayer ) A_Log(String.Format("Unknown item \"%s\"\n",name)); } else GiveInventory(type,amount,true); } override void PlayAttacking() { // no animation if crouched if ( (player && (player.mo == self)) && (player.crouchdir == -1) ) return; // check weapon type let psp = player.FindPSprite(PSP_WEAPON); if ( (player.ReadyWeapon is 'Stinger') && psp && psp.CurState.InStateSequence(player.ReadyWeapon.FindState("Hold")) ) { if ( !InStateSequence(CurState,FindState("MissileRep")) ) SetStateLabel("MissileRep"); } else SetStateLabel("Missile"); } } Class UFemaleArmGibber : UTGibber { bool firstgib; override void BurstGibs() { Actor a; double ang, pt; Vector3 dir; if ( !firstgib ) { firstgib = true; Actor a = Spawn("UTFemaleArm",Vec3Offset(-14*sin(angle),14*cos(angle),36)); ang = FRandom[Blod](0,360); pt = FRandom[Blod](-90,90); dir = (cos(pt)*cos(ang),cos(pt)*sin(ang),sin(-pt)); a.vel = rvel*0.6+dir*FRandom[Blod](3.0,6.0); } for ( int i=0; i20,"Death2"); #### # 0 A_JumpIf(vel.length()>10,"Death5"); #### # 0 A_Jump(256,"Death1","Death3","Death4"); Death1: #### # 3; PLD1 A 3 A_PlayerScream(); PLD1 B 3 A_NoBlocking(); PLD1 CDEFGHIJKLMNOPQRSTU 3; PLD1 V 1 A_DMFade(); Wait; Death2: #### # 3; PLD2 A 3 A_PlayerScream(); PLD2 B 3 A_NoBlocking(); PLD2 CDEFGHIJKLMNOPQ 3; PLD2 R 1 A_DMFade(); Wait; Death3: #### # 3; PLD3 A 3 A_PlayerScream(); PLD3 B 3 A_NoBlocking(); PLD3 CDEFGHIJKLMNO 3; PLD3 P 1 A_DMFade(); Wait; Death4: #### # 3; PLD4 A 3 A_PlayerScream(); PLD4 B 3 A_NoBlocking(); PLD4 CDEFGHIJKL 3; PLD4 M 1 A_DMFade(); Wait; Death5: #### # 3; PLD5 A 3 A_PlayerScream(); PLD5 B 3 A_NoBlocking(); PLD5 CDEFGHIJKLMNO 3; PLD5 P 1 A_DMFade(); Wait; Death7: #### # 0 A_ArmPop(); PLD7 A 3 A_PlayerScream(); PLD7 B 3 A_NoBlocking(); PLD7 CDEFGHIJKLMNOPQRSTUV 3; PLD7 W 1 A_DMFade(); Wait; Taunt1: #### # 5; PLT1 ABCDEFGHIJKLMNO 3; Goto Spawn+1; Taunt2: #### # 5; PLT2 ABCDEFGHIJKLMNOPQR 3; Goto Spawn+1; Taunt3: #### # 5; PLT3 ABCDEFGHIJKLMNO 3; Goto Spawn+1; Taunt4: #### # 0; Goto Spawn; } } Class UPlayerFemale1 : UPlayerFemale { Default { Player.DisplayName "$N_FEMALE1"; Player.Portrait ""; UTPlayer.VoiceType VOICE_FemaleTwo; -NOMENU; } } Class UPlayerFemale2 : UPlayerFemale { Default { Player.SoundClass "ufemale"; Player.DisplayName "$N_FEMALE2"; Player.Portrait ""; -NOMENU; } } Class UMaleTorsoGibber : UTGibber { bool firstgib; override void BurstGibs() { static const class parts[] = {"UTMaleArm","UTMaleArm","UTMaleTorso","UTHeadMale","UTHeart","UTLiver","UTStomach"}; static const double partofsy[] = {14,-14,0,0,-2,5,-3}; static const double partofsz[] = {36,36,32,48,40,32,35}; Actor a; double ang, pt; Vector3 dir; if ( !firstgib ) { firstgib = true; for ( int i=0; i<7; i++ ) { Actor a = Spawn(parts[i],Vec3Offset(-partofsy[i]*sin(angle),partofsy[i]*cos(angle),partofsz[i])); ang = FRandom[Blod](0,360); pt = FRandom[Blod](-90,90); dir = (cos(pt)*cos(ang),cos(pt)*sin(ang),sin(-pt)); a.vel = rvel*0.6+dir*FRandom[Blod](3.0,6.0); } } for ( int i=0; i20,"Death6"); #### # 0 A_JumpIf(vel.length()>10,"Death1"); #### # 0 A_Jump(256,"Death2","Death3","Death7"); Death5: #### # 0 A_TorsoPop(); PLD5 A 3 A_PlayerScream(); PLD5 B 3 A_NoBlocking(); PLD5 CDEFGHIJKLMNOPQRSTUV 3; PLD5 W 1 A_DMFade(); Wait; Death6: #### # 3; PLD6 A 3 A_PlayerScream(); PLD6 B 3 A_NoBlocking(); PLD6 CDEFGHIJKLMNOPQRSTUVWXYZ[ 3; PLD6 \ 1 A_DMFade(); Wait; Taunt1: #### # 5; PLT1 ABCDEFG 6; Goto Spawn+1; Taunt2: #### # 5; PLT2 ABCDEFGHIJKLMNOPQRSTUVWXY 3; Goto Spawn+1; Taunt3: #### # 5; PLT3 ABCDEFGHIJKLMNO 3; Goto Spawn+1; Taunt4: #### # 0; Goto Spawn; } } Class UPlayerMale1 : UPlayerMale { Default { Player.DisplayName "$N_MALE1"; Player.Portrait ""; -NOMENU; } } Class UPlayerMale2 : UPlayerMale { Default { Player.DisplayName "$N_MALE2"; Player.Portrait ""; -NOMENU; } } Class UPlayerMale3 : UPlayerMale { Default { Player.DisplayName "$N_MALE3"; Player.Portrait ""; UTPlayer.VoiceType VOICE_MaleTwo; -NOMENU; } } Class UnrealInventory : Inventory { bool bActive; // is currently activated int Charge; // for timed items int DefaultCharge; Property Charge : DefaultCharge; // Drawstuffs under HUD virtual ui void PreRender( double lbottom ) {} // Drawstuffs over HUD virtual ui void PostRender( double lbottom ) {} Default { +INVENTORY.INVBAR; UnrealInventory.Charge 0; } } Class UTeleportFog : Actor { Default { +NOBLOCKMAP; +NOTELEPORT; +NOGRAVITY; RenderStyle "Add"; } override void PostBeginPlay() { Super.PostBeginPlay(); Spawn("UTTeleportLight",pos+(0,0,16)); A_PlaySound ("misc/teleport"); } States { Spawn: TNT1 A 1; Stop; } } Class UnrealStaticHandler : StaticEventHandler { ui TextureID tex[6]; ui int mtics, cur; ui String lastmusic; ui void StartMenu() { CVar protomenu = CVar.GetCVar('stinger_introtype',players[consoleplayer]); if ( !protomenu ) return; // this can happen int proto = protomenu.GetInt(); tex[0] = TexMan.CheckForTexture("graphics/UnLogo0.png",TexMan.Type_Any); tex[1] = TexMan.CheckForTexture("graphics/UnLogo1.png",TexMan.Type_Any); tex[2] = TexMan.CheckForTexture("graphics/UnLogo2.png",TexMan.Type_Any); tex[3] = TexMan.CheckForTexture("graphics/UnBg.png",TexMan.Type_Any); tex[4] = TexMan.CheckForTexture("graphics/97Bg.png",TexMan.Type_Any); tex[5] = TexMan.CheckForTexture("graphics/95Bg.png",TexMan.Type_Any); if ( proto > 1 ) S_ChangeMusic("Unreal"); else if ( proto == 1 ) S_ChangeMusic("Unreal2"); else S_ChangeMusic("FlyBy"); cur = proto; } override void OnRegister() { // remove the UT static handler let hnd = UTStaticHandler(StaticEventHandler.Find("UTStaticHandler")); if ( hnd ) hnd.Destroy(); } override void ConsoleProcess( ConsoleEvent e ) { if ( gamestate != GS_TITLELEVEL ) return; if ( e.Name ~== "refreshmenu" ) StartMenu(); } override void PostUiTick() { if ( gamestate != GS_TITLELEVEL ) return; if ( gametic <= 0 ) StartMenu(); if ( musplaying.Name != lastmusic ) { mtics = 0; lastmusic = musplaying.Name; } else mtics++; } override void RenderUnderlay( RenderEvent e ) { if ( gamestate != GS_TITLELEVEL ) return; double ar = Screen.GetAspectRatio(); Vector2 tsize = TexMan.GetScaledSize(tex[cur+3]); double sar = tsize.x/tsize.y; Vector2 vsize; if ( sar > ar ) vsize = (tsize.y*ar,tsize.y); else if ( sar < ar ) vsize = (tsize.x,tsize.x/ar); else vsize = tsize; Screen.DrawTexture(tex[cur+3],false,(vsize.x-tsize.x)/2,(vsize.y-tsize.y)/2,DTA_VirtualWidthF,vsize.x,DTA_VirtualHeightF,vsize.y,DTA_KeepRatio,true); Screen.Dim("Black",clamp(1.-((mtics+e.FracTic)/Thinker.TICRATE)*.2,0.,1.),0,0,Screen.GetWidth(),Screen.GetHeight()); if ( menuactive ) return; tsize = TexMan.GetScaledSize(tex[cur]); sar = tsize.x/tsize.y; if ( sar > ar ) vsize = (tsize.x,tsize.x/ar); else if ( sar < ar ) vsize = (tsize.y*ar,tsize.y); else vsize = tsize; double alf = clamp(((mtics+e.FracTic)/Thinker.TICRATE)-8,0.,1.); Screen.DrawTexture(tex[cur],false,(vsize.x-tsize.x)/2,(vsize.y-tsize.y)/2,DTA_VirtualWidthF,vsize.x,DTA_VirtualHeightF,vsize.y,DTA_KeepRatio,true,DTA_Alpha,alf); } override void RenderOverlay( RenderEvent e ) { // we have to stand in for the UT handler on this function // although it doesn't make much sense yet if ( players[consoleplayer].camera.player && players[consoleplayer].camera.player.ReadyWeapon && (players[consoleplayer].camera.player.ReadyWeapon is 'UTWeapon') ) UTWeapon(players[consoleplayer].camera.player.ReadyWeapon).RenderOverlay(e); } } Class UnrealMainHandler : EventHandler { // can't detect terraindef-based damage // this is currently an engine limitation static bool, bool DetectHurtfloors() { bool foundslime = false, foundlava = false; for ( int i=0; i