working on fleshing out the spellbook -- starting setup for phase-shift/time-travel spells
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAlwUNCgACgkQO3+8IhRO Y5jCgQ//bln/FzvhrSAAwXG5hDiRCHju9WwV+LWrLQMs6umbiCsFyFyiFfUL6XqM nEHNBaWjZceUkI2UiR7MAOXlZ4u5I9xOVJIn/F4+2K1nlukUwYusjppeuKKVyeo3 NyQoQTFaBoc1dN6xiZnwUcVivlVttJuC/N4skA/riNUISEsulv+C7b7e9NJG0lnh w21/rTbr87o5VhgaYsU/jOrRr5ODLY9bvlmlWmNdNsYcZNftbH5DhKY07mnRFqe3 eB6U2zEI2sup24NKsIqguKRVq1LpxPUCg5TIN73RnZGunrfcx7H3Usp7b738KF5n Y1HQ5i23AHsbU5LG7Wrw5ci+zwLMhLyjf11Lcl03jV38XpMEkyEJwkr1QhUDgwyp MBQ0RRnURhy4on03wov72HgINCFkDcNJA7kEg0P1fiNaEYKILQh0YGxx7M8MKlsG vDVjLKsMuJn5fmqE1Nr1MFtos0LmYKvVjXwLmSzuDPdXQPnVKSi1ujB2z9z3Coqz yRdTEapXl7dTIdLly9+HHQ2Lgpre2drRdwzZb2AlOM9FJSYKCfWCgayTaqr1BcUm DN6a1FI/vyGW8oekkIiUae0t+h68fEOC1jiAyiP1B2aITAocJVKZ7O5zrdrTiHwY Vw5QtQSzb/bPGdyoG0EORZMhswResf6iu4QevuKW6mz/vTKpBgA= =4la3 -----END PGP SIGNATURE-----
8 files changed,
83 insertions(+),
3 deletions(-)
M
Engine.c
→
Engine.c
@@ -119,6 +119,16 @@ break;
case B_BUTTON: spellbutton = 1; break; + case L_BUTTON: + bookMark--; + if (bookMark == -1) + bookMark = 1; + break; + case R_BUTTON: + bookMark++; + if (bookMark == 2) + bookMark = 0; + break; case PAUSE_BUTTON: pausemenu(); break;@@ -172,8 +182,8 @@ void kListen(int* whichKaos)
{ if (spellbutton) { - spellFlag = 0; - run(spellBook[0]); + spellFlag = bookMark; + run(spellBook[spellFlag]); synergize(); spellFlag = -1; }@@ -269,12 +279,23 @@ addKaos(testSpell, beam);
spellBook = malloc(4*sizeof(HyperKaos**)); spellBook[0] = testSpell; + + testSpell = newHyperKaos(1,0,0,0,0,0); + Kaos* stopPlayer2 = newManip(hero, 0,0); + Kaos* flash = newSpell_Flash(); + addKaos(testSpell, stopPlayer2); + addKaos(testSpell, flash); + + spellBook[1] = testSpell; + } void burnSpellBook() { cleanHyperKaos(spellBook[0]); deleteHyperKaos(spellBook[0]); + cleanHyperKaos(spellBook[1]); + deleteHyperKaos(spellBook[1]); free(spellBook); }
M
Kaos.c
→
Kaos.c
@@ -520,4 +520,51 @@
SDL_FreeSurface(kSelf->aura); free(kSelf); free(target); +} + +Kaos* newSpell_Flash() +{ + Kaos* core = rawKaos(); + Spell_Beam* self = malloc(sizeof(Spell_Flash)); + + self->core = core; + core->kType = self; + + self->aura = loadImage("assets/img/fx/mactivate.png"); + SDL_SetAlpha(self->aura, SDL_SRCALPHA|SDL_RLEACCEL, 124); + core->run = &runSpell_Flash; + core->destroy = &deleteSpell_Flash; + + return core; +} + +void runSpell_Flash(Kaos* self) +{ + Spell_Flash* kSelf = self->kType; + int i; + SDL_Rect offset, clip; + offset.x = hero->point.x - 20; + offset.y = hero->point.y - 56; + clip.x = 0; + clip.y = 0; + clip.w = 41; + clip.h = 72; + for (i = 0; i < 8; i++) + { + clip.x = 41*i; + timeStart(fps); + renderBackground(); + renderForeground(); + applySurface(offset.x, offset.y, kSelf->aura, screen, &clip); + SDL_Flip(screen); + timeDilation(); + } +} + +void deleteSpell_Flash(Kaos* target) +{ + Spell_Flash* kSelf = target->kType; + SDL_FreeSurface(kSelf->aura); + free(kSelf); + free(target); }
M
Kaos.h
→
Kaos.h
@@ -83,6 +83,12 @@ Kaos* core;
SDL_Surface* aura; } Spell_Beam; +typedef struct kaos_Spell_Flash +{ + Kaos* core; + SDL_Surface* aura; +} Spell_Flash; + Kaos* rawKaos(); Kaos* newConversation(int i);@@ -125,4 +131,8 @@ void deleteWait(Kaos* target);
Kaos* newSpell_Beam(); void runSpell_Beam(Kaos* self); -void deleteSpell_Beam(Kaos* target);+void deleteSpell_Beam(Kaos* target); + +Kaos* newSpell_Flash(); +void runSpell_Flash(Kaos* self); +void deleteSpell_Flash(Kaos* target);