aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO.md7
-rw-r--r--reference/game.c914
-rw-r--r--reference/types.hh19
-rw-r--r--src/magic.cc827
-rw-r--r--src/magic.hh22
-rw-r--r--src/stubs.hh1
6 files changed, 851 insertions, 939 deletions
diff --git a/TODO.md b/TODO.md
index 52a4acf..16235e8 100644
--- a/TODO.md
+++ b/TODO.md
@@ -1,8 +1,9 @@
## TODO NEXT
- MAGIC.CC
-- TCreature
-- TPlayer
-- TNonPlayer
+- merge creature headers into a single one CR.HH
+ - this should help preventing dependency cycles and centralize creature data
+ structures and globals in a single place
+- CRMAIN.CC
## Stack allocations
Any functions that use `alloca` or some other form of dynamic stack allocations will cause decompiled functions to be an absolute mess. It usually shows up in the decompiled code as both a size computation like `-(VAR + CONST & 0xfffffff0)`, followed by some assignment. It doesn't make total sense without looking at the disassembly. I've encountered ~30 such computations and expect the functions containing them to be amongt the most challenging/annoying to be properly decompiled.
diff --git a/reference/game.c b/reference/game.c
index c003e99..10f5705 100644
--- a/reference/game.c
+++ b/reference/game.c
@@ -28334,920 +28334,6 @@ LAB_0808b420:
__cxa_throw(puVar4,&RESULT::typeinfo,0);
}
-
-
-// WARNING: Unknown calling convention -- yet parameter storage is locked
-
-void InitCircles(void)
-
-{
- undefined4 *puVar1;
- uint uVar2;
- int iVar3;
- int i;
- int iVar4;
- int x;
- int iVar5;
- int local_1160;
- int local_1150;
- int y;
- int rad;
- int Center;
- int Y;
- int X;
- ifstream IN;
- undefined4 local_1134 [3];
- uint auStack_1128 [23];
- __basic_file<char> local_10cc [25];
- undefined1 local_10b3;
- undefined *local_10ac;
- ios_base local_10a8 [16];
- uint local_1098;
- char local_101c [4];
- char FileName [4096];
-
- // try { // try from 0808b4eb to 0808b4ef has its CatchHandler @ 0808b910
- std::ios_base::ios_base(local_10a8);
- local_10ac = (undefined *)0x8128950;
- // try { // try from 0808b514 to 0808b518 has its CatchHandler @ 0808b886
- std::istream::istream((istream *)&X,(streambuf *)(std::ifstream::VTT + 4));
- X = (int)&DAT_08128994;
- local_10ac = &DAT_081289a8;
- // try { // try from 0808b538 to 0808b53c has its CatchHandler @ 0808b880
- std::filebuf::filebuf((filebuf *)local_1134);
- // try { // try from 0808b550 to 0808b554 has its CatchHandler @ 0808b820
- std::ios::init((EVP_PKEY_CTX *)&local_10ac);
- local_1160 = 0;
- iVar4 = 9;
- do {
- uVar2 = 0x104;
- puVar1 = (undefined4 *)((int)Circle[0].x + local_1160);
- if (((uint)puVar1 & 4) != 0) {
- puVar1 = (undefined4 *)((int)Circle[0].x + local_1160 + 4);
- uVar2 = 0x100;
- *(undefined4 *)((int)Circle[0].x + local_1160) = 0;
- }
- for (uVar2 = uVar2 >> 2; uVar2 != 0; uVar2 = uVar2 - 1) {
- *puVar1 = 0;
- puVar1 = puVar1 + 1;
- }
- local_1160 = local_1160 + 0x104;
- iVar4 = iVar4 + -1;
- } while (-1 < iVar4);
- sprintf(local_101c,"%s/circles.dat",DATAPATH);
- // try { // try from 0808b5e9 to 0808b6a8 has its CatchHandler @ 0808b88c
- iVar4 = std::filebuf::open((char *)local_1134,(int)local_101c,8);
- if (iVar4 == 0) {
- std::ios::clear((int)&X + *(int *)(X + -0xc),
- *(uint *)((int)auStack_1128 + *(int *)(X + -0xc)) | 4);
- }
- if ((local_1098 & 5) == 0) {
- std::istream::operator>>((istream *)&X,&Y);
- std::istream::operator>>((istream *)&X,&Center);
- std::istream::operator>>((istream *)&X,&rad);
- if (((Y - 1U < 0x15) && (0 < Center)) && (Center < 0x16)) {
- local_1150 = 0;
- iVar4 = Center;
- iVar3 = Y;
- if (0 < Center) {
- do {
- iVar5 = 0;
- if (0 < iVar3) {
- do {
- std::istream::operator>>((istream *)&X,&y);
- if (y < 10) {
- iVar4 = Circle[y].Count;
- Circle[y].x[iVar4] = iVar5 - rad;
- Circle[y].Count = iVar4 + 1;
- Circle[y].y[iVar4] = local_1150 - rad;
- }
- iVar5 = iVar5 + 1;
- iVar4 = Center;
- iVar3 = Y;
- } while (iVar5 < Y);
- }
- local_1150 = local_1150 + 1;
- } while (local_1150 < iVar4);
- }
- X = (int)&DAT_08128994;
- local_10ac = &DAT_081289a8;
- local_1134[0] = 0x8128ad0;
- // try { // try from 0808b73e to 0808b789 has its CatchHandler @ 0808b910
- std::filebuf::close((int)local_1134);
- local_10b3 = 0;
- std::__basic_file<char>::~__basic_file(local_10cc);
- std::streambuf::~streambuf((streambuf *)local_1134);
- std::istream::~istream((istream *)&X);
- std::ios::~ios((ios *)&local_10ac);
- return;
- }
- // try { // try from 0808b79e to 0808b813 has its CatchHandler @ 0808b88c
- error(&DAT_080fde60);
- puVar1 = (undefined4 *)__cxa_allocate_exception(4);
- *puVar1 = "Cannot process \"circles.dat\"";
- }
- else {
- error(&DAT_080fdea0,local_101c);
- puVar1 = (undefined4 *)__cxa_allocate_exception(4);
- *puVar1 = "Cannot open \"circles.dat\"";
- }
- // WARNING: Subroutine does not return
- __cxa_throw(puVar1,char_const*::typeinfo,0);
-}
-
-
-
-// WARNING: Variable defined which should be unmapped: va
-
-TSpellList * CreateSpell(int SpellNr,...)
-
-{
- int iVar1;
- char *__s1;
- int iVar2;
- undefined4 *puVar3;
- char (*__s2) [6];
- int i;
- int iVar4;
- char *Syl;
- int local_18;
- int syl;
- va_list va;
-
- local_18 = 0;
- syl = (int)&stack0x00000008;
- do {
- iVar1 = syl + 4;
- __s1 = *(char **)syl;
- if (*__s1 == '\0') {
- return SpellList + SpellNr;
- }
- __s2 = SpellSyllable;
- iVar4 = 1;
- do {
- __s2 = __s2 + 1;
- iVar2 = strcmp(__s1,*__s2);
- syl = iVar1;
- if (iVar2 == 0) {
- SpellList[SpellNr].Syllable[local_18] = (uchar)iVar4;
- local_18 = local_18 + 1;
- if (10 < local_18) {
- // try { // try from 0808b9c1 to 0808b9ef has its CatchHandler @ 0808ba05
- error(&DAT_080fdee0,SpellNr);
- puVar3 = (undefined4 *)__cxa_allocate_exception(4);
- *puVar3 = "Spell has too many syllables";
- // WARNING: Subroutine does not return
- __cxa_throw(puVar3,char_const*::typeinfo,0);
- }
- break;
- }
- iVar4 = iVar4 + 1;
- } while (iVar4 < 0x34);
- } while( true );
-}
-
-
-
-// WARNING: Unknown calling convention -- yet parameter storage is locked
-
-void InitSpells(void)
-
-{
- uchar *puVar1;
- TSpellList *S;
- int iVar2;
- TSpellList *pTVar3;
- int i;
- int iVar4;
-
- iVar2 = 0x24;
- iVar4 = 0xfe;
- do {
- puVar1 = SpellList[0].Syllable + iVar2;
- puVar1[0] = '\0';
- puVar1[1] = '\0';
- puVar1[2] = '\0';
- puVar1[3] = '\0';
- puVar1 = SpellList[0].Syllable + iVar2 + 4;
- puVar1[0] = '\0';
- puVar1[1] = '\0';
- puVar1[2] = '\0';
- puVar1[3] = '\0';
- puVar1 = SpellList[0].Syllable + iVar2 + 8;
- puVar1[0] = '\0';
- puVar1[1] = '\0';
- puVar1[2] = '\0';
- puVar1[3] = '\0';
- puVar1 = SpellList[0].Syllable + iVar2 + 0xc;
- puVar1[0] = '\0';
- puVar1[1] = '\0';
- puVar1[2] = '\0';
- puVar1[3] = '\0';
- puVar1 = SpellList[0].Syllable + iVar2 + 0x10;
- puVar1[0] = '\0';
- puVar1[1] = '\0';
- puVar1[2] = '\0';
- puVar1[3] = '\0';
- puVar1 = SpellList[0].Syllable + iVar2 + 0x14;
- puVar1[0] = '\0';
- puVar1[1] = '\0';
- puVar1[2] = '\0';
- puVar1[3] = '\0';
- puVar1 = SpellList[0].Syllable + iVar2 + 0x18;
- puVar1[0] = '\0';
- puVar1[1] = '\0';
- puVar1[2] = '\0';
- puVar1[3] = '\0';
- puVar1 = SpellList[0].Syllable + iVar2 + 0x1c;
- puVar1[0] = '\0';
- puVar1[1] = '\0';
- puVar1[2] = '\0';
- puVar1[3] = '\0';
- puVar1 = SpellList[0].Syllable + iVar2 + 0x20;
- puVar1[0] = '\0';
- puVar1[1] = '\0';
- puVar1[2] = '\0';
- puVar1[3] = '\0';
- iVar2 = iVar2 + 0x24;
- iVar4 = iVar4 + -1;
- } while (-1 < iVar4);
- // try { // try from 0808ba9d to 0808dadb has its CatchHandler @ 0808daf8
- pTVar3 = CreateSpell(1,"ex",&DAT_080fe2ae,&DAT_080fed0c);
- pTVar3->Mana = 0x19;
- pTVar3->Level = 9;
- pTVar3->Flags = 8;
- pTVar3->Comment = "Light Healing";
- pTVar3 = CreateSpell(2,"ex",&DAT_080fe2ae,&DAT_080fe2c0,&DAT_080fed0c);
- pTVar3->Mana = 0x28;
- pTVar3->Level = 0xb;
- pTVar3->Flags = 8;
- pTVar3->Comment = "Intense Healing";
- pTVar3 = CreateSpell(3,"ex",&DAT_080fe2ae,&DAT_080fe2d5,&DAT_080fed0c);
- pTVar3->Mana = 0xa0;
- pTVar3->Level = 0x14;
- pTVar3->Flags = 8;
- pTVar3->Comment = "Ultimate Healing";
- pTVar3 = CreateSpell(4,"ad",&DAT_080fe2ae,&DAT_080fe2c0,&DAT_080fed0c);
- pTVar3->Mana = 0xf0;
- pTVar3->Level = 0xf;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = '\x05';
- pTVar3->Flags = 8;
- pTVar3->Amount = 1;
- pTVar3->RuneLevel = 1;
- pTVar3->SoulPoints = 2;
- pTVar3->Comment = "Intense Healing Rune";
- pTVar3 = CreateSpell(5,"ad",&DAT_080fe2ae,&DAT_080fe2d5,&DAT_080fed0c);
- pTVar3->Mana = 400;
- pTVar3->Level = 0x18;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = '\r';
- pTVar3->Flags = 8;
- pTVar3->Amount = 1;
- pTVar3->RuneLevel = 4;
- pTVar3->SoulPoints = 3;
- pTVar3->Comment = "Ultimate Healing Rune";
- pTVar3 = CreateSpell(6,"ut",&DAT_080fe31a,&DAT_080fe316,&DAT_080fed0c);
- pTVar3->Mana = 0x3c;
- pTVar3->Level = 0xe;
- pTVar3->Flags = 2;
- pTVar3->Comment = "Haste";
- pTVar3 = CreateSpell(7,"ad",&DAT_080fe31e,&DAT_080fed0c);
- pTVar3->Mana = 0x78;
- pTVar3->Level = 0xf;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = '\x1b';
- pTVar3->Flags = 9;
- pTVar3->Amount = 5;
- pTVar3->RuneLevel = 0;
- pTVar3->SoulPoints = 1;
- pTVar3->Comment = "Light Magic Missile";
- pTVar3 = CreateSpell(8,"ad",&DAT_080fe31e,&DAT_080fe2c0,&DAT_080fed0c);
- pTVar3->Mana = 0x118;
- pTVar3->Level = 0x19;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = '3';
- pTVar3->Flags = 9;
- pTVar3->Amount = 5;
- pTVar3->RuneLevel = 4;
- pTVar3->SoulPoints = 2;
- pTVar3->Comment = "Heavy Magic Missile";
- pTVar3 = CreateSpell(9,"ut",&DAT_080fe34f,"res",&DAT_080fe34a,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0x19;
- pTVar3->Flags = 1;
- pTVar3->Comment = "Summon Creature";
- pTVar3 = CreateSpell(10,"ut",&DAT_080fe34f,&DAT_080fe363,&DAT_080fed0c);
- pTVar3->Mana = 0x14;
- pTVar3->Level = 8;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Light";
- pTVar3 = CreateSpell(0xb,"ut",&DAT_080fe34f,&DAT_080fe2c0,&DAT_080fe363,&DAT_080fed0c);
- pTVar3->Mana = 0x3c;
- pTVar3->Level = 0xd;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Great Light";
- pTVar3 = CreateSpell(0xc,"ad",&DAT_080fe377,&DAT_080fe373,&DAT_080fed0c);
- pTVar3->Mana = 200;
- pTVar3->Level = 0x10;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = '\x1e';
- pTVar3->Flags = 1;
- pTVar3->Amount = 1;
- pTVar3->RuneLevel = 5;
- pTVar3->SoulPoints = 3;
- pTVar3->Comment = "Convince Creature";
- pTVar3 = CreateSpell(0xd,"ex",&DAT_080fe34f,&DAT_080fe38d,&DAT_080fe316,&DAT_080fed0c);
- pTVar3->Mana = 0xfa;
- pTVar3->Level = 0x26;
- pTVar3->Flags = 1;
- pTVar3->Comment = "Energy Wave";
- pTVar3 = CreateSpell(0xe,"ad",&DAT_080fe34f,&DAT_080fe39e,&DAT_080fed0c);
- pTVar3->Mana = 600;
- pTVar3->Level = 0x1b;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = '\x1f';
- pTVar3->Flags = 0;
- pTVar3->Amount = 1;
- pTVar3->RuneLevel = 4;
- pTVar3->SoulPoints = 2;
- pTVar3->Comment = "Chameleon";
- pTVar3 = CreateSpell(0xf,"ad",&DAT_080fe31e,&DAT_080fe3ac,&DAT_080fed0c);
- pTVar3->Mana = 0xa0;
- pTVar3->Level = 0x11;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = '*';
- pTVar3->Flags = 9;
- pTVar3->Amount = 2;
- pTVar3->RuneLevel = 2;
- pTVar3->SoulPoints = 2;
- pTVar3->Comment = "Fireball";
- pTVar3 = CreateSpell(0x10,"ad",&DAT_080fe31e,&DAT_080fe2c0,&DAT_080fe3ac,&DAT_080fed0c);
- pTVar3->Mana = 0x1e0;
- pTVar3->Level = 0x17;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = ',';
- pTVar3->Flags = 9;
- pTVar3->Amount = 2;
- pTVar3->RuneLevel = 4;
- pTVar3->SoulPoints = 3;
- pTVar3->Comment = "Great Fireball";
- pTVar3 = CreateSpell(0x11,"ad",&DAT_080fe34f,&DAT_080fe3c0,&DAT_080fe3ac,&DAT_080fed0c);
- pTVar3->Mana = 600;
- pTVar3->Level = 0x1b;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = '-';
- pTVar3->Flags = 1;
- pTVar3->Amount = 2;
- pTVar3->RuneLevel = 5;
- pTVar3->SoulPoints = 4;
- pTVar3->Comment = "Firebomb";
- pTVar3 = CreateSpell(0x12,"ad",&DAT_080fe34f,&DAT_080fe3c0,&DAT_080fe316,&DAT_080fed0c);
- pTVar3->Mana = 0x2d0;
- pTVar3->Level = 0x1f;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = '5';
- pTVar3->Flags = 1;
- pTVar3->Amount = 3;
- pTVar3->RuneLevel = 6;
- pTVar3->SoulPoints = 4;
- pTVar3->Comment = "Explosion";
- pTVar3 = CreateSpell(0x13,"ex",&DAT_080fe34f,&DAT_080fe3ac,&DAT_080fe316,&DAT_080fed0c);
- pTVar3->Mana = 0x50;
- pTVar3->Level = 0x12;
- pTVar3->Flags = 9;
- pTVar3->Comment = "Fire Wave";
- pTVar3 = CreateSpell(0x14,"ex",&DAT_080fe3d7,&DAT_080fe34a,&DAT_080fed0c);
- pTVar3->Mana = 0x14;
- pTVar3->Level = 8;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Find Person";
- pTVar3 = CreateSpell(0x15,"ad",&DAT_080fe31e,&DAT_080fe2d5,&DAT_080fe3e7,&DAT_080fed0c);
- pTVar3->Mana = 0x370;
- pTVar3->Level = 0x2d;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = '\b';
- pTVar3->Flags = 1;
- pTVar3->Amount = 1;
- pTVar3->RuneLevel = 0xf;
- pTVar3->SoulPoints = 5;
- pTVar3->Comment = "Sudden Death";
- pTVar3 = CreateSpell(0x16,"ex",&DAT_080fe34f,&DAT_080fe3e7,&DAT_080fe363,&DAT_080fed0c);
- pTVar3->Mana = 100;
- pTVar3->Level = 0x17;
- pTVar3->Flags = 1;
- pTVar3->Comment = "Energy Beam";
- pTVar3 = CreateSpell(0x17,"ex",&DAT_080fe34f,&DAT_080fe2c0,&DAT_080fe3e7,&DAT_080fe363,
- &DAT_080fed0c);
- pTVar3->Mana = 200;
- pTVar3->Level = 0x1d;
- pTVar3->Flags = 1;
- pTVar3->Comment = "Great Energy Beam";
- pTVar3 = CreateSpell(0x18,"ex",&DAT_080fe34f,&DAT_080fe2c0,&DAT_080fe3c0,&DAT_080fe3e7,
- &DAT_080fed0c);
- pTVar3->Mana = 0x4b0;
- pTVar3->Level = 0x3c;
- pTVar3->Flags = 3;
- pTVar3->Comment = "Ultimate Explosion";
- pTVar3 = CreateSpell(0x19,"ad",&DAT_080fe34f,&DAT_080fe41d,&DAT_080fe3ac,&DAT_080fed0c);
- pTVar3->Mana = 0xf0;
- pTVar3->Level = 0xf;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = ')';
- pTVar3->Flags = 1;
- pTVar3->Amount = 3;
- pTVar3->RuneLevel = 1;
- pTVar3->SoulPoints = 1;
- pTVar3->Comment = "Fire Field";
- pTVar3 = CreateSpell(0x1a,"ad",&DAT_080fe34f,&DAT_080fe41d,&DAT_080fe42d,&DAT_080fed0c);
- pTVar3->Mana = 200;
- pTVar3->Level = 0xe;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = '\x19';
- pTVar3->Flags = 1;
- pTVar3->Amount = 3;
- pTVar3->RuneLevel = 0;
- pTVar3->SoulPoints = 1;
- pTVar3->Comment = "Poison Field";
- pTVar3 = CreateSpell(0x1b,"ad",&DAT_080fe34f,&DAT_080fe41d,&DAT_080fe3e7,&DAT_080fed0c);
- pTVar3->Mana = 0x140;
- pTVar3->Level = 0x12;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = '\x11';
- pTVar3->Flags = 1;
- pTVar3->Amount = 3;
- pTVar3->RuneLevel = 3;
- pTVar3->SoulPoints = 2;
- pTVar3->Comment = "Energy Field";
- pTVar3 = CreateSpell(0x1c,"ad",&DAT_080fe34f,&DAT_080fe3c0,&DAT_080fe41d,&DAT_080fe3ac,
- &DAT_080fed0c);
- pTVar3->Mana = 0x30c;
- pTVar3->Level = 0x21;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = '+';
- pTVar3->Flags = 1;
- pTVar3->Amount = 4;
- pTVar3->RuneLevel = 6;
- pTVar3->SoulPoints = 4;
- pTVar3->Comment = "Fire Wall";
- pTVar3 = CreateSpell(0x1d,"ex",&DAT_081075ea,&DAT_080fe42d,&DAT_080fed0c);
- pTVar3->Mana = 0x1e;
- pTVar3->Level = 10;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Antidote";
- pTVar3 = CreateSpell(0x1e,"ad",&DAT_080fe45e,&DAT_080fe41d,&DAT_080fed0c);
- pTVar3->Mana = 0x78;
- pTVar3->Level = 0x11;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = '\x01';
- pTVar3->Flags = 0;
- pTVar3->Amount = 3;
- pTVar3->RuneLevel = 3;
- pTVar3->SoulPoints = 2;
- pTVar3->Comment = "Destroy Field";
- pTVar3 = CreateSpell(0x1f,"ad",&DAT_081075ea,&DAT_080fe42d,&DAT_080fed0c);
- pTVar3->Mana = 200;
- pTVar3->Level = 0xf;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = '\x06';
- pTVar3->Flags = 0;
- pTVar3->Amount = 1;
- pTVar3->RuneLevel = 0;
- pTVar3->SoulPoints = 1;
- pTVar3->Comment = "Antidote Rune";
- pTVar3 = CreateSpell(0x20,"ad",&DAT_080fe34f,&DAT_080fe3c0,&DAT_080fe41d,&DAT_080fe42d,
- &DAT_080fed0c);
- pTVar3->Mana = 0x280;
- pTVar3->Level = 0x1d;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = '\x1d';
- pTVar3->Flags = 1;
- pTVar3->Amount = 4;
- pTVar3->RuneLevel = 5;
- pTVar3->SoulPoints = 3;
- pTVar3->Comment = "Poison Wall";
- pTVar3 = CreateSpell(0x21,"ad",&DAT_080fe34f,&DAT_080fe3c0,&DAT_080fe41d,&DAT_080fe3e7,
- &DAT_080fed0c);
- pTVar3->Mana = 1000;
- pTVar3->Level = 0x29;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = '\x13';
- pTVar3->Flags = 1;
- pTVar3->Amount = 4;
- pTVar3->RuneLevel = 9;
- pTVar3->SoulPoints = 5;
- pTVar3->Comment = "Energy Wall";
- pTVar3 = CreateSpell(0x22,"al",&DAT_080fe34f,&DAT_080fe34a,&DAT_080fe34a,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Get Item";
- pTVar3 = CreateSpell(0x23,"al",&DAT_080fe34f,&DAT_080fe34a,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Get Item";
- pTVar3 = CreateSpell(0x25,"al",&DAT_080fe31a,&DAT_080fe34a,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Move";
- pTVar3 = CreateSpell(0x26,"ut",&DAT_080fe34f,"res",&DAT_080fe39e,&DAT_080fe34a,&DAT_080fed0c);
- pTVar3->Mana = 100;
- pTVar3->Level = 0x17;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Creature Illusion";
- pTVar3 = CreateSpell(0x27,"ut",&DAT_080fe31a,&DAT_080fe2c0,&DAT_080fe316,&DAT_080fed0c);
- pTVar3->Mana = 100;
- pTVar3->Level = 0x14;
- pTVar3->Flags = 2;
- pTVar3->Comment = "Strong Haste";
- pTVar3 = CreateSpell(0x28,"al",&DAT_080fe34f,"cogni",&DAT_080fe34a,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Get Experience";
- pTVar3 = CreateSpell(0x29,"al",&DAT_080fe377,&DAT_080fe34a,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Change Data";
- pTVar3 = CreateSpell(0x2a,"ex",&DAT_080fe34f,&DAT_080fe4e4,&DAT_080fed0c);
- pTVar3->Mana = 0x78;
- pTVar3->Level = 0xe;
- pTVar3->SoulPoints = 1;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Food";
- pTVar3 = CreateSpell(0x2c,"ut",&DAT_080fe4ed,&DAT_080fe2d5,&DAT_080fed0c);
- pTVar3->Mana = 0x32;
- pTVar3->Level = 0xe;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Magic Shield";
- pTVar3 = CreateSpell(0x2d,"ut",&DAT_081075ea,&DAT_080fe4fe,&DAT_080fed0c);
- pTVar3->Mana = 0x1b8;
- pTVar3->Level = 0x23;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Invisible";
- pTVar3 = CreateSpell(0x2e,"al",&DAT_080fe34f,"cogni",&DAT_080fe34a,&DAT_080fe34a,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Get Skill Experience";
- pTVar3 = CreateSpell(0x2f,"al",&DAT_080fe31a,&DAT_080fe373,&DAT_080fe34a,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Teleport to Friend";
- pTVar3 = CreateSpell(0x30,"ex",&DAT_080fe34f,&DAT_080fe534,&DAT_080fe42d,&DAT_080fed0c);
- pTVar3->Mana = 0x82;
- pTVar3->Level = 0x10;
- pTVar3->SoulPoints = 2;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Poisoned Arrow";
- pTVar3 = CreateSpell(0x31,"ex",&DAT_080fe34f,&DAT_080fe534,&DAT_080fe3ac,&DAT_080fed0c);
- pTVar3->Mana = 0x122;
- pTVar3->Level = 0x19;
- pTVar3->SoulPoints = 3;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Explosive Arrow";
- pTVar3 = CreateSpell(0x32,"ad",&DAT_080fe34f,"res",&DAT_080fe3ac,&DAT_080fed0c);
- pTVar3->Mana = 600;
- pTVar3->Level = 0x1b;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = '0';
- pTVar3->Flags = 3;
- pTVar3->Amount = 2;
- pTVar3->RuneLevel = 7;
- pTVar3->SoulPoints = 3;
- pTVar3->Comment = "Soulfire";
- pTVar3 = CreateSpell(0x33,"ex",&DAT_080fe34f,&DAT_080fe534,&DAT_080fed0c);
- pTVar3->Mana = 100;
- pTVar3->Level = 0xd;
- pTVar3->SoulPoints = 1;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Conjure Arrow";
- pTVar3 = CreateSpell(0x34,"al","liber",&DAT_080fe373,&DAT_080fe34a,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Retrieve Friend";
- pTVar3 = CreateSpell(0x35,"al",&DAT_080fe34f,"res",&DAT_080fe34a,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Summon Wild Creature";
- pTVar3 = CreateSpell(0x36,"ad",&DAT_081075ea,&DAT_080fe31a,&DAT_080fed0c);
- pTVar3->Mana = 0x578;
- pTVar3->Level = 0x36;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = '\x12';
- pTVar3->Flags = 3;
- pTVar3->Amount = 1;
- pTVar3->RuneLevel = 0x12;
- pTVar3->SoulPoints = 3;
- pTVar3->Comment = "Paralyze";
- pTVar3 = CreateSpell(0x37,"ad",&DAT_080fe34f,&DAT_080fe3c0,&DAT_080fe3e7,&DAT_080fed0c);
- pTVar3->Mana = 0x370;
- pTVar3->Level = 0x25;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = '\x02';
- pTVar3->Flags = 3;
- pTVar3->Amount = 2;
- pTVar3->RuneLevel = 10;
- pTVar3->SoulPoints = 5;
- pTVar3->Comment = "Energybomb";
- pTVar3 = CreateSpell(0x38,"ex",&DAT_080fe34f,&DAT_080fe2c0,&DAT_080fe3c0,&DAT_080fe42d,
- &DAT_080fed0c);
- pTVar3->Mana = 600;
- pTVar3->Level = 0x32;
- pTVar3->Flags = 3;
- pTVar3->Comment = "Poison Storm";
- pTVar3 = CreateSpell(0x39,"om",&DAT_081075ea,"liber",&DAT_080fe34a,&DAT_080fe34a,&DAT_080fe34a,
- &DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Banish Account";
- pTVar3 = CreateSpell(0x3a,"al",&DAT_080fe3d7,&DAT_080fe5c9,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Get Position";
- pTVar3 = CreateSpell(0x3c,"om",&DAT_080fe31a,&DAT_080fe34a,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Temple Teleport";
- pTVar3 = CreateSpell(0x3d,"om",&DAT_081075ea,&DAT_080fe2c0,"liber",&DAT_080fe34a,&DAT_080fe34a,
- &DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Delete Account";
- pTVar3 = CreateSpell(0x3e,"om",&DAT_080fe4ed,&DAT_080fe34a,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Set Namerule";
- pTVar3 = CreateSpell(0x3f,"al",&DAT_080fe34f,&DAT_080fe3e7,&DAT_080fe34a,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Create Gold";
- pTVar3 = CreateSpell(0x40,"al",&DAT_080fe377,&DAT_080fe2d5,&DAT_080fe34a,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Change Profession or Sex";
- pTVar3 = CreateSpell(0x41,"om",&DAT_080fe62c,&DAT_080fe34a,&DAT_080fe34a,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Entry in Criminal Record";
- pTVar3 = CreateSpell(0x42,"om",&DAT_081075ea,&DAT_080fe649,&DAT_080fe34a,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Namelock";
- pTVar3 = CreateSpell(0x43,"om",&DAT_081075ea,&DAT_080fe34a,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Kick Player";
- pTVar3 = CreateSpell(0x44,"om",&DAT_081075ea,&DAT_080fe2c0,"res",&DAT_080fe34a,&DAT_080fe34a,
- &DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Delete Character";
- pTVar3 = CreateSpell(0x45,"om",&DAT_081075ea,&DAT_080fe3e7,&DAT_080fe34a,&DAT_080fe34a,
- &DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Banish IP Address";
- pTVar3 = CreateSpell(0x46,"om",&DAT_081075ea,"res",&DAT_080fe34a,&DAT_080fe34a,&DAT_080fe34a,
- &DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Banish Character";
- pTVar3 = CreateSpell(0x47,"al",&DAT_080fe377,&DAT_080fe373,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Invite Guests";
- pTVar3 = CreateSpell(0x48,"al",&DAT_080fe377,&DAT_080fe6a5,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Invite Subowners";
- pTVar3 = CreateSpell(0x49,"al",&DAT_081075ea,&DAT_080fe373,&DAT_080fe34a,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Kick Guest";
- pTVar3 = CreateSpell(0x4a,"al",&DAT_080fe377,&DAT_080fe41d,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Edit Door";
- pTVar3 = CreateSpell(0x4b,"ut",&DAT_080fe34f,&DAT_080fe3e7,&DAT_080fe363,&DAT_080fed0c);
- pTVar3->Mana = 0x8c;
- pTVar3->Level = 0x1a;
- pTVar3->Flags = 2;
- pTVar3->Comment = "Ultimate Light";
- pTVar3 = CreateSpell(0x4c,"ex",&DAT_080fe31a,&DAT_080fe5c9,&DAT_080fed0c);
- pTVar3->Mana = 0x14;
- pTVar3->Level = 9;
- pTVar3->Flags = 2;
- pTVar3->Comment = "Magic Rope";
- pTVar3 = CreateSpell(0x4d,"ad",&DAT_080fe34f,"res",&DAT_080fe42d,&DAT_080fed0c);
- pTVar3->Mana = 400;
- pTVar3->Level = 0x15;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = ' ';
- pTVar3->Flags = 3;
- pTVar3->Amount = 1;
- pTVar3->RuneLevel = 4;
- pTVar3->SoulPoints = 2;
- pTVar3->Comment = "Envenom";
- pTVar3 = CreateSpell(0x4e,"ad",&DAT_080fe45e,&DAT_080fe5c9,&DAT_080fed0c);
- pTVar3->Mana = 200;
- pTVar3->Level = 0x15;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = '2';
- pTVar3->Amount = 3;
- pTVar3->RuneLevel = 4;
- pTVar3->SoulPoints = 3;
- pTVar3->Flags = 3;
- pTVar3->Comment = "Desintegrate";
- pTVar3 = CreateSpell(0x4f,"ex",&DAT_080fe34f,&DAT_080fe534,&DAT_080fe38d,&DAT_080fed0c);
- pTVar3->Mana = 0x8c;
- pTVar3->Level = 0x11;
- pTVar3->SoulPoints = 2;
- pTVar3->Flags = 2;
- pTVar3->Comment = "Conjure Bolt";
- pTVar3 = CreateSpell(0x50,"ex",&DAT_080fe31e,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0x23;
- pTVar3->Flags = 7;
- pTVar3->Comment = "Berserk";
- pTVar3 = CreateSpell(0x51,"ex",&DAT_080fe31a,&DAT_080fe316,&DAT_080fe34a,&DAT_080fed0c);
- pTVar3->Mana = 0x32;
- pTVar3->Level = 0xc;
- pTVar3->Flags = 2;
- pTVar3->Comment = "Levitate";
- pTVar3 = CreateSpell(0x52,"ex",&DAT_080fe2ae,&DAT_080fe2c0,&DAT_080fe3c0,"res",&DAT_080fed0c);
- pTVar3->Mana = 0x96;
- pTVar3->Level = 0x24;
- pTVar3->Flags = 10;
- pTVar3->Comment = "Mass Healing";
- pTVar3 = CreateSpell(0x53,"ad",&DAT_081075ea,&DAT_080fe38d,&DAT_080fed0c);
- pTVar3->Mana = 600;
- pTVar3->Level = 0x1b;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = '8';
- pTVar3->Amount = 1;
- pTVar3->RuneLevel = 4;
- pTVar3->SoulPoints = 5;
- pTVar3->Flags = 3;
- pTVar3->Comment = "Animate Dead";
- pTVar3 = CreateSpell(0x54,"ex",&DAT_080fe2ae,&DAT_080fe373,&DAT_080fe34a,&DAT_080fed0c);
- pTVar3->Mana = 0x46;
- pTVar3->Level = 0x12;
- pTVar3->Flags = 10;
- pTVar3->Comment = "Heal Friend";
- pTVar3 = CreateSpell(0x55,"ex",&DAT_081075ea,&DAT_080fe3c0,&DAT_080fe38d,&DAT_080fed0c);
- pTVar3->Mana = 500;
- pTVar3->Level = 0x1e;
- pTVar3->Flags = 3;
- pTVar3->Comment = "Undead Legion";
- pTVar3 = CreateSpell(0x56,"ad",&DAT_080fe34f,&DAT_080fe41d,&DAT_080fe5c9,&DAT_080fed0c);
- pTVar3->Mana = 0x2ee;
- pTVar3->Level = 0x20;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = '!';
- pTVar3->Amount = 3;
- pTVar3->RuneLevel = 9;
- pTVar3->SoulPoints = 5;
- pTVar3->Flags = 3;
- pTVar3->Comment = "Magic Wall";
- pTVar3 = CreateSpell(0x57,"ex",&DAT_080fe31e,&DAT_080fe38d,&DAT_080fed0c);
- pTVar3->Mana = 0x14;
- pTVar3->Level = 0xb;
- pTVar3->Flags = 3;
- pTVar3->Comment = "Force Strike";
- pTVar3 = CreateSpell(0x58,"ex",&DAT_080fe31e,&DAT_080fe3e7,&DAT_080fed0c);
- pTVar3->Mana = 0x14;
- pTVar3->Level = 0xc;
- pTVar3->Flags = 3;
- pTVar3->Comment = "Energy Strike";
- pTVar3 = CreateSpell(0x59,"ex",&DAT_080fe31e,&DAT_080fe3ac,&DAT_080fed0c);
- pTVar3->Mana = 0x14;
- pTVar3->Level = 0xc;
- pTVar3->Flags = 3;
- pTVar3->Comment = "Flame Strike";
- pTVar3 = CreateSpell(0x5a,"ex",&DAT_081075ea,&DAT_080fe39e,&DAT_080fed0c);
- pTVar3->Mana = 200;
- pTVar3->Level = 0x1a;
- pTVar3->Flags = 2;
- pTVar3->Comment = "Cancel Invisibility";
- pTVar3 = CreateSpell(0x5b,"ad",&DAT_080fe34f,&DAT_080fe3c0,&DAT_080fe42d,&DAT_080fed0c);
- pTVar3->Mana = 0x208;
- pTVar3->Level = 0x19;
- pTVar3->RuneGr = 'O';
- pTVar3->RuneNr = '\x1a';
- pTVar3->Flags = 3;
- pTVar3->Amount = 2;
- pTVar3->RuneLevel = 4;
- pTVar3->SoulPoints = 2;
- pTVar3->Comment = "Poisonbomb";
- pTVar3 = CreateSpell(0x5c,"ex",&DAT_080fe377,&DAT_080fe3e7,&DAT_080fed0c);
- pTVar3->Mana = 0x50;
- pTVar3->Level = 0x29;
- pTVar3->Flags = 2;
- pTVar3->Comment = "Enchant Staff";
- pTVar3 = CreateSpell(0x5d,"ex",&DAT_080fe377,"res",&DAT_080fed0c);
- pTVar3->Mana = 0x1e;
- pTVar3->Level = 0x14;
- pTVar3->Flags = 3;
- pTVar3->Comment = "Challenge";
- pTVar3 = CreateSpell(0x5e,"ex",&DAT_080fe34f,&DAT_080fe41d,&DAT_080fe2d5,&DAT_080fed0c);
- pTVar3->Mana = 0xdc;
- pTVar3->Level = 0x1b;
- pTVar3->Flags = 3;
- pTVar3->Comment = "Wild Growth";
- pTVar3 = CreateSpell(0x5f,"ex",&DAT_080fe34f,&DAT_080fe534,&DAT_080fe3e7,&DAT_080fed0c);
- pTVar3->Mana = 800;
- pTVar3->Level = 0x3b;
- pTVar3->SoulPoints = 3;
- pTVar3->Flags = 2;
- pTVar3->Comment = "Power Bolt";
- pTVar3 = CreateSpell(0x60,"al",&DAT_080fe3d7,"cogni",&DAT_080fe34a,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Get Quest Value";
- pTVar3 = CreateSpell(0x61,"al",&DAT_080fe377,"cogni",&DAT_080fe34a,&DAT_080fe34a,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Set Quest Value";
- pTVar3 = CreateSpell(0x62,"al",&DAT_080fe45e,&DAT_080fe5c9,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Desintegrate Spell";
- pTVar3 = CreateSpell(99,"al",&DAT_080fe31a,&DAT_080fe316,&DAT_080fe34a,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Levitate Gamemaster";
- pTVar3 = CreateSpell(100,"al",&DAT_081075ea,"cogni",&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Clear Quest Values";
- pTVar3 = CreateSpell(0x65,"al",&DAT_080fe45e,&DAT_080fe3c0,"res",&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Kill All Creatures";
- pTVar3 = CreateSpell(0x66,"al",&DAT_080fe34f,&DAT_080fe3c0,"res",&DAT_080fe34a,&DAT_080fed0c);
- pTVar3->Mana = 0;
- pTVar3->Level = 0;
- pTVar3->Flags = 0;
- pTVar3->Comment = "Start Monsterraid";
- return;
-}
-
-
-
-// WARNING: Unknown calling convention -- yet parameter storage is locked
-
-void InitMagic(void)
-
-{
- // try { // try from 0808db16 to 0808db2b has its CatchHandler @ 0808db30
- InitCircles();
- InitSpells();
- InitLog("banish");
- return;
-}
-
-
-
-// WARNING: Unknown calling convention -- yet parameter storage is locked
-
-void ExitMagic(void)
-
-{
- return;
-}
-
-
-
void CreateField(int x,int y,int z,int FieldType,ulong Owner,bool Peaceful)
{
diff --git a/reference/types.hh b/reference/types.hh
index 2147440..507ea78 100644
--- a/reference/types.hh
+++ b/reference/types.hh
@@ -1,23 +1,4 @@
-struct TCircle {
- int x[32];
- int y[32];
- int Count;
-};
-
-struct TSpellList {
- uint8 Syllable[10];
- uint8 RuneGr;
- uint8 RuneNr;
- char *Comment;
- uint16 Level;
- uint16 RuneLevel;
- uint16 Flags;
- int Mana;
- int SoulPoints;
- int Amount;
-};
-
struct TXTEASymmetricKey {
int (**_vptr.TXTEASymmetricKey)(...); // VTABLE?
uint8 m_SymmetricKey[16];
diff --git a/src/magic.cc b/src/magic.cc
index 5d6acad..3a7ed45 100644
--- a/src/magic.cc
+++ b/src/magic.cc
@@ -4,6 +4,11 @@
#include "stubs.hh"
+#include <fstream>
+
+static TSpellList SpellList[256];
+static TCircle Circle[10];
+
static const char SpellSyllable[51][6] = {
"",
"al",
@@ -146,9 +151,829 @@ void CheckMana(TCreature *Creature, int ManaPoints, int SoulPoints, int Delay){
Creature->Skills[SKILL_MAGIC_LEVEL]->Increase(ManaPoints);
}
- // NOTE(fusion): Maintain largest exhaust?
uint32 EarliestSpellTime = ServerMilliseconds + Delay;
if(Creature->EarliestSpellTime < EarliestSpellTime){
Creature->EarliestSpellTime = EarliestSpellTime;
}
}
+
+static void InitCircles(void){
+ char FileName[4096];
+ snprintf(FileName, sizeof(FileName), "%s/circles.dat", DATAPATH);
+ std::ifstream IN(FileName, std::ios_base::in);
+ if(IN.fail()){
+ error("InitCircles: Kann Datei %s nicht öffnen.\n", FileName);
+ throw "Cannot open \"circles.dat\"";
+ }
+
+ // TODO(fusion): This doesn't make a lot of sense because we have `Width`
+ // and `Height` but not `CenterX` and `CenterY`.
+ int Width, Height, Center;
+ IN >> Width >> Height >> Center;
+
+ if(Width < 0 || Width > 21 || Height < 0 || Height > 21){
+ error("InitCircles: Ungültiges Dateiformat.\n");
+ throw "Cannot process \"circles.dat\"";
+ }
+
+ if(Center > 0){
+ for(int Y = 0; Y < Height; Y += 1)
+ for(int X = 0; X < Width; X += 1){
+ int Radius;
+ IN >> Radius;
+ if(Radius < NARRAY(Circle)){
+ int PointIndex = Circle[Radius].Count;
+ ASSERT(PointIndex < 32);
+ Circle[Radius].x[PointIndex] = X - Center;
+ Circle[Radius].y[PointIndex] = Y - Center;
+ Circle[Radius].Count += 1;
+ }
+ }
+ }
+
+ // TODO(fusion): Probably check if we parsed the file successfully?
+ //if(IN.fail()) { throw "..."; }
+}
+
+static TSpellList *CreateSpell(int SpellNr, ...){
+ ASSERT(SpellNr < NARRAY(SpellList));
+ int SyllableCount = 0;
+ TSpellList *Spell = &SpellList[SpellNr];
+
+ va_list ap;
+ va_start(ap, SpellNr);
+ while(true){
+ const char *Syllable = va_arg(ap, const char*);
+ if(!Syllable || Syllable[0] == 0){
+ break;
+ }
+
+ for(int SyllableNr = 0;
+ SyllableNr < NARRAY(SpellSyllable);
+ SyllableNr += 1){
+ if(strcmp(SpellSyllable[SyllableNr], Syllable) == 0){
+ // TODO(fusion): I'm not sure it is a good idea to throw an
+ // exception between `va_start` and `va_end`.
+ if(SyllableCount > NARRAY(Spell->Syllable)){
+ error("CreateSpell: Silbenzahl überschritten bei Spell %d.\n", SpellNr);
+ throw "Spell has too many syllables";
+ }
+
+ Spell->Syllable[SyllableCount] = (uint8)SyllableNr;
+ SyllableCount += 1;
+ break;
+ }
+ }
+ }
+ va_end(ap);
+ return Spell;
+}
+
+void InitSpells(void){
+ TSpellList *Spell;
+
+ Spell = CreateSpell(1, "ex", "ura", "");
+ Spell->Mana = 25;
+ Spell->Level = 9;
+ Spell->Flags = 8;
+ Spell->Comment = "Light Healing";
+
+ Spell = CreateSpell(2, "ex", "ura", "gran", "");
+ Spell->Mana = 40;
+ Spell->Level = 11;
+ Spell->Flags = 8;
+ Spell->Comment = "Intense Healing";
+
+ Spell = CreateSpell(3, "ex", "ura", "vita", "");
+ Spell->Mana = 160;
+ Spell->Level = 20;
+ Spell->Flags = 8;
+ Spell->Comment = "Ultimate Healing";
+
+ Spell = CreateSpell(4, "ad", "ura", "gran", "");
+ Spell->Mana = 240;
+ Spell->Level = 15;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 5;
+ Spell->Flags = 8;
+ Spell->Amount = 1;
+ Spell->RuneLevel = 1;
+ Spell->SoulPoints = 2;
+ Spell->Comment = "Intense Healing Rune";
+
+ Spell = CreateSpell(5, "ad", "ura", "vita", "");
+ Spell->Mana = 400;
+ Spell->Level = 24;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 13;
+ Spell->Flags = 8;
+ Spell->Amount = 1;
+ Spell->RuneLevel = 4;
+ Spell->SoulPoints = 3;
+ Spell->Comment = "Ultimate Healing Rune";
+
+ Spell = CreateSpell(6, "ut", "ani", "hur", "");
+ Spell->Mana = 60;
+ Spell->Level = 14;
+ Spell->Flags = 2;
+ Spell->Comment = "Haste";
+
+ Spell = CreateSpell(7, "ad", "ori", "");
+ Spell->Mana = 120;
+ Spell->Level = 15;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 27;
+ Spell->Flags = 9;
+ Spell->Amount = 5;
+ Spell->RuneLevel = 0;
+ Spell->SoulPoints = 1;
+ Spell->Comment = "Light Magic Missile";
+
+ Spell = CreateSpell(8, "ad", "ori", "gran", "");
+ Spell->Mana = 280;
+ Spell->Level = 25;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 51;
+ Spell->Flags = 9;
+ Spell->Amount = 5;
+ Spell->RuneLevel = 4;
+ Spell->SoulPoints = 2;
+ Spell->Comment = "Heavy Magic Missile";
+
+ Spell = CreateSpell(9, "ut", "evo", "res", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 25;
+ Spell->Flags = 1;
+ Spell->Comment = "Summon Creature";
+
+ Spell = CreateSpell(10, "ut", "evo", "lux", "");
+ Spell->Mana = 20;
+ Spell->Level = 8;
+ Spell->Flags = 0;
+ Spell->Comment = "Light";
+
+ Spell = CreateSpell(11, "ut", "evo", "gran", "lux", "");
+ Spell->Mana = 60;
+ Spell->Level = 13;
+ Spell->Flags = 0;
+ Spell->Comment = "Great Light";
+
+ Spell = CreateSpell(12, "ad", "eta", "sio", "");
+ Spell->Mana = 200;
+ Spell->Level = 16;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 30;
+ Spell->Flags = 1;
+ Spell->Amount = 1;
+ Spell->RuneLevel = 5;
+ Spell->SoulPoints = 3;
+ Spell->Comment = "Convince Creature";
+
+ Spell = CreateSpell(13, "ex", "evo", "mort", "hur", "");
+ Spell->Mana = 250;
+ Spell->Level = 38;
+ Spell->Flags = 1;
+ Spell->Comment = "Energy Wave";
+
+ Spell = CreateSpell(14, "ad", "evo", "ina", "");
+ Spell->Mana = 600;
+ Spell->Level = 27;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 31;
+ Spell->Flags = 0;
+ Spell->Amount = 1;
+ Spell->RuneLevel = 4;
+ Spell->SoulPoints = 2;
+ Spell->Comment = "Chameleon";
+
+ Spell = CreateSpell(15, "ad", "ori", "flam", "");
+ Spell->Mana = 160;
+ Spell->Level = 17;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 42;
+ Spell->Flags = 9;
+ Spell->Amount = 2;
+ Spell->RuneLevel = 2;
+ Spell->SoulPoints = 2;
+ Spell->Comment = "Fireball";
+
+ Spell = CreateSpell(16, "ad", "ori", "gran", "flam", "");
+ Spell->Mana = 480;
+ Spell->Level = 23;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 44;
+ Spell->Flags = 9;
+ Spell->Amount = 2;
+ Spell->RuneLevel = 4;
+ Spell->SoulPoints = 3;
+ Spell->Comment = "Great Fireball";
+
+ Spell = CreateSpell(17, "ad", "evo", "mas", "flam", "");
+ Spell->Mana = 600;
+ Spell->Level = 27;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 45;
+ Spell->Flags = 1;
+ Spell->Amount = 2;
+ Spell->RuneLevel = 5;
+ Spell->SoulPoints = 4;
+ Spell->Comment = "Firebomb";
+
+ Spell = CreateSpell(18, "ad", "evo", "mas", "hur", "");
+ Spell->Mana = 720;
+ Spell->Level = 31;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 53;
+ Spell->Flags = 1;
+ Spell->Amount = 3;
+ Spell->RuneLevel = 6;
+ Spell->SoulPoints = 4;
+ Spell->Comment = "Explosion";
+
+ Spell = CreateSpell(19, "ex", "evo", "flam", "hur", "");
+ Spell->Mana = 80;
+ Spell->Level = 18;
+ Spell->Flags = 9;
+ Spell->Comment = "Fire Wave";
+
+ Spell = CreateSpell(20, "ex", "iva", "para", "");
+ Spell->Mana = 20;
+ Spell->Level = 8;
+ Spell->Flags = 0;
+ Spell->Comment = "Find Person";
+
+ Spell = CreateSpell(21, "ad", "ori", "vita", "vis", "");
+ Spell->Mana = 880;
+ Spell->Level = 45;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 8;
+ Spell->Flags = 1;
+ Spell->Amount = 1;
+ Spell->RuneLevel = 15;
+ Spell->SoulPoints = 5;
+ Spell->Comment = "Sudden Death";
+
+ Spell = CreateSpell(22, "ex", "evo", "vis", "lux", "");
+ Spell->Mana = 100;
+ Spell->Level = 23;
+ Spell->Flags = 1;
+ Spell->Comment = "Energy Beam";
+
+ Spell = CreateSpell(23, "ex", "evo", "gran", "vis", "lux", "");
+ Spell->Mana = 200;
+ Spell->Level = 29;
+ Spell->Flags = 1;
+ Spell->Comment = "Great Energy Beam";
+
+ Spell = CreateSpell(24, "ex", "evo", "gran", "mas", "vis", "");
+ Spell->Mana = 1200;
+ Spell->Level = 60;
+ Spell->Flags = 3;
+ Spell->Comment = "Ultimate Explosion";
+
+ Spell = CreateSpell(25, "ad", "evo", "grav", "flam", "");
+ Spell->Mana = 240;
+ Spell->Level = 15;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 41;
+ Spell->Flags = 1;
+ Spell->Amount = 3;
+ Spell->RuneLevel = 1;
+ Spell->SoulPoints = 1;
+ Spell->Comment = "Fire Field";
+
+ Spell = CreateSpell(26, "ad", "evo", "grav", "pox", "");
+ Spell->Mana = 200;
+ Spell->Level = 14;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 25;
+ Spell->Flags = 1;
+ Spell->Amount = 3;
+ Spell->RuneLevel = 0;
+ Spell->SoulPoints = 1;
+ Spell->Comment = "Poison Field";
+
+ Spell = CreateSpell(27, "ad", "evo", "grav", "vis", "");
+ Spell->Mana = 320;
+ Spell->Level = 18;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 17;
+ Spell->Flags = 1;
+ Spell->Amount = 3;
+ Spell->RuneLevel = 3;
+ Spell->SoulPoints = 2;
+ Spell->Comment = "Energy Field";
+
+ Spell = CreateSpell(28, "ad", "evo", "mas", "grav", "flam", "");
+ Spell->Mana = 780;
+ Spell->Level = 33;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 43;
+ Spell->Flags = 1;
+ Spell->Amount = 4;
+ Spell->RuneLevel = 6;
+ Spell->SoulPoints = 4;
+ Spell->Comment = "Fire Wall";
+
+ Spell = CreateSpell(29, "ex", "ana", "pox", "");
+ Spell->Mana = 30;
+ Spell->Level = 10;
+ Spell->Flags = 0;
+ Spell->Comment = "Antidote";
+
+ Spell = CreateSpell(30, "ad", "ito", "grav", "");
+ Spell->Mana = 120;
+ Spell->Level = 17;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 1;
+ Spell->Flags = 0;
+ Spell->Amount = 3;
+ Spell->RuneLevel = 3;
+ Spell->SoulPoints = 2;
+ Spell->Comment = "Destroy Field";
+
+ Spell = CreateSpell(31, "ad", "ana", "pox", "");
+ Spell->Mana = 200;
+ Spell->Level = 15;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 6;
+ Spell->Flags = 0;
+ Spell->Amount = 1;
+ Spell->RuneLevel = 0;
+ Spell->SoulPoints = 1;
+ Spell->Comment = "Antidote Rune";
+
+ Spell = CreateSpell(32, "ad", "evo", "mas", "grav", "pox", "");
+ Spell->Mana = 640;
+ Spell->Level = 29;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 29;
+ Spell->Flags = 1;
+ Spell->Amount = 4;
+ Spell->RuneLevel = 5;
+ Spell->SoulPoints = 3;
+ Spell->Comment = "Poison Wall";
+
+ Spell = CreateSpell(33, "ad", "evo", "mas", "grav", "vis", "");
+ Spell->Mana = 1000;
+ Spell->Level = 41;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 19;
+ Spell->Flags = 1;
+ Spell->Amount = 4;
+ Spell->RuneLevel = 9;
+ Spell->SoulPoints = 5;
+ Spell->Comment = "Energy Wall";
+
+ Spell = CreateSpell(34, "al", "evo", "para", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Get Item";
+
+ Spell = CreateSpell(35, "al", "evo", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Get Item";
+
+ Spell = CreateSpell(37, "al", "ani", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Move";
+
+ Spell = CreateSpell(38, "ut", "evo", "res", "ina", "para", "");
+ Spell->Mana = 100;
+ Spell->Level = 23;
+ Spell->Flags = 0;
+ Spell->Comment = "Creature Illusion";
+
+ Spell = CreateSpell(39, "ut", "ani", "gran", "hur", "");
+ Spell->Mana = 100;
+ Spell->Level = 20;
+ Spell->Flags = 2;
+ Spell->Comment = "Strong Haste";
+
+ Spell = CreateSpell(40, "al", "evo", "cogni", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Get Experience";
+
+ Spell = CreateSpell(41, "al", "eta", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Change Data";
+
+ Spell = CreateSpell(42, "ex", "evo", "pan", "");
+ Spell->Mana = 120;
+ Spell->Level = 14;
+ Spell->SoulPoints = 1;
+ Spell->Flags = 0;
+ Spell->Comment = "Food";
+
+ Spell = CreateSpell(44, "ut", "amo", "vita", "");
+ Spell->Mana = 50;
+ Spell->Level = 14;
+ Spell->Flags = 0;
+ Spell->Comment = "Magic Shield";
+
+ Spell = CreateSpell(45, "ut", "ana", "vid", "");
+ Spell->Mana = 440;
+ Spell->Level = 35;
+ Spell->Flags = 0;
+ Spell->Comment = "Invisible";
+
+ Spell = CreateSpell(46, "al", "evo", "cogni", "para", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Get Skill Experience";
+
+ Spell = CreateSpell(47, "al", "ani", "sio", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Teleport to Friend";
+
+ Spell = CreateSpell(48, "ex", "evo", "con", "pox", "");
+ Spell->Mana = 130;
+ Spell->Level = 16;
+ Spell->SoulPoints = 2;
+ Spell->Flags = 0;
+ Spell->Comment = "Poisoned Arrow";
+
+ Spell = CreateSpell(49, "ex", "evo", "con", "flam", "");
+ Spell->Mana = 290;
+ Spell->Level = 25;
+ Spell->SoulPoints = 3;
+ Spell->Flags = 0;
+ Spell->Comment = "Explosive Arrow";
+
+ Spell = CreateSpell(50, "ad", "evo", "res", "flam", "");
+ Spell->Mana = 600;
+ Spell->Level = 27;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 48;
+ Spell->Flags = 3;
+ Spell->Amount = 2;
+ Spell->RuneLevel = 7;
+ Spell->SoulPoints = 3;
+ Spell->Comment = "Soulfire";
+
+ Spell = CreateSpell(51, "ex", "evo", "con", "");
+ Spell->Mana = 100;
+ Spell->Level = 13;
+ Spell->SoulPoints = 1;
+ Spell->Flags = 0;
+ Spell->Comment = "Conjure Arrow";
+
+ Spell = CreateSpell(52, "al", "liber", "sio", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Retrieve Friend";
+
+ Spell = CreateSpell(53, "al", "evo", "res", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Summon Wild Creature";
+
+ Spell = CreateSpell(54, "ad", "ana", "ani", "");
+ Spell->Mana = 1400;
+ Spell->Level = 54;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 18;
+ Spell->Flags = 3;
+ Spell->Amount = 1;
+ Spell->RuneLevel = 18;
+ Spell->SoulPoints = 3;
+ Spell->Comment = "Paralyze";
+
+ Spell = CreateSpell(55, "ad", "evo", "mas", "vis", "");
+ Spell->Mana = 880;
+ Spell->Level = 37;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 2;
+ Spell->Flags = 3;
+ Spell->Amount = 2;
+ Spell->RuneLevel = 10;
+ Spell->SoulPoints = 5;
+ Spell->Comment = "Energybomb";
+
+ Spell = CreateSpell(56, "ex", "evo", "gran", "mas", "pox", "");
+ Spell->Mana = 600;
+ Spell->Level = 50;
+ Spell->Flags = 3;
+ Spell->Comment = "Poison Storm";
+
+ Spell = CreateSpell(57, "om", "ana", "liber", "para", "para", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Banish Account";
+
+ Spell = CreateSpell(58, "al", "iva", "tera", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Get Position";
+
+ Spell = CreateSpell(60, "om", "ani", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Temple Teleport";
+
+ Spell = CreateSpell(61, "om", "ana", "gran", "liber", "para", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Delete Account";
+
+ Spell = CreateSpell(62, "om", "amo", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Set Namerule";
+
+ Spell = CreateSpell(63, "al", "evo", "vis", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Create Gold";
+
+ Spell = CreateSpell(64, "al", "eta", "vita", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Change Profession or Sex";
+
+ Spell = CreateSpell(65, "om", "isa", "para", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Entry in Criminal Record";
+
+ Spell = CreateSpell(66, "om", "ana", "hora", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Namelock";
+
+ Spell = CreateSpell(67, "om", "ana", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Kick Player";
+
+ Spell = CreateSpell(68, "om", "ana", "gran", "res", "para", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Delete Character";
+
+ Spell = CreateSpell(69, "om", "ana", "vis", "para", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Banish IP Address";
+
+ Spell = CreateSpell(70, "om", "ana", "res", "para", "para", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Banish Character";
+
+ Spell = CreateSpell(71, "al", "eta", "sio", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Invite Guests";
+
+ Spell = CreateSpell(72, "al", "eta", "som", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Invite Subowners";
+
+ Spell = CreateSpell(73, "al", "ana", "sio", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Kick Guest";
+
+ Spell = CreateSpell(74, "al", "eta", "grav", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Edit Door";
+
+ Spell = CreateSpell(75, "ut", "evo", "vis", "lux", "");
+ Spell->Mana = 140;
+ Spell->Level = 26;
+ Spell->Flags = 2;
+ Spell->Comment = "Ultimate Light";
+
+ Spell = CreateSpell(76, "ex", "ani", "tera", "");
+ Spell->Mana = 20;
+ Spell->Level = 9;
+ Spell->Flags = 2;
+ Spell->Comment = "Magic Rope";
+
+ Spell = CreateSpell(77, "ad", "evo", "res", "pox", "");
+ Spell->Mana = 400;
+ Spell->Level = 21;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 32;
+ Spell->Flags = 3;
+ Spell->Amount = 1;
+ Spell->RuneLevel = 4;
+ Spell->SoulPoints = 2;
+ Spell->Comment = "Envenom";
+
+ Spell = CreateSpell(78, "ad", "ito", "tera", "");
+ Spell->Mana = 200;
+ Spell->Level = 21;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 50;
+ Spell->Amount = 3;
+ Spell->RuneLevel = 4;
+ Spell->SoulPoints = 3;
+ Spell->Flags = 3;
+ Spell->Comment = "Desintegrate";
+
+ Spell = CreateSpell(79, "ex", "evo", "con", "mort", "");
+ Spell->Mana = 140;
+ Spell->Level = 17;
+ Spell->SoulPoints = 2;
+ Spell->Flags = 2;
+ Spell->Comment = "Conjure Bolt";
+
+ Spell = CreateSpell(80, "ex", "ori", "");
+ Spell->Mana = 0;
+ Spell->Level = 35;
+ Spell->Flags = 7;
+ Spell->Comment = "Berserk";
+
+ Spell = CreateSpell(81, "ex", "ani", "hur", "para", "");
+ Spell->Mana = 50;
+ Spell->Level = 12;
+ Spell->Flags = 2;
+ Spell->Comment = "Levitate";
+
+ Spell = CreateSpell(82, "ex", "ura", "gran", "mas", "res", "");
+ Spell->Mana = 150;
+ Spell->Level = 36;
+ Spell->Flags = 10;
+ Spell->Comment = "Mass Healing";
+
+ Spell = CreateSpell(83, "ad", "ana", "mort", "");
+ Spell->Mana = 600;
+ Spell->Level = 27;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 56;
+ Spell->Amount = 1;
+ Spell->RuneLevel = 4;
+ Spell->SoulPoints = 5;
+ Spell->Flags = 3;
+ Spell->Comment = "Animate Dead";
+
+ Spell = CreateSpell(84, "ex", "ura", "sio", "para", "");
+ Spell->Mana = 70;
+ Spell->Level = 18;
+ Spell->Flags = 10;
+ Spell->Comment = "Heal Friend";
+
+ Spell = CreateSpell(85, "ex", "ana", "mas", "mort", "");
+ Spell->Mana = 500;
+ Spell->Level = 30;
+ Spell->Flags = 3;
+ Spell->Comment = "Undead Legion";
+
+ Spell = CreateSpell(86, "ad", "evo", "grav", "tera", "");
+ Spell->Mana = 750;
+ Spell->Level = 32;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 33;
+ Spell->Amount = 3;
+ Spell->RuneLevel = 9;
+ Spell->SoulPoints = 5;
+ Spell->Flags = 3;
+ Spell->Comment = "Magic Wall";
+
+ Spell = CreateSpell(87, "ex", "ori", "mort", "");
+ Spell->Mana = 20;
+ Spell->Level = 11;
+ Spell->Flags = 3;
+ Spell->Comment = "Force Strike";
+
+ Spell = CreateSpell(88, "ex", "ori", "vis", "");
+ Spell->Mana = 20;
+ Spell->Level = 12;
+ Spell->Flags = 3;
+ Spell->Comment = "Energy Strike";
+
+ Spell = CreateSpell(89, "ex", "ori", "flam", "");
+ Spell->Mana = 20;
+ Spell->Level = 12;
+ Spell->Flags = 3;
+ Spell->Comment = "Flame Strike";
+
+ Spell = CreateSpell(90, "ex", "ana", "ina", "");
+ Spell->Mana = 200;
+ Spell->Level = 26;
+ Spell->Flags = 2;
+ Spell->Comment = "Cancel Invisibility";
+
+ Spell = CreateSpell(91, "ad", "evo", "mas", "pox", "");
+ Spell->Mana = 520;
+ Spell->Level = 25;
+ Spell->RuneGr = 79;
+ Spell->RuneNr = 26;
+ Spell->Flags = 3;
+ Spell->Amount = 2;
+ Spell->RuneLevel = 4;
+ Spell->SoulPoints = 2;
+ Spell->Comment = "Poisonbomb";
+
+ Spell = CreateSpell(92, "ex", "eta", "vis", "");
+ Spell->Mana = 80;
+ Spell->Level = 41;
+ Spell->Flags = 2;
+ Spell->Comment = "Enchant Staff";
+
+ Spell = CreateSpell(93, "ex", "eta", "res", "");
+ Spell->Mana = 30;
+ Spell->Level = 20;
+ Spell->Flags = 3;
+ Spell->Comment = "Challenge";
+
+ Spell = CreateSpell(94, "ex", "evo", "grav", "vita", "");
+ Spell->Mana = 220;
+ Spell->Level = 27;
+ Spell->Flags = 3;
+ Spell->Comment = "Wild Growth";
+
+ Spell = CreateSpell(95, "ex", "evo", "con", "vis", "");
+ Spell->Mana = 800;
+ Spell->Level = 59;
+ Spell->SoulPoints = 3;
+ Spell->Flags = 2;
+ Spell->Comment = "Power Bolt";
+
+ Spell = CreateSpell(96, "al", "iva", "cogni", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Get Quest Value";
+
+ Spell = CreateSpell(97, "al", "eta", "cogni", "para", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Set Quest Value";
+
+ Spell = CreateSpell(98, "al", "ito", "tera", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Desintegrate Spell";
+
+ Spell = CreateSpell(99, "al", "ani", "hur", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Levitate Gamemaster";
+
+ Spell = CreateSpell(100, "al", "ana", "cogni", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Clear Quest Values";
+
+ Spell = CreateSpell(101, "al", "ito", "mas", "res", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Kill All Creatures";
+
+ Spell = CreateSpell(102, "al", "evo", "mas", "res", "para", "");
+ Spell->Mana = 0;
+ Spell->Level = 0;
+ Spell->Flags = 0;
+ Spell->Comment = "Start Monsterraid";
+}
+
+void InitMagic(void){
+ InitCircles();
+ InitSpells();
+ InitLog("banish");
+}
+
+void ExitMagic(void){
+ // no-op
+}
diff --git a/src/magic.hh b/src/magic.hh
index d24edd8..91b7c0a 100644
--- a/src/magic.hh
+++ b/src/magic.hh
@@ -2,8 +2,7 @@
#define TIBIA_MAGIC_HH_ 1
#include "common.hh"
-
-struct TCreature;
+#include "creature.hh"
struct TImpact{
// VIRTUAL FUNCTIONS
@@ -85,6 +84,25 @@ struct TDamageImpact: TImpact{
bool AllowDefense;
};
+struct TCircle {
+ int x[32];
+ int y[32];
+ int Count;
+};
+
+struct TSpellList {
+ uint8 Syllable[10];
+ uint8 RuneGr;
+ uint8 RuneNr;
+ const char *Comment;
+ uint16 Level;
+ uint16 RuneLevel;
+ uint16 Flags;
+ int Mana;
+ int SoulPoints;
+ int Amount;
+};
+
void CheckMana(TCreature *Creature, int ManaPoints, int SoulPoints, int Delay);
#endif //TIBIA_MAGIC_HH_
diff --git a/src/stubs.hh b/src/stubs.hh
index 8553177..4bb8ad2 100644
--- a/src/stubs.hh
+++ b/src/stubs.hh
@@ -37,6 +37,7 @@ extern TPlayer *GetPlayer(uint32 CreatureID);
extern int GetRacePoison(int Race);
extern void GraphicalEffect(int x, int y, int z, int Type);
extern void GraphicalEffect(Object Obj, int Type);
+extern void InitLog(const char *ProtocolName);
extern void Log(const char *ProtocolName, const char *Text, ...) ATTR_PRINTF(2, 3);
extern void LogoutAllPlayers(void);
extern void Missile(Object Start, Object Dest, int Type);