Synergy.c (raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
#include <SDL/SDL.h> #include <SDL/SDL_image.h> #include <SDL/SDL_ttf.h> #include <SDL/SDL_mixer.h> #include "enum.h" #include "Player.h" #include "Kaos.h" #include "Room.h" #include "HyperKaos.h" #include "Synergy.h" typedef struct player Player; //typedef struct room Room; //typedef struct kaos Kaos; typedef struct scene Scene; typedef struct timer Timer; typedef struct textBox TextBox; #include "extern.h" Synergy* newSynergy(int s, char d, int x, int y, int w, int h, HyperKaos* t) { Synergy* self = malloc(sizeof(Synergy)); self->spell = s; self->dir = d; self->zone = (SDL_Rect){x, y, w, h}; self->trigger = t; return self; } void deleteSynergy(Synergy* target) { free(target); } void synergize() { int i; Synergy* sigil; for (i = 0; i < rightHere->numberOfSigils; i++) { sigil = rightHere->sigils[i]; if (sigil->spell == spellFlag && (playerFaces(hero, sigil->dir) || sigil->dir == 'a') && playerIsInRect(hero, &(sigil->zone))) run(sigil->trigger); } } |