2018-10-13 03:35:45 +00:00
|
|
|
#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"
|
|
|
|
|
2018-11-13 21:08:21 +00:00
|
|
|
Synergy* newSynergy(int s, char d, int x, int y, int w, int h, HyperKaos* t)
|
2018-10-13 03:35:45 +00:00
|
|
|
{
|
|
|
|
Synergy* self = malloc(sizeof(Synergy));
|
|
|
|
|
|
|
|
self->spell = s;
|
|
|
|
self->dir = d;
|
2018-11-13 21:08:21 +00:00
|
|
|
self->zone = (SDL_Rect){x, y, w, h};
|
2018-10-13 03:35:45 +00:00
|
|
|
self->trigger = t;
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
void deleteSynergy(Synergy* target)
|
|
|
|
{
|
|
|
|
free(target);
|
|
|
|
}
|
|
|
|
|
2018-11-13 21:08:21 +00:00
|
|
|
void synergize()
|
2018-10-13 03:35:45 +00:00
|
|
|
{
|
|
|
|
int i;
|
2018-11-13 21:08:21 +00:00
|
|
|
Synergy* sigil;
|
2018-10-13 03:35:45 +00:00
|
|
|
for (i = 0; i < rightHere->numberOfSigils; i++)
|
|
|
|
{
|
2018-11-13 21:08:21 +00:00
|
|
|
sigil = rightHere->sigils[i];
|
2018-10-13 03:35:45 +00:00
|
|
|
if (sigil->spell == spellFlag
|
2018-12-17 04:25:19 +00:00
|
|
|
&& (playerFaces(hero, sigil->dir) || sigil->dir == 'a')
|
2018-10-13 03:35:45 +00:00
|
|
|
&& playerIsInRect(hero, &(sigil->zone)))
|
|
|
|
run(sigil->trigger);
|
|
|
|
}
|
|
|
|
}
|