taisei/src/common_tasks.h

102 lines
2 KiB
C
Raw Normal View History

/*
2019-10-04 05:04:12 +02:00
* This software is licensed under the terms of the MIT License.
* See COPYING for further information.
* ---
* Copyright (c) 2011-2019, Lukas Weber <laochailan@web.de>.
* Copyright (c) 2012-2019, Andrei Alexeyev <akari@taisei-project.org>.
*/
#ifndef IGUARD_common_tasks_h
#define IGUARD_common_tasks_h
#include "taisei.h"
#include "coroutine.h"
#include "item.h"
2019-09-01 02:23:36 +02:00
#include "move.h"
#include "entity.h"
2019-10-28 16:16:16 +01:00
#include "global.h"
DECLARE_EXTERN_TASK(
common_drop_items,
2019-12-18 15:19:13 +01:00
{ cmplx *pos; ItemCounts items; }
);
2019-09-01 02:23:36 +02:00
DECLARE_EXTERN_TASK(
common_move,
2019-12-18 15:19:13 +01:00
{ cmplx *pos; MoveParams move_params; BoxedEntity ent; }
2019-09-01 02:23:36 +02:00
);
DECLARE_EXTERN_TASK(
common_move_ext,
2019-12-18 15:19:13 +01:00
{ cmplx *pos; MoveParams *move_params; BoxedEntity ent; }
2019-09-01 02:23:36 +02:00
);
2019-12-05 17:45:32 +01:00
DECLARE_EXTERN_TASK(
common_call_func,
{ void (*func)(void); }
);
DECLARE_EXTERN_TASK(
common_start_bgm,
{ const char *bgm; }
);
#define COMMON_CHARGE_SOUND_CHARGE "charge_generic"
#define COMMON_CHARGE_SOUND_DISCHARGE "discharge"
#define COMMON_CHARGE_SOUNDS { COMMON_CHARGE_SOUND_CHARGE, COMMON_CHARGE_SOUND_DISCHARGE }
2020-03-01 17:38:54 +01:00
DECLARE_EXTERN_TASK(
common_charge,
{
cmplx pos;
const Color *color;
int time;
BoxedEntity bind_to_entity;
const cmplx *anchor;
const Color *color_ref;
2020-03-02 17:38:53 +01:00
struct {
const char *charge;
const char *discharge;
} sound;
2020-03-01 17:38:54 +01:00
}
);
int common_charge(int time, const cmplx *anchor, cmplx offset, const Color *color)
attr_nonnull(2, 4);
int common_charge_static(int time, cmplx pos, const Color *color)
attr_nonnull(3);
int common_charge_custom(
int time,
const cmplx *anchor,
cmplx offset,
const Color *color,
const char *snd_charge,
const char *snd_discharge
) attr_nonnull(4);
2020-03-02 17:38:53 +01:00
2019-12-05 17:45:32 +01:00
void common_move_loop(cmplx *restrict pos, MoveParams *restrict mp);
2019-09-01 02:23:36 +02:00
2019-09-02 18:09:09 +02:00
INLINE Rect viewport_bounds(double margin) {
return (Rect) {
.top_left = CMPLX(margin, margin),
.bottom_right = CMPLX(VIEWPORT_W - margin, VIEWPORT_H - margin),
};
}
2019-12-18 15:19:13 +01:00
cmplx common_wander(cmplx origin, double dist, Rect bounds);
2019-09-02 18:09:09 +02:00
DECLARE_EXTERN_TASK(
common_set_bitflags,
{
uint *pflags;
uint mask;
uint set;
}
);
#endif // IGUARD_common_tasks_h