taisei/src/stageobjects.c
2017-12-30 10:44:40 +01:00

47 lines
1.1 KiB
C

/*
* This software is licensed under the terms of the MIT-License
* See COPYING for further information.
* ---
* Copyright (c) 2011-2017, Lukas Weber <laochailan@web.de>.
* Copyright (c) 2012-2017, Andrei Alexeyev <akari@alienslab.net>.
*/
#include "taisei.h"
#include "stageobjects.h"
#include "projectile.h"
#include "item.h"
#include "enemy.h"
#include "laser.h"
#include "aniplayer.h"
#define MAX_projectiles 1024
#define MAX_items MAX_projectiles
#define MAX_enemies 64
#define MAX_lasers 64
#define OBJECT_POOLS \
OBJECT_POOL(Projectile, projectiles) \
OBJECT_POOL(Item, items) \
OBJECT_POOL(Enemy, enemies) \
OBJECT_POOL(Laser, lasers) \
StageObjectPools stage_object_pools;
void stage_objpools_alloc(void) {
stage_object_pools = (StageObjectPools){
#define OBJECT_POOL(type,field) \
.field = OBJPOOL_ALLOC(type, MAX_##field),
OBJECT_POOLS
#undef OBJECT_POOL
};
}
void stage_objpools_free(void) {
#define OBJECT_POOL(type,field) \
objpool_free(stage_object_pools.field);
OBJECT_POOLS
#undef OBJECT_POOL
}