Skip to content

Commit

Permalink
feat(wip): add HUD_Map property for FF2BaseEntity
Browse files Browse the repository at this point in the history
  • Loading branch information
Nopied committed Oct 3, 2023
1 parent 2c02fba commit f32d25c
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
42 changes: 42 additions & 0 deletions addons/sourcemod/scripting/ff2_module/player.sp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ enum
FF2BE_Assist,

FF2BE_Flags,
FF2BE_HUD_Map,

// TODO: Add FF2SpecialInfo
FF2BE_SpecialInfo,
Expand All @@ -37,6 +38,7 @@ methodmap FF2BaseEntity < ArrayList
newArray.Push(0);

newArray.Push(0);
newArray.Push(new StringMap());

return view_as<FF2BaseEntity>(newArray);
}
Expand Down Expand Up @@ -89,6 +91,46 @@ methodmap FF2BaseEntity < ArrayList
this.Set(FF2BE_Flags, flags);
}
}
property StringMap HUD_Map {
public get() {
return this.Get();
}
}

public FF2HudQueue GetHudQueue(const char[] key) {
StringMap map = this.HUD_Map;

FF2HudQueue queue = null;
map.GetValue(key, queue)

return queue;
}

public void SetHudQueue(const char[] key, FF2HudQueue queue) {
StringMap map = this.HUD_Map;
map.SetValue(key, queue, false);
}


public void KillSelf() {
char key[HUD_DISPLAY_NAME_MAX_LENGTH];

StringMap map = this.HUD_Map;
StringMapSnapshot snapshot = this.HUD_Map.Snapshot();

for(int loop = 0; loop < snapshot.Length; loop++)
{
snapshot.GetKey(loop, key, HUD_DISPLAY_NAME_MAX_LENGTH);

FF2HudQueue queue = null;
if(map.GetValue(key, queue))
delete queue;
}

delete this.HUD_Map;

delete this;
}
}

methodmap FF2BaseEntity_Map < StringMap
Expand Down
1 change: 1 addition & 0 deletions addons/sourcemod/scripting/ff2_module/shared.sp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#define ENT_REFKEY_LENGTH 20
#define KILLSTREAK_DAMAGE_INTERVAL 500
#define HUD_DISPLAY_NAME_MAX_LENGTH 128

#define min(%1,%2) (((%1) < (%2)) ? (%1) : (%2))
#define max(%1,%2) (((%1) > (%2)) ? (%1) : (%2))
Expand Down

0 comments on commit f32d25c

Please sign in to comment.