-
Notifications
You must be signed in to change notification settings - Fork 12
Modding Wrapers
In this page you will learn how SymphonyRecomp exposes wrappers to the mods, to learn more about how to make a mod please read this wiki page
Everything lives in the Sotn namespace so you have to import it:
using Sotn;
Player.Hp = Player.HpMax;stats, position and state of the player character
Player.Hp; Player.HpMax;
Player.Mp; Player.MpMax;
Player.Hearts; Player.HeartsMax;
Player.Gold; Player.Level;
Player.Entity; // the player as an Entity, see bellowEntity wraps one entry of the entity table. you build it from an address and read the fields as properties:
var e = Entities.At(12);
e.PosX; e.PosY;
e.Flags; e.FlagBits;
e.Palette; e.ClutId;
e.Step; e.StepSub;
e.HitPoints; e.Attack;
e.Update; // the update function address, use it to tell entities apart
e.IsAlive; e.IsEnemy; e.IsDead;
e.SetFlag(EntityFlags.KeepAliveOffCamera, true);
e.TintPalette(1f, 0.5f, 0.5f);
e.Destroy();Entities.At(i);
Entities.Player;
Entities.All(); // every live entity, returns enumerator to be walked over
Entities.Enemies();
Entities.GetFreeStage(); // a free slot in the stage range
Entities.SlotOf(e);slots 0 to 63 belong to the player and its effects, 64 and up are stage entities
Game is the current state of the run:
Game.InGame; Game.IsLoading;
Game.StageId; // a Stage enum value
Game.Character; //Your PlayableCharacter
Game.CurrentEntity;
Game.InAlucardMode();
Game.InPrologue();Inventory.GiveRelic(Relic.SoulOfBat, true);
Inventory.HasRelic(Relic.EchoOfBat);some enums that wrap over game ids
-
Relicevery relic -
Spellevery spell -
Subweaponevery subweapon -
HandItemandBodyItemfor equipment,ItemSlotfor where it goes -
Potionevery potion type -
EquipKindfor the equipment category
stage wide palette effects, this is what the blackout mod uses for example:
Stages.Shade(r, g, b); //applies an color shift on top of the existing colors
Stages.ShadeEntities(r, g, b);
Stages.Tint(r, g, b); // cumulative, unlike Shade
Stages.Restore(); //restore pallete (naming subject to change in the future)
Stages.RestoreEntities(); //restore entities pallete (naming subject to change in the future)
Stages.HideEntities();
Stages.WriteAllPalettes();Stage is an enum of every stage in the game, including the inverted castle
calls into the games functions. this is how you make the game do something instead of just reading its memory, the call wrapers handles the cpu context restoration so you don't have to worry with it.
GameApi.PlaySfx(id);
GameApi.PlaySfxVolPan(id, volume, pan);
GameApi.AddHearts(10);
GameApi.LearnSpell(Spell.SoulSteal);
GameApi.AddToInventory(HandItem.Shortsword);
GameApi.SetFadeMode(FadeMode.ToBlack);
GameApi.DealDamage(enemy, attacker);
GameApi.GetFreeEntity(start, end);
GameApi.CreateEntFactory(...);there is also a generic call site when something is not wrapped yet:
uint result = GameApi.Call(address, a0, a1, a2, a3);The Blackout mod that ships with SymphonyRecomp is the best reference, it is plain source under mods/blackout/. it combines most of the above:
Read it before writing your own, it is not a long mod you can read it pretty quickly, its also worthy to take a look at the wraper code to better understand what they do