hyperkaos/Synergy.c

51 lines
1,019 B
C
Raw Permalink Normal View History

#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);
}
}