Skip to content

Commit

Permalink
Merge pull request #158 from Die4Ever/develop v1.5.8 Beta, fix Player…
Browse files Browse the repository at this point in the history
…Login with loading older saves, HX randomized starting equipment on respawn, HX fixed reset skills

v1.5.8 Beta, fix PlayerLogin with loading older saves, HX randomized starting equipment on respawn, HX fixed reset skills
  • Loading branch information
Die4Ever authored May 9, 2021
2 parents b1011df + 3c20208 commit 0f14be6
Show file tree
Hide file tree
Showing 16 changed files with 223 additions and 41 deletions.
16 changes: 8 additions & 8 deletions DXRModules/DeusEx/Classes/DXREnemies.uc
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ function RandomizeSP(ScriptedPawn p, int percent)
p.SetupWeapon(false);
}
function GiveRandomWeapon(Pawn p, optional bool allow_dupes, optional int add_ammo)
function inventory GiveRandomWeapon(Pawn p, optional bool allow_dupes, optional int add_ammo)
{
local class<DeusExWeapon> wclass;
local Ammo a;
Expand All @@ -465,23 +465,23 @@ function GiveRandomWeapon(Pawn p, optional bool allow_dupes, optional int add_am
chance_remaining(r);
if( (!allow_dupes) && HasItem(p, wclass) )
return;
return None;
if( wclass == None ) {
l("not giving a random weapon to "$p); return;
l("not giving a random weapon to "$p); return None;
}
GiveItem( p, wclass, add_ammo );
return GiveItem( p, wclass, add_ammo );
}
function GiveRandomMeleeWeapon(Pawn p, optional bool allow_dupes)
function inventory GiveRandomMeleeWeapon(Pawn p, optional bool allow_dupes)
{
local class<Weapon> wclass;
local int i;
local float r;
if( (!allow_dupes) && HasMeleeWeapon(p))
return;
return None;
r = initchance();
for(i=0; i < ArrayCount(_randommelees); i++ ) {
Expand All @@ -490,11 +490,11 @@ function GiveRandomMeleeWeapon(Pawn p, optional bool allow_dupes)
if( (!allow_dupes) && HasItem(p, _randommelees[i].type) ) {
chance_remaining(r);
return;
return None;
}
}
GiveItem(p, wclass);
return GiveItem(p, wclass);
}
function RandomizeSize(Actor a)
Expand Down
8 changes: 5 additions & 3 deletions DXRModules/DeusEx/Classes/DXRFlags.uc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ var #var flagvarprefix int undefeatabledoors, alldoors, keyonlydoors, highlight
var #var flagvarprefix int codes_mode;

var bool flags_loaded;
var int stored_version;

replication
{
Expand Down Expand Up @@ -202,7 +203,6 @@ simulated function LoadFlags()
{
//do flags binding
local DataStorage ds;
local int stored_version;
local #var PlayerPawn p;

if( Role != ROLE_Authority ) {
Expand Down Expand Up @@ -427,6 +427,8 @@ simulated function LoadNoFlags()
SaveNoFlags();
}

stored_version = flagsversion;

#ifdef hx
// bool flags work though
if( dxr.localURL != "DX" && dxr.localURL != "DXONLY" && dxr.localURL != "00_TRAINING" ) {
Expand Down Expand Up @@ -547,7 +549,7 @@ simulated static function string VersionToString(int major, int minor, int patch
simulated static function int VersionNumber()
{
return VersionToInt(1, 5, 7);
return VersionToInt(1, 5, 8);
}
simulated static function bool VersionOlderThan(int config_version, int major, int minor, int patch)
Expand All @@ -557,7 +559,7 @@ simulated static function bool VersionOlderThan(int config_version, int major, i
simulated static function string VersionString()
{
return VersionToString(1, 5, 8) $ " Alpha";
return VersionToString(1, 5, 8) $ " Beta";
}
simulated function MaxRando()
Expand Down
2 changes: 1 addition & 1 deletion DXRModules/DeusEx/Classes/DXRKeys.uc
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ static function StaticMakeDestructible(#var Mover d)
}
if( d.bBreakable == false ) {
d.bBreakable = true;
d.minDamageThreshold = 50;
d.minDamageThreshold = 60;
d.doorStrength = 1;
}
}
Expand Down
41 changes: 30 additions & 11 deletions DXRModules/DeusEx/Classes/DXRLoadouts.uc
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,16 @@ function FirstEntry()
simulated function PlayerLogin(#var PlayerPawn p)
{
Super.PlayerLogin(p);
RandoStartingEquipment(p);
RandoStartingEquipment(p, false);
}
function AddStartingEquipment(DeusExPlayer p)
simulated function PlayerRespawn(#var PlayerPawn p)
{
Super.PlayerRespawn(p);
RandoStartingEquipment(p, true);
}
function AddStartingEquipment(DeusExPlayer p, bool bFrob)
{
local class<Inventory> iclass;
local class<Augmentation> aclass;
Expand All @@ -371,7 +377,8 @@ function AddStartingEquipment(DeusExPlayer p)
if( class<DeusExAmmo>(iclass) == None && class'DXRActorsBase'.static.HasItem(p, iclass) )
continue;
GiveItem( p, iclass );
item = GiveItem( p, iclass );
if( bFrob && item != None ) item.Frob( p, None );
}
for(i=0; i < ArrayCount(_item_sets[loadout].starting_augs); i++) {
Expand All @@ -381,7 +388,7 @@ function AddStartingEquipment(DeusExPlayer p)
}
}
function RandoStartingEquipment(DeusExPlayer player)
function RandoStartingEquipment(DeusExPlayer player, bool respawn)
{
local Inventory item, anItem;
local DXREnemies dxre;
Expand All @@ -403,7 +410,7 @@ function RandoStartingEquipment(DeusExPlayer player)
anItem = item;
item = item.Inventory;
l("RandoStartingEquipment("$player$") checking item "$anItem$", bDisplayableInv: "$anItem.bDisplayableInv);
if( ! anItem.bDisplayableInv ) continue;
if( Ammo(anItem) == None && ! anItem.bDisplayableInv ) continue;
if( #var prefix NanoKeyRing(anItem) != None ) continue;
if( dxre == None && Weapon(anItem) != None ) continue;
if( dxre == None && Ammo(anItem) != None ) continue;
Expand All @@ -412,23 +419,34 @@ function RandoStartingEquipment(DeusExPlayer player)
anItem.Destroy();
}
AddStartingEquipment(player);
AddStartingEquipment(player, respawn);
for(i=0; i < dxr.flags.equipment; i++) {
_RandoStartingEquipment(player, dxre);
_RandoStartingEquipment(player, dxre, respawn);
}
}
function _RandoStartingEquipment(DeusExPlayer player, DXREnemies dxre)
function _RandoStartingEquipment(DeusExPlayer player, DXREnemies dxre, bool bFrob)
{
local int i;
local float r;
local Inventory item;
local DeusExWeapon w;
local class<Inventory> iclass;
if(dxre != None) {
dxre.GiveRandomWeapon(player, true, 1);
dxre.GiveRandomMeleeWeapon(player);
item = dxre.GiveRandomWeapon(player, true);
if( bFrob && item != None ) item.Frob( player, None );
w = DeusExWeapon(item);
if ( w != None && (w.AmmoName != None) && (w.AmmoName != Class'AmmoNone') )
{
w.AmmoType = DeusExAmmo(GiveItem(player, w.AmmoName));
if( bFrob && w.AmmoType != None )
w.AmmoType.Frob( player, None );
}
item = dxre.GiveRandomMeleeWeapon(player);
if( bFrob && item != None ) item.Frob( player, None );
}
r = initchance();
Expand All @@ -438,7 +456,8 @@ function _RandoStartingEquipment(DeusExPlayer player, DXREnemies dxre)
}
if( iclass == None ) return;
GiveItem(player, iclass);
item = GiveItem(player, iclass);
if( bFrob && item != None ) item.Frob( player, None );
}
function SpawnItems()
Expand Down
8 changes: 1 addition & 7 deletions DXRModules/DeusEx/Classes/DXRPasswords.uc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function CheckConfig()
i++;

datacubes_rules[i].map = "11_PARIS_CATHEDRAL";
datacubes_rules[i].item_name = '11_Datacube03';// 0 and 2
datacubes_rules[i].item_name = '11_Datacube03';// DataCube0 and 2 have the same textTag
datacubes_rules[i].min_pos = vect(3587, -812, -487); //before gunther room
datacubes_rules[i].max_pos = vect(4322, -124, 74);
datacubes_rules[i].allow = false;
Expand Down Expand Up @@ -501,7 +501,6 @@ function RandoInfoDevs(int percent)
local int num, slot, numHasPass;
local int hasPass[64];

//l("RandoInfoDevs percent == "$percent);
if(percent == 0) return;

foreach AllActors(class'#var prefix InformationDevices', id)
Expand Down Expand Up @@ -752,11 +751,6 @@ simulated function bool UpdateGoal(DeusExGoal goal, string oldpassword, string n
goal.text = ReplaceText( goal.text, oldpassword, " " $ newpassword $ " ", true );//spaces around the password make it so you can double click to highlight it then copy it easily

#ifdef hx
//HXGameInfo(Level.Game).DeleteGoal(goal);
//HXGameInfo(Level.Game).AddGoal(goal.GoalName, goal.bPrimaryGoal, goal.Text);
/*foreach AllActors(class'HXPlayerPawn', p) {
p.ClientMessage("Found password: "$newpassword);
}*/
HXGameInfo(Level.Game).AddNote(goal.text, false, true, '');
#endif

Expand Down
32 changes: 32 additions & 0 deletions DXRModules/DeusEx/Classes/DXRSkills.uc
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,42 @@ function CheckConfig()
Super.CheckConfig();
}

simulated function PlayerLogin(#var PlayerPawn player)
{
local PlayerDataItem data;
Super.PlayerLogin(player);
#ifdef multiplayer
data = class'PlayerDataItem'.static.GiveItem(player);
data.SkillPointsAvail = player.SkillPointsAvail;
data.SkillPointsTotal = player.SkillPointsTotal;
#endif
}

event PreTravel()
{
local PlayerDataItem data;
local #var PlayerPawn p;
Super.PreTravel();
#ifdef multiplayer
foreach AllActors(class'#var PlayerPawn ', p) {
l("PreTravel "$p);
data = class'PlayerDataItem'.static.GiveItem(p);
data.SkillPointsAvail = p.SkillPointsAvail;
data.SkillPointsTotal = p.SkillPointsTotal;
}
#endif
}

simulated function PlayerAnyEntry(#var PlayerPawn player)
{
local PlayerDataItem data;
Super.PlayerAnyEntry(player);
RandoSkills(player.SkillSystem.FirstSkill);
#ifdef multiplayer
data = class'PlayerDataItem'.static.GiveItem(player);
player.SkillPointsAvail = data.SkillPointsAvail;
player.SkillPointsTotal = data.SkillPointsTotal;
#endif
}

simulated function RandoSkills(Skill aSkill)
Expand Down
1 change: 0 additions & 1 deletion DXRVanilla/DeusEx/Classes/MissionScript.uc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ function Timer()
if( dxr == None ) foreach AllActors(class'DXRando', dxr) break;
if( dxr == None ) return;
if( dxr.flagbase == None ) return;
log(self$".Timer() got dxr: "$dxr);

Super.Timer();
}
2 changes: 1 addition & 1 deletion DXRando/DeusEx/Classes/DXRActorsBase.uc
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ static function inventory GiveItem(Pawn p, class<Inventory> iclass, optional int
local DeusExWeapon w;
local int i;

player = DeusExPlayer(p);
player = #var PlayerPawn (p);
if( class<Ammo>(iclass) != None ) {
anItem = p.FindInventoryType(iclass);
if( anItem != None ) {
Expand Down
5 changes: 5 additions & 0 deletions DXRando/DeusEx/Classes/DXRBase.uc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ simulated function PlayerLogin(#var PlayerPawn player)
l("PlayerLogin("$player$")");
}

simulated function PlayerRespawn(#var PlayerPawn player)
{
l("PlayerRespawn("$player$")");
}

simulated function PlayerAnyEntry(#var PlayerPawn player)
{
l("PlayerAnyEntry("$player$")");
Expand Down
14 changes: 14 additions & 0 deletions DXRando/DeusEx/Classes/DXRando.uc
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,12 @@ simulated function PlayerLogin(#var PlayerPawn p)
data = class'PlayerDataItem'.static.GiveItem(p);
info("PlayerLogin("$p$") do it, p.PlayerDataItem: " $ data $", data.local_inited: "$data.local_inited);

#ifdef singleplayer
if ( flags.stored_version != 0 && flags.stored_version < class'DXRFlags'.static.VersionToInt(1,5,8) ) {
data.local_inited = true;
}
#endif

if( !data.local_inited && dxInfo.missionNumber > 0 && dxInfo.missionNumber < 99 )
{
for(i=0; i<num_modules; i++) {
Expand All @@ -377,6 +383,14 @@ simulated function PlayerLogin(#var PlayerPawn p)
}
}

simulated function PlayerRespawn(#var PlayerPawn p)
{
local int i;
for(i=0; i<num_modules; i++) {
modules[i].PlayerRespawn(p);
}
}

simulated final function int SetSeed(int s)
{
local int oldseed;
Expand Down
4 changes: 4 additions & 0 deletions DXRando/DeusEx/Classes/PlayerDataItem.uc
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
class PlayerDataItem extends Inventory;

var travel bool local_inited;
#ifdef multiplayer
var travel int SkillPointsTotal;
var travel int SkillPointsAvail;
#endif

simulated function static PlayerDataItem GiveItem(#var PlayerPawn p)
{
Expand Down
Binary file modified DeusEx.u
Binary file not shown.
2 changes: 1 addition & 1 deletion HXRandomizer.int
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[Public]
Object=(Name=HXRandomizer.HXRandoGameInfo,Class=Class,MetaClass=HX.HXGameInfo,Description="Randomizer")
Object=(Name=HXRandomizer.HXRandoGameInfo,Class=Class,MetaClass=HX.HXGameInfo,Description="Deus Ex Randomizer HX")
Binary file modified HXRandomizer.u
Binary file not shown.
Loading

0 comments on commit 0f14be6

Please sign in to comment.