mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 16:10:36 +00:00
4dc7e5130a135bfa223d1e8e776be8000ec77b85
12
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
4dc7e5130a |
refactor(object): gate on Object::RegistryReady instead of the raw pointer
Six sites tested [VAR_LOCAL_PLAYER_PTR] for null inline to mean "the world is up": loot/Scan, loot/Unit, loot/UnitItem, target/Nearest, the totem tracker, and the inline-texture glue check (whose comment already defines glue as "no local player"). Object::RegistryReady is that exact test, named; they now call it. The remaining reads of the global use its value (SoftTarget's manager identity, Identity's player GUID), not a null test. |
||
|
|
8917bf0a2a |
refactor: share the spell-name, rank and distance readers
Spell.dbc's localized name and rank were read inline in about 20 files, each re-deriving `record + offset + [VAR_LOCALE_INDEX] * 4`. They now go through Spell::Lookup::Name / Rank, which sit on a new DBC::LocalizedString(record, offset): the record-pointer form of the existing by-id DBC::LocalizedField, which now calls it. Both return null for an empty string. A DBC string slot is never null, only "", so every site that passed an empty name or rank through as "" (GetSpellInfo's rank, the cast-info returns, the UNIT_SPELLCAST_* formats, where a null %s corrupts the arguments after it) keeps "" explicitly. Private copies go: combat log SpellName, aura/Data LocalizedSpellName, CastEvents LocalizedField and two unused LocaleIndex helpers. Game::DistanceSq replaces about a dozen inline x/y/z squared-distance sums over float[3] points. It sums in the same order, so results are bit-identical, including the model-scene sites that mirror engine float math. Vec3-struct, 2D and differently ordered sums stay as they are. Totem::Owner now uses Unit::Identity::OwnerGuid for the owner and Aura::Data::FindSlotBySpellName to find the aura on a totem, in place of its own copies. |
||
|
|
ac45d56a43 |
feat(aura): attribute totem auras to the totem's owner
Every aura a totem applies now names the shaman who owns the totem as its caster, so sourceUnit is "player" for your own totems' auras, on you and on every group member in view. The server's caster is the totem, so this is a ClassicAPI extension. A unit is a totem when its UNIT_CREATED_BY_SPELL (+0x230) is a spell with a SUMMON_TOTEM_SLOT1..4 effect (87-90); its owner is UNIT_FIELD_CREATEDBY. The server stamps both on every totem and both are broadcast, so other shamans' totems resolve too. Totem::Owner holds the two lookups. A party area aura (Strength of Earth, the resistance totems) reaches the group with no packet that names the caster: the server copies it onto each member itself. The totem keeps its own copy in a visible aura slot, though, so the application hook (FUN_ON_AURA_ADDED, 0x6123F0) looks for a visible totem that carries the same spell line (same ID, or same localized name, since a low-level target gets a lower rank). The target's own totem wins, then the nearest one. A stranger's group is not visible to the client, so two groups' identical totems side by side are told apart by distance only. An aura a totem casts (Earthbind) arrives through SMSG_SPELL_GO with the totem as caster. The aura store and its duration now use the owner (the server applies the owner's duration mods to a totem's spells); the cast events keep the totem. The six modules that walked the object list each declared their own typedefs for ClntObjMgrEnumObjects (0x468380). They now share Object::ForEachVisible, which also gates on the object registry, since the walker reads the object manager with no null check. The totem effect IDs move to Offsets.h, and spell/Level.cpp drops its local copy of SPELL_EFFECT_APPLY_AREA_AURA_PARTY. |
||
|
|
b7a78565f7 |
docs: an API descriptor for every registration (#144)
* docs(container): describe the C_Container functions
Descriptors for the 17 undocumented C_Container functions and the
ItemQuestInfo structure. SwapItems, MoveItem, AutoStoreItem,
GetContainerItemCharges, GetContainerItemRepairCost and
IsContainerItemOpenable are not in retail's API and are marked as
ClassicAPI extensions.
* docs(aura): describe the C_UnitAuras functions
Descriptors for the 16 undocumented C_UnitAuras functions, plus the
AuraData structure that GetAuraDataByAuraInstanceID already named but
nothing defined. The four positional getters share the Classic Era
UnitAura return list.
* docs(equipmentset): describe the C_EquipmentSet functions
Descriptors for the 18 undocumented C_EquipmentSet functions,
GameTooltip:SetEquipmentSet, and the EQUIPMENT_SETS_CHANGED,
EQUIPMENT_SWAP_PENDING and EQUIPMENT_SWAP_FINISHED events. They
describe what the functions return here, which differs from retail in
places: an icon path, not a file ID; numMissing, not numLost;
GetIgnoredSlots lists slot numbers.
* docs(faction): describe the reputation functions
Descriptors for GetFactionIDByIndex, GetFactionInfoByID,
GetFactionParentID, the 17 undocumented C_Reputation functions, the
FactionData structure, and the FACTION_STANDING_CHANGED event.
C_Reputation.IsFactionInactive and SetFactionInactive mirror stock
globals, but no Blizzard client has them under C_Reputation, so they
are marked as ClassicAPI extensions.
* docs(player): describe the player functions and events
Descriptors for C_PlayerInfo.CanUseItem, GetName, GetClass, GetRace,
GetSex and IsConnected; GetPlayerFacing, GetPlayerInfoByGUID,
UnitNameFromGUID and IsLoggedIn; the four C_PlayerCache functions; and
the PLAYER_EQUIPMENT_CHANGED, UPDATE_INVENTORY_DURABILITY,
HEARTHSTONE_BOUND and six PLAYER_STARTED/STOPPED_MOVING, LOOKING and
TURNING events. They describe what the functions return here: sex is 2
or 3, not the UnitSex enum, and GetPlayerInfoByGUID has no level.
C_PlayerCache is ours, so its functions are marked as extensions.
GetCritChance and GetRangedCritChance move from system "PaperDollInfo"
to "PlayerGlobals": PaperDollInfo is the C_PaperDollInfo namespace's
system, and a global must not share it.
* docs(map): describe the C_Map functions
Descriptors for the 30 undocumented C_Map and C_MapExplorationInfo
functions, the UiMapDetails, UiMapLayerInfo, UiMapPoint,
AreaTriggerInfo, MapOverlayInfo and MapOverlayTile structures, and the
USER_WAYPOINT_UPDATED event. mapType is a plain number because no
Enum.UIMapType is registered, and flags is always 0. GetAreaTriggerInfo,
GetAreaTriggers, GetAreas, GetMapAreaIDs, GetMapOverlays and
GetUnexploredMapTextures are marked as ClassicAPI extensions.
* docs(loot): describe the C_Loot and C_LootHistory functions
Descriptors for the six C_Loot functions and the four C_LootHistory
functions, the LootableUnit, ScannedCorpse and ScannedLootItem
structures, and the LOOT_SCAN_COMPLETED and three LOOT_HISTORY_* events.
Every C_Loot function here and C_LootHistory.Clear are marked as
ClassicAPI extensions; Blizzard's C_Loot has none of them.
* docs(sound): describe the sound functions
Descriptors for the six undocumented C_Sound functions, the PlaySound,
PlaySoundFile, StopSound, MuteSoundFile and UnmuteSoundFile globals, the
PlaySoundParams and RecentSoundFile structures, the ItemSoundType and
Vocalerrorsounds enums, and the SOUNDKIT_FINISHED event.
C_Sound.PlaySound's second argument is documented as the channel name it
takes here, not retail's UISoundSubType. GetRecentSoundFiles is marked as
a ClassicAPI extension.
* docs(console): describe the console functions
Descriptors for ConsoleExec, ConsoleEcho, ConsoleIsActive,
ConsoleGetColorFromType, ConsoleGetFontHeight, SetConsoleKey,
CalculateStringEditDistance, ConsoleGetAllCommands and
ConsolePrintAllMatchingCommands, the ConsoleCommandInfo structure, and
the ConsoleCommandType and ConsoleCategory enums. The game and glue
registrations of each function share one descriptor. ConsoleExec and
ConsoleEcho return nothing here, and SetConsoleKey takes a key code.
* docs(voicechat): describe the text-to-speech functions
Descriptors for the four C_VoiceChat text-to-speech functions, the ten
C_TTSSettings functions, the VoiceTtsVoiceType structure, and the five
VOICE_CHAT_TTS_* events. The event payloads follow the shapes the
client sends here. GetSpeechVoiceID, SetVoiceOptionByName and
RefreshVoices are marked as ClassicAPI extensions.
* docs(api): correct entries that drifted from the code
Fixes entries that the descriptor pass found to differ from what the
functions do: C_PlayerInfo.GetSex never returns 1, the name and race
getters need a visible unit for unit locations too, RememberPlayer
raises on missing arguments, mutes outlive a reload, scan results fill
in during a scan, LootHistory names can be nil and ROLL_CHANGED can
carry playerIndex 0, GetMapRectOnMap's fallback and Kalimdor ID, dungeon
maps have no parent, and GetBestMapForUnit gives zones, not subzones.
HEARTHSTONE_BOUND and the player input-state events now describe only
their behavior; the packet handlers, engine addresses and hook notes
are gone.
* docs(loot): say when LOOT_HISTORY_FULL_UPDATE fires
The comment above the loot-history event names said FULL_UPDATE was
never fired from C++, but FireFullUpdate sends it when a roll opens a
new item, when the 128-item ring evicts the oldest entry, and from
C_LootHistory.Clear.
* docs(api): describe behavior, not implementation
API.md is the contract for addon authors, so it no longer names engine
addresses, struct offsets, internal type and field names, packet
opcodes, hook mechanics, source files or our C++ modules, and drops
provenance notes and remarks about which client version lacks what.
Where that text carried a real behavior, the behavior stays in plain
words: "when the server answers" in place of an opcode, "ignores the
merchant and repair cursor modes" in place of the function it skips.
Also: C_Spell.GetSpellPowerCost no longer calls GetSpellInfo's cost the
base cost (both are the effective cost), the C_Spell cast-info note no
longer calls the functions player-only, the name-cache intro says the
game empties its cache on each world entry, and examples use a generic
realm name.
* docs(item): describe the item functions
Descriptors for the 95 undocumented item registrations: the C_Item
readers, lock, use and equip calls, the GetItemInfo family, the
Get*ItemID companions, the GameTooltip item methods, the ItemData,
ItemSetInfo and ItemEnchantInfo structures, the InventoryType,
ItemClass and ItemQuality enums, and the ITEM_DATA_LOAD_RESULT and
GET_ITEM_INFO_RECEIVED events. They describe what the functions return
here where it differs from retail: GetItemSetInfo returns a table,
GetWeaponEnchantInfo returns twelve values, and RequestLoadItemData
returns whether the request went out. GetItemIDForItemInfo's return is
now optional, since input that names no item returns nothing.
* docs(unit): describe the unit functions
Descriptors for the 49 undocumented unit functions, the PowerType enum,
and the PLAYER_FOCUS_CHANGED and UPDATE_SHAPESHIFT_FORM events. They
describe what the functions do here: UnitHealthMissing has no
usePredicted argument, IsFalling and IsSwimming take no unit,
UnitPowerType returns no color, and UnitPosition keeps its Y-first
return order.
* docs(baselib): describe the Lua library additions
Descriptors for the Lua 5.1 functions added to the game's Lua: select,
unpack with a range, xpcall with arguments, collectgarbage options,
debugstack, the math hyperbolics, fmod and modf, string.match, gmatch,
reverse, byte, split, join and trim with their global aliases, and
strreplace, plus Mixin and CreateFromMixins. strreplace is the one
ClassicAPI extension; retail binds the other aliases itself.
* docs(api): correct entries the item and unit descriptors contradicted
UnitIsMinion, UnitIsPet and UnitIsOtherPlayersPet raise on a string that
is not a unit token; only a token that names no unit, or a non-string,
returns false. GetItemCooldown does not take item names. A full request
queue makes RequestLoadItemData return false. GetInventoryItemID needs a
player, so pets and totems return nil. GetItemNameByID keeps a link's
random suffix. GetInventoryItemRepairCost raises on a non-number slot.
The Get*ItemID intro no longer calls the companions stock functions.
Also settles two entries that contradicted themselves: the summoning
ritual's channel events do fire, and GetSecondsUntilDailyReset counts to
UTC midnight. C_PlayerInfo.UnitPosition gets a line under UnitPosition.
* fix(docs): map the remaining widget method registries to systems
Methods registered on the Button, Slider, StatusBar, MessageFrame,
SimpleHTML, ScrollingMessageFrame, PlayerModel and DressUpModel
registries had descriptors, but the browser listed them as an unmapped
registry. The five Blizzard has use its names (SimpleButtonAPI and so
on); the other three are named the same way.
* docs(ui): describe the frame, texture and input functions
Descriptors for the texture, region, frame, button, editbox and tooltip
methods ClassicAPI adds, the C_Texture atlas, C_XMLUtil, C_ColorUtil,
C_UIColor and C_NamePlate functions, the binding, modifier-key, cursor
and screen globals, the AtlasInfo, XML template and DBColorExport
structures, Enum.UICursorType, and the nameplate, cursor and
MODIFIER_STATE_CHANGED events. IsMouseButtonDown, GetMouseButtonName and
GetCursorDelta move to the InputGlobals system.
* docs(spell): describe the spell, action and creature functions
Descriptors for the remaining spell, spellbook, tracking, action bar,
talent, totem, loss-of-control, macro, combat, tradeskill, targeting,
GUID, class, C_CreatureInfo and C_GameObjectInfo registrations, their
structures, and the LEARNED_SPELL_IN_SKILL_LINE, PLAYER_TOTEM_UPDATE,
LOSS_OF_CONTROL_*, CREATURE_DATA_LOAD_RESULT and
GAMEOBJECT_DATA_LOAD_RESULT events. The IsItemAction,
HasBonusActionBar and IsStackableAction globals move from the
C_ActionBar system to ActionBarGlobals.
* docs(world): describe the gossip, quest, social and vendor functions
Descriptors for C_GossipInfo, the friends and /who functions, C_QuestLog
and the quest globals, C_TaxiMap, C_MerchantFrame, C_AuctionHouse.PostItem,
the mail, group, instance, coin-text, chat, character-order and
expansion globals, their structures, the FlightPath enums, and the
QUEST_DATA_LOAD_RESULT and AUCTION_MULTISELL_* events. Globals that
named a namespaced system (QuestLog, PartyInfo, CurrencyInfo) move to
the matching *Globals system, and GetCoinText gets separate global and
C_CurrencyInfo descriptors.
* docs(lua): describe the cvar, encoding, time, addon and Lua functions
Descriptors for the cvar, C_EncodingUtil, C_DateAndTime, C_Timer,
C_AddOns, coroutine, table, security-account, event, script, clipboard
and hooksecurefunc registrations, the CalendarTime and SavedAccountInfo
structures, and the Base64Variant, CompressionMethod and
AddOnSecurityStatus enums.
* docs(api): correct entries the last descriptor pass contradicted
SelectOption takes an optional password for boxCoded options.
IsWhoQueryPending clears when the answer arrives, not after a timer, and
SendWhoQueryByName raises on a nil or non-string name. SetTalentByID
raises on a nil or non-number talentID. The gossip getters also read the
quest greeting window. GetPoint returns three values for an anchor with
no relative frame. RegisterAtlas's rectangle is optional.
GetSecondsUntilDailyReset returns nothing before login.
CopyToClipboard is a Blizzard function, not an extension, and always
returns the length. ConvertHSLToRGB, DoesTemplateExist,
GetNamePlateForGUID, GetNamePlateGUIDs and SetModernScriptArgs are
labelled as ClassicAPI extensions, and C_AuctionHouse.PostItem is
described as retail's function plus a numStacks argument.
IsAddOnLoadable's descriptor notes the nil reason for an unknown name.
* docs: start every function and event summary with a verb
Function summaries now read "Returns …", "Returns whether …" and so on,
not a bare "Whether …", "The …" or "How many …", and event summaries
read "Fires when …" instead of describing the past ("A cast ended").
A few two-sentence summaries become one sentence, and the two range
check toggles say what they do rather than "Used with …".
* refactor(lua): require a descriptor on every registration
The registrars and Event::Custom::AutoReserve no longer default their
doc argument, so a function, method table, enum, alias or custom event
registered without a descriptor does not compile. The _classicapi_
debug functions, which the documentation export skips, pass nullptr
explicitly.
* docs: stop calling namespaced Blizzard globals extensions
A function is a ClassicAPI extension only when no Blizzard client ships
it under any name. C_XMLUtil.DoesTemplateExist (the global
DoesTemplateExist), C_PlayerInfo.UnitPosition, C_Reputation.
IsFactionInactive and SetFactionInactive, and C_Macro.CreateMacro and
EditMacro are Blizzard globals under a namespace Blizzard never gave
them, so their descriptors and API.md no longer label them extensions.
* refactor(baselib): register newproxy through the registrars
newproxy set its global by hand so its C closure could carry the weak
table of valid metatables as an upvalue, which left it the one global
with no descriptor. The weak table now lives in the registry (made on
first use in each Lua state), so newproxy is a plain C function that
RegisterGlobalFunction and RegisterGlueFunction bind with a descriptor.
Behavior is unchanged.
* docs(api): drop the C++ module name from the aura timing heading
* docs(api): fix descriptor errors found in review
- UnitSpellTargetName is a Blizzard function (Unit system): drop the
extension flag and file it under UnitGlobals.
- Flag the ClassicAPI-only spell functions as extensions: GetSpellRadius
(global and C_Spell), GetSpellReagents, GetSpellDispelType,
IsNextMeleeSpell, ResetsMeleeSwing, GetSpellMechanicByID,
GetSpellEffectMechanics, GetSpellEffectInfo, GetSpellRequiredTargetLevel,
GetSpellLevelInfo and C_SpellBook.GetPlayerSpellsByAura. No Blizzard
client ships any of them.
- Name the Region registry SimpleScriptRegionAPI, as retail does, and
make the no-counterpart comment cover all three rows it applies to.
- Start the VOICE_CHAT_TTS_SPEAK_TEXT_UPDATE summary with a verb.
- Type GetCurrentChatEvent's guid return as WOWGUID, matching
GetCurrentChatGUID.
- Say that the itemInfo argument also accepts an item string.
* docs(api): document the methods the source count missed
_classicapi_UndocumentedAPI() still listed 23 names. Each sat in a method
array that already had a partial doc array, so the source count read it
as documented.
- GameTooltip: SetUnitAura, SetUnit, GetUnit, GetUnitGUID, HasUnit.
GetUnitGUID and HasUnit are extensions; no Blizzard client ships them.
- FontString: GetStringHeight, GetUnboundedStringWidth, GetWrappedWidth,
GetNumLines, GetLineHeight, IsTruncated, SetMaxLines, GetMaxLines,
GetFieldSize.
- ModelScene actor: GetObjectType, IsObjectType, GetName, GetParent,
HasScript, GetScript, SetScript, HookScript, as our object methods
return them (1/nil, no HookScript result).
- GetAverageItemLevel moves to PaperDollInfoGlobals: PaperDollInfo is the
C_PaperDollInfo namespace.
The in-game check now reports 0.
|
||
|
|
165ccf3e9c |
refactor(lua): share the engine's flag readers as Game::Lua::ToFlag and Game::StringToFlag
Twenty modules each declared their own typedef or wrapper for FUN_LUA_TO_BOOLEAN_LOOSE (4.3.4's StringToBOOL(L, index, default)) or FUN_XML_ATTR_TO_BOOL (StringToBOOL(const char *)). Route them all through one helper each. frame/Cooldown.cpp had a C++ copy of both that read unknown attribute text as true; the engine's reader, which 4.3.4's XML loader uses, reads it as false. SetReverse/SetDrawEdge now also truncate numbers like every other 1.12 flag method. |
||
|
|
60ef54b4a6 |
refactor(cvar): register cvars the way the engine registers its own
CVar::Factory::Register now takes a help line and a console category. The registrar's EDX slot is the help line, not a spare zero, and category 9 (what Script_RegisterCVar passes) matches none of the nine console categories. So our cvars had no help and were listed under no category in `help <category>`. Every backported cvar now passes retail's exact help string and category (from Ketho's C_Console.GetAllCommands dump). The bag-sort and TTS cvars have no retail counterpart and get no help line. GetInt and the new GetFloat read the integer and float the setter stores on every change, as the engine's own readers do. They no longer re-parse the string. SoftTarget's atof copy and Nearest's raw read are gone. Info, Bool, Set and Bitfield now go through the Factory (Find, GetString, the new IsReadOnly) instead of their own lookups and field reads. The read-only bit on scriptMemory is no longer a mystery. FUN_0063E030 sets it on realmList, realmName and scriptMemory from CGGameUI::InitializeGame, before the interface loads, and ShutdownGame clears it. So CVar::ScriptMemory's in-game hook could never write. Drop it and keep the glue one. Also correct the Offsets.h comments: FUN_SET_CVAR_VALUE is __thiscall, and the registrar's callback contract is now documented. |
||
|
|
81eaf24748 |
feat(target): add the soft enemy and soft friend
Add the softenemy, softfriend, anyenemy and anyfriend unit tokens, the PLAYER_SOFT_ENEMY_CHANGED and PLAYER_SOFT_FRIEND_CHANGED events, and the SoftTargetEnemy*, SoftTargetFriend* and SoftTargetMatchLocked cvars, with Classic Era's defaults. anyleftinteract is the same as anyinteract. The soft-target scan moves to Target::SoftTarget, shared by interact, enemy and friend. Its arc now follows the camera, not the character. |
||
|
|
799ab1d3ce |
fix(target): call the selection setter as __stdcall, not __cdecl
FUN_SET_SELECTION_BY_GUID (0x00493540) returns with `ret 8`, and the engine's own callers (TargetByName, OnSpriteRightClick) never clean the stack after it. Target::Nearest declared it __cdecl, so each call from TargetDirectionEnemy / TargetDirectionFriend popped the two GUID words a second time and left the stack 8 bytes off. |
||
|
|
6e50577565 |
fix(target): follow 4.3.4's TargetNearest and TargetDirection
TargetNearest, TargetNearestEnemyPlayer and TargetNearestFriendPlayer now run the engine's own tab cycle (FUN_00493F60), which is 4.3.4's TargetNearestEnemy: units in front first, the targetNearestDistance / targetNearestDistanceRadius ranges, no critters or unseen units, and the 3 s / 1 s snapshot shared with the native functions. A co-hook on its predicate adds 4.3.4's types 0, 2 and 4 as three new modes. TargetNearest now cycles any unit, as in 4.3.4. TargetDirectionEnemy / TargetDirectionFriend are now 4.3.4's CGGameUI::TargetDirection, built on 1.12's GetScreenCoordinates, the camera's forward vector and the tab search's tests: facing is a screen direction relative to the camera, the search starts at the target when it is on screen, the cone is at least 22.5 degrees, and a hit locks further calls until the new TargetDirectionFinished(). |
||
|
|
39d22ac124 |
fix(time): centralize engine ms-tick reads in Time::Clock
The engine's OS millisecond counter (FUN_OS_TICKCOUNT_MS, same epoch GetTime() scales by 0.001) is unsigned and wraps at 2^32 ms. Nine files each re-derived the reader; several stored the tick into a signed int, so past 2^31 ms (~24.9 days uptime) every timestamp went negative and `startTime + duration` landed in the past -- callers saw every cooldown, aura, and lockout as already elapsed. The same bug shipped three times (the cooldown by-ID getters and C_LossOfControl). Add one source of truth -- Time::Clock (src/time/Clock.h) -- with a uint32 NowMs() and wrap-safe Reached/Remaining/Elapsed helpers, and route every tick reader through it. No module re-derives the reader or hand- rolls a `now < deadline` compare (which inverts across the wrap) anymore. Also fixes the reported cooldown/LoC getters (unsigned out-params, wrap-safe compares) and three latent instances of the same `now < end` inversion found while sweeping: totem/Tracker's two timer getters and aura/Source's cache-eviction pass. Named Time::Clock, not Time::Tick, because a Time::Tick inner name shadows the global Tick namespace (the WorldTick hook) from inside any Time::* file. Discovered by fuffc in #17. |
||
|
|
2612118ff6 |
refactor(object): centralize GUID->object resolution in Object::ByGuid
Every caller of the engine object resolver (0x00468460) re-declared the
same __fastcall typedef and split the GUID into lo/hi by hand -- 30 call
sites across 28 files. Add object/Resolve.{h,cpp} with
void *Object::ByGuid(int typeMask, uint64_t guid, const char *debugName, int priority)
and route every site through it (behavior-identical: same typeMask,
debugName, priority per site; single-uint64 callers pass guid, split-lo/hi
callers reconstruct it).
Also collapse the duplicate offset constant: FUN_CLNT_OBJ_MGR_OBJECT_PTR
was a second name for the same 0x00468460 address as
FUN_OBJECT_RESOLVE_BY_GUID (a single-source-of-truth violation). Remove
it; the ABI-equivalent (u32,void*,u64,int) view it documented is folded
into the surviving constant's comment.
|
||
|
|
c35d883af0 |
targeting: backport TargetDirection*/TargetNearest* + GetPlayerFacing
Adds the post-vanilla TargetScript selection functions 1.12.1 lacks: TargetDirectionEnemy(facing[,cone]) / TargetDirectionFriend TargetNearest([reverse]) TargetNearestEnemyPlayer([reverse]) / TargetNearestFriendPlayer GetPlayerFacing() All five targeting functions reuse the engine's own tab-target core: the visible-unit enumeration, the per-mode validity predicate FUN_00493e40 (reaction/attackability/alive, modes 1=enemy/2=friend), and the selection commit. The only new logic is a player-GUID filter for the *Player variants and the cone geometry for the direction variants. Cycle functions keep a frozen per-filter snapshot advanced within a ~1s window (no ping-pong). Target-setting routes through FUN_TARGET_BY_GUID (0x00489A40), which rejects a GUID that no longer resolves to a live unit rather than committing it — a stale snapshot GUID would otherwise leave "target" pointing at freed unit data and crash the next handler that reads it. GetPlayerFacing reads the CGUnit movement-block orientation at +0x9C4 (located by probing the player object across a known 180-degree turn); it's the facing source the direction-target functions need. Not backported (no vanilla equivalent): TargetPriorityHighlightStart/End, IsTargetLoose, TargetToggle. New offsets: FUN_TARGET_CANDIDATE_VALID (0x00493E40), FUN_SET_SELECTION_BY_GUID (0x00493540), VAR_CURRENT_SELECTION_GUID_LO/HI, OFF_UNIT_FACING (0x9C4). |