2018-09-20 01:27:47 +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 "Kaos.h"
|
|
|
|
#include "HyperKaos.h"
|
|
|
|
|
|
|
|
typedef struct room Room;
|
|
|
|
typedef struct player Player;
|
|
|
|
typedef struct timer Timer;
|
|
|
|
typedef struct textBox TextBox;
|
|
|
|
|
|
|
|
#include "extern.h"
|
|
|
|
|
|
|
|
HyperKaos* newHyperKaos(int id, int type, int x, int y, int w, int h)
|
|
|
|
{
|
2018-09-21 19:57:07 +00:00
|
|
|
HyperKaos* self = malloc(sizeof(HyperKaos));
|
2018-09-20 01:27:47 +00:00
|
|
|
|
|
|
|
self->domain.x = x;
|
|
|
|
self->domain.y = y;
|
|
|
|
self->domain.w = w;
|
|
|
|
self->domain.h = h;
|
|
|
|
self->kaosID = id;
|
|
|
|
self->eventType = type;
|
|
|
|
self->head = NULL;
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
void deleteHyperKaos(HyperKaos* self)
|
|
|
|
{
|
|
|
|
free(self);
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// chains of events
|
|
|
|
//
|
|
|
|
|
|
|
|
void addKaos(HyperKaos* self, Kaos* target)
|
|
|
|
{
|
|
|
|
Kaos* here = self->head;
|
|
|
|
Kaos* next;
|
|
|
|
|
|
|
|
if (self->head == NULL)
|
|
|
|
self->head = target;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
next = here->next;
|
|
|
|
while (next != NULL)
|
|
|
|
{
|
|
|
|
here = next;
|
|
|
|
next = here->next;
|
|
|
|
}
|
|
|
|
here->next = target;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void run(HyperKaos* self)
|
|
|
|
{
|
|
|
|
Kaos* here = self->head;
|
|
|
|
Kaos* next;
|
|
|
|
savestate *= self->kaosID;
|
|
|
|
if (self->head == NULL) return;
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
|
|
|
next = here->next;
|
|
|
|
while (here != NULL)
|
|
|
|
{
|
|
|
|
here->run(here);
|
|
|
|
here = next;
|
|
|
|
if (here != NULL)
|
|
|
|
next = here->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int notCompleted(int x)
|
|
|
|
{
|
|
|
|
if (savestate%x) return 1;
|
|
|
|
else return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int hasCompleted(int x)
|
|
|
|
{
|
|
|
|
if (!notCompleted(x)) return 1;
|
|
|
|
else return 0;
|
|
|
|
}
|