mirror of
https://github.com/zoriya/My3D.git
synced 2026-06-02 02:26:35 +00:00
merge
This commit is contained in:
+8
-1
@@ -235,7 +235,14 @@ add_executable(My3D
|
||||
src/systems/game_display_system.c
|
||||
lib/gamacon/src/components/tile_collision_manager.c
|
||||
lib/gamacon/include/components/tile_collision_manager.h
|
||||
lib/gamacon/src/engine/event_manager.c lib/gamacon/include/event_manager.h)
|
||||
lib/gamacon/src/engine/event_manager.c
|
||||
lib/gamacon/include/event_manager.h
|
||||
src/teams/absent.c
|
||||
src/teams/forgot.c include/teams.h
|
||||
src/systems/game_manager_system.c
|
||||
include/systems/game_manager_system.h
|
||||
lib/gamacon/include/keybindings.h
|
||||
)
|
||||
|
||||
add_compile_options(-W -Wall -Wextra -Wshadow)
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 186 KiB |
@@ -9,7 +9,8 @@
|
||||
|
||||
typedef enum display_type
|
||||
{
|
||||
HAPPINESS_DISPLAY
|
||||
HAPPINESS_DISPLAY,
|
||||
STUPIDITY_DISPLAY
|
||||
} display_type;
|
||||
|
||||
struct game_display
|
||||
|
||||
@@ -11,6 +11,7 @@ struct game_manager
|
||||
{
|
||||
gc_component base;
|
||||
int happiness;
|
||||
int stupidity;
|
||||
};
|
||||
|
||||
const struct game_manager game_manager;
|
||||
|
||||
@@ -19,4 +19,7 @@ struct teams_component
|
||||
|
||||
const struct teams_component teams_component;
|
||||
|
||||
bool teams_move_up(gc_scene *scene, float amount, float y_level);
|
||||
void pm_clicked(gc_engine *engine, int id);
|
||||
|
||||
#endif //_TEAMS_COMPONENT_C_
|
||||
|
||||
+9
-7
@@ -12,14 +12,16 @@
|
||||
|
||||
int start_game();
|
||||
|
||||
bool start_button(gc_engine *engine, int entity_id);
|
||||
bool options(gc_engine *engine, int entity_id);
|
||||
bool goto_main_menu(gc_engine *engine, int entity_id);
|
||||
bool quit(gc_engine *engine, int entity_id);
|
||||
bool start_button(gc_engine *engine, int entity_id, gc_vector2 _);
|
||||
bool options(gc_engine *engine, int entity_id, gc_vector2 _);
|
||||
bool goto_main_menu(gc_engine *engine, int entity_id, gc_vector2 _);
|
||||
bool quit(gc_engine *engine, int entity_id, gc_vector2 _);
|
||||
bool catch(gc_engine *engine, int entity_id, gc_vector2 _);
|
||||
bool toggle_pause(gc_engine *engine, int entity_id, gc_vector2 _);
|
||||
|
||||
int checkbox_update(gc_scene *s, gc_entity *entity, bool checked);
|
||||
void resolution_set_text(gc_entity *entity, gc_engine *engine);
|
||||
|
||||
bool fullscreen(gc_engine *engine, int entity_id);
|
||||
bool resolution_down(gc_engine *engine, int entity_id);
|
||||
bool resolution_up(gc_engine *engine, int entity_id);
|
||||
bool fullscreen(gc_engine *engine, int entity_id, gc_vector2 _);
|
||||
bool resolution_down(gc_engine *engine, int entity_id, gc_vector2 _);
|
||||
bool resolution_up(gc_engine *engine, int entity_id, gc_vector2 _);
|
||||
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// Created by anonymus-raccoon on 3/9/20.
|
||||
//
|
||||
|
||||
#ifndef _GAME_MANAGER_SYSTEM_H_
|
||||
#define _GAME_MANAGER_SYSTEM_H_
|
||||
|
||||
#include "system.h"
|
||||
|
||||
const gc_system game_manager_system;
|
||||
|
||||
#endif //_GAME_MANAGER_SYSTEM_H_
|
||||
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// Created by anonymus-raccoon on 3/9/20.
|
||||
//
|
||||
|
||||
#ifndef _TEAMS_H_
|
||||
#define _TEAMS_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "engine.h"
|
||||
|
||||
bool absent_check(gc_engine *engine, int entity_id, gc_vector2 _);
|
||||
bool absent_cross(gc_engine *engine, int entity_id, gc_vector2 _);
|
||||
|
||||
bool forgot_lmfao(gc_engine *engine, int entity_id, gc_vector2 _);
|
||||
bool forgot_ok(gc_engine *engine, int entity_id, gc_vector2 _);
|
||||
|
||||
#endif //_TEAMS_H_
|
||||
@@ -6,9 +6,11 @@
|
||||
<sprite name="front_panel" src="assets/ui/front_panel.png" />
|
||||
<sprite name="button_background" src="assets/ui/button_background.png" />
|
||||
<sprite name="happiness" src="assets/ui/happiness.png" />
|
||||
<sprite name="clown" src="assets/ui/clown.png" />
|
||||
<sprite name="cobblestone" src="assets/sprites/cobblestone.png" />
|
||||
<sprite name="mossy_cobblestone" src="assets/sprites/cobblestone_mossy.png" />
|
||||
<sprite name="command_block" src="assets/sprites/command_block.png" />
|
||||
<sprite name="black_background" src="assets/ui/black_background.png" />
|
||||
<sprite name="crafting_table" src="assets/sprites/crafting_table_top.png" />
|
||||
<music src="assets/musics/music.ogg"/>
|
||||
<font src="assets/fonts/roboto.ttf" />
|
||||
@@ -28,7 +30,7 @@
|
||||
</gc_entity>
|
||||
|
||||
<gc_entity>
|
||||
<game_manager happiness="50%" />
|
||||
<game_manager happiness="50%" stupidity="0%" />
|
||||
<teams_component delay="5">
|
||||
<prefab src="prefabs/teams/forgot_register.gcprefab" height="20%" />
|
||||
<prefab src="prefabs/teams/absent.gcprefab" height="20%" />
|
||||
@@ -43,5 +45,9 @@
|
||||
<text text="100%" x="6%" y="98%" size="13">
|
||||
<game_display stats="happiness" />
|
||||
</text>
|
||||
<panel src="clown" x="10%" y="98%" width="%" height="3%"/>
|
||||
<text text="100%" x="13%" y="98%" size="13">
|
||||
<game_display stats="stupidity" />
|
||||
</text>
|
||||
</gc_entities>
|
||||
</gc_scene>
|
||||
@@ -0,0 +1,13 @@
|
||||
<gc_scene>
|
||||
<data>
|
||||
<sprite name="panel" src="assets/ui/panel.png" />
|
||||
<sprite name="button_background" src="assets/ui/button_background.png" />
|
||||
<font src="assets/fonts/roboto.ttf" />
|
||||
</data>
|
||||
<gc_entities>
|
||||
<panel src="panel" x="50%" y="45%" width="300" height="69%"/>
|
||||
<text text="Game Over" x="50%" y="25%" resize="false"/>
|
||||
<button text="Retry" x="50%" y="60%" click="start_button" color="black" width="200" resize="false" />
|
||||
<button text="Exit" x="50%" y="72%" click="quit" color="black" width="200" resize="false" />
|
||||
</gc_entities>
|
||||
</gc_scene>
|
||||
@@ -0,0 +1,15 @@
|
||||
<gc_scene>
|
||||
<data>
|
||||
<sprite name="panel" src="assets/ui/panel.png" />
|
||||
<sprite name="button_background" src="assets/ui/button_background.png" />
|
||||
<sprite name="martine" src="assets/ui/martine_a_epi_marseille.png" />
|
||||
<font src="assets/fonts/roboto.ttf" />
|
||||
</data>
|
||||
<gc_entities>
|
||||
<panel src="panel" x="25%" y="45%" width="300" height="69%"/>
|
||||
<text text="Game Over" x="25%" y="25%" resize="false"/>
|
||||
<panel src="martine" x="75%" y="50%" width="20%" height="%" />
|
||||
<button text="Retry" x="25%" y="60%" click="start_button" color="black" width="200" resize="false" />
|
||||
<button text="Exit" x="25%" y="72%" click="quit" color="black" width="200" resize="false" />
|
||||
</gc_entities>
|
||||
</gc_scene>
|
||||
@@ -0,0 +1,7 @@
|
||||
<gc_entities>
|
||||
<button sprite="black_background" x="50%" y="50%" width="100%" height="100%" click="catch" tag="pause" />
|
||||
<panel src="panel" x="50%" y="45%" width="300" height="69%" tag="pause" />
|
||||
<text text="Pause" x="50%" y="25%" resize="false" tag="pause"/>
|
||||
<button text="Resume" x="50%" y="61%" click="toggle_pause" color="black" width="200" resize="false" tag="pause" />
|
||||
<button text="Quit game" x="50%" y="72%" click="quit" color="black" width="200" resize="false" tag="pause" />
|
||||
</gc_entities>
|
||||
@@ -1,6 +1,6 @@
|
||||
<gc_entities>
|
||||
<panel src="front_panel" x="89%" y="80%" width="20%" height="8%" tag="teams" />
|
||||
<text text="I was absent today at the talk.\nCould you set my status as present?" x="89%" y="82%" color="black" size="9" tag="teams" />
|
||||
<panel src="check" x="85%" y="85%" width="3%" height="%" tag="teams" />
|
||||
<panel src="cross" x="93%" y="85%" width="3%" height="%" tag="teams" />
|
||||
<button sprite="check" x="85%" y="85%" width="3%" height="%" click="absent_check" tag="teams" />
|
||||
<button sprite="cross" x="93%" y="85%" width="3%" height="%" click="absent_cross" tag="teams" />
|
||||
</gc_entities>
|
||||
@@ -1,8 +1,6 @@
|
||||
<gc_entities>
|
||||
<panel src="front_panel" x="89%" y="80%" width="20%" height="8%" tag="teams" />
|
||||
<text text="I forgot to register for the module,\n could you register me?" x="89%" y="82%" color="black" size="9" tag="teams" />
|
||||
<panel src="front_panel" x="89%" y="86%" width="17%" height="5%" tag="teams" />
|
||||
<text text="LMFAO" x="89%" y="86%" color="black" size="9" tag="teams" />
|
||||
<panel src="front_panel" x="89%" y="90%" width="17%" height="5%" tag="teams" />
|
||||
<text text="It's the first and the last time." x="89%" y="90%" color="black" size="9" tag="teams" />
|
||||
<button sprite="front_panel" text="LMFAO" color="black" size="9" x="89%" y="86%" width="17%" height="5%" click="forgot_lmfao" tag="teams" />
|
||||
<button sprite="front_panel" text="It's the first and the last time." color="black" size="9" x="89%" y="90%" width="17%" height="5%" click="forgot_ok" tag="teams" />
|
||||
</gc_entities>
|
||||
@@ -25,8 +25,12 @@ static void fdctr(gc_entity *entity, gc_scene *scene, void *component, node *n)
|
||||
{
|
||||
struct game_display *cmp = (struct game_display *)component;
|
||||
struct renderer *rend = GETCMP(entity, renderer);
|
||||
char *display_type = xml_gettempprop(n, "stats");
|
||||
|
||||
cmp->type = HAPPINESS_DISPLAY;
|
||||
if (!my_strcmp(display_type, "happiness"))
|
||||
cmp->type = HAPPINESS_DISPLAY;
|
||||
else
|
||||
cmp->type = STUPIDITY_DISPLAY;
|
||||
if (!rend || rend->type != GC_TXTREND) {
|
||||
my_printf("Using a game display without a text renderer.\n");
|
||||
return;
|
||||
|
||||
@@ -16,6 +16,7 @@ static void ctr(void *component, va_list args)
|
||||
struct game_manager *cmp = (struct game_manager *)component;
|
||||
|
||||
cmp->happiness = va_arg(args, int);
|
||||
cmp->stupidity = va_arg(args, int);
|
||||
}
|
||||
|
||||
static void fdctr(gc_entity *entity, gc_scene *scene, void *component, node *n)
|
||||
@@ -23,6 +24,7 @@ static void fdctr(gc_entity *entity, gc_scene *scene, void *component, node *n)
|
||||
struct game_manager *cmp = (struct game_manager *)component;
|
||||
|
||||
cmp->happiness = xml_getintprop(n, "happiness");
|
||||
cmp->stupidity = xml_getintprop(n, "stupidity");
|
||||
if (scene->get_entity_by_cmp(scene, "game_manager"))
|
||||
my_printf(MULTIPLE_GAME_MGR_ERROR);
|
||||
}
|
||||
|
||||
@@ -11,12 +11,15 @@
|
||||
#include "components/teams_component.h"
|
||||
#include "systems/teams_system.h"
|
||||
#include <SFML/System.h>
|
||||
#include "teams.h"
|
||||
#include "components/game_display.h"
|
||||
#include "components/game_manager.h"
|
||||
#include "systems/game_manager_system.h"
|
||||
|
||||
int register_customcmps(gc_engine *engine)
|
||||
{
|
||||
engine->add_component(engine, &game_manager);
|
||||
engine->add_system(engine, &game_manager_system);
|
||||
engine->add_component(engine, &game_display);
|
||||
engine->add_system(engine, &game_display_system);
|
||||
engine->add_component(engine, &teams_component);
|
||||
@@ -30,6 +33,12 @@ int register_customcmps(gc_engine *engine)
|
||||
engine->add_callback(engine, "fullscreen", &fullscreen);
|
||||
engine->add_callback(engine, "resolution_down", &resolution_down);
|
||||
engine->add_callback(engine, "resolution_up", &resolution_up);
|
||||
engine->add_callback(engine, "absent_check", &absent_check);
|
||||
engine->add_callback(engine, "absent_cross", &absent_cross);
|
||||
engine->add_callback(engine, "forgot_lmfao", &forgot_lmfao);
|
||||
engine->add_callback(engine, "forgot_ok", &forgot_ok);
|
||||
engine->add_callback(engine, "catch", &catch);
|
||||
engine->add_callback(engine, "toggle_pause", &toggle_pause);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
+9
-4
@@ -8,7 +8,7 @@
|
||||
#include "setup.h"
|
||||
#include "my.h"
|
||||
|
||||
bool start_button(gc_engine *engine, int entity_id)
|
||||
bool start_button(gc_engine *engine, int entity_id, gc_vector2 _)
|
||||
{
|
||||
gc_scene *scene = scene_create(engine, "prefabs/game.gcprefab");
|
||||
if (!scene) {
|
||||
@@ -20,7 +20,7 @@ bool start_button(gc_engine *engine, int entity_id)
|
||||
return (true);
|
||||
}
|
||||
|
||||
bool options(gc_engine *engine, int entity_id)
|
||||
bool options(gc_engine *engine, int entity_id, gc_vector2 _)
|
||||
{
|
||||
gc_scene *scene = scene_create(engine, "prefabs/options.gcprefab");
|
||||
gc_entity *entity;
|
||||
@@ -40,7 +40,7 @@ bool options(gc_engine *engine, int entity_id)
|
||||
return (true);
|
||||
}
|
||||
|
||||
bool goto_main_menu(gc_engine *engine, int entity_id)
|
||||
bool goto_main_menu(gc_engine *engine, int entity_id, gc_vector2 _)
|
||||
{
|
||||
gc_scene *scene = scene_create(engine, "prefabs/mainmenu.gcprefab");
|
||||
if (!scene) {
|
||||
@@ -52,8 +52,13 @@ bool goto_main_menu(gc_engine *engine, int entity_id)
|
||||
return (true);
|
||||
}
|
||||
|
||||
bool quit(gc_engine *engine, int entity_id)
|
||||
bool quit(gc_engine *engine, int entity_id, gc_vector2 _)
|
||||
{
|
||||
engine->should_close = true;
|
||||
return (true);
|
||||
}
|
||||
|
||||
bool catch(gc_engine *engine, int entity_id, gc_vector2 _)
|
||||
{
|
||||
return (true);
|
||||
}
|
||||
+3
-3
@@ -53,7 +53,7 @@ void resolution_set_text(gc_entity *entity, gc_engine *engine)
|
||||
((gc_text *)renderer->data)->text = resolution;
|
||||
}
|
||||
|
||||
bool fullscreen(gc_engine *engine, int entity_id)
|
||||
bool fullscreen(gc_engine *engine, int entity_id, gc_vector2 _)
|
||||
{
|
||||
gc_entity *entity = engine->scene->get_entity(engine->scene, entity_id);
|
||||
struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system);
|
||||
@@ -74,7 +74,7 @@ rend->resolution.y, 32}, "My3D", sfDefaultStyle, NULL);
|
||||
return (true);
|
||||
}
|
||||
|
||||
bool resolution_down(gc_engine *engine, int entity_id)
|
||||
bool resolution_down(gc_engine *engine, int entity_id, gc_vector2 _)
|
||||
{
|
||||
struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system);
|
||||
int i = 2;
|
||||
@@ -92,7 +92,7 @@ bool resolution_down(gc_engine *engine, int entity_id)
|
||||
return (true);
|
||||
}
|
||||
|
||||
bool resolution_up(gc_engine *engine, int entity_id)
|
||||
bool resolution_up(gc_engine *engine, int entity_id, gc_vector2 _)
|
||||
{
|
||||
struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system);
|
||||
int i = 0;
|
||||
|
||||
@@ -30,6 +30,8 @@ float dtime)
|
||||
return;
|
||||
if (disp->type == HAPPINESS_DISPLAY)
|
||||
sprintf(((gc_text *)rend->data)->text, "%d%%", manager->happiness);
|
||||
else
|
||||
sprintf(((gc_text *)rend->data)->text, "%d%%", manager->stupidity);
|
||||
}
|
||||
|
||||
static void destroy(void *system)
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
//
|
||||
// Created by anonymus-raccoon on 3/9/20.
|
||||
//
|
||||
|
||||
#include <components/tag_component.h>
|
||||
#include "my.h"
|
||||
#include "prefab.h"
|
||||
#include "keybindings.h"
|
||||
#include "system.h"
|
||||
#include "components/game_manager.h"
|
||||
|
||||
static void pause_destroy(gc_scene *scene)
|
||||
{
|
||||
gc_list *list = scene->get_entity_by_cmp(scene, "tag_component");
|
||||
|
||||
for (gc_list *li = list; li; li = li->next ) {
|
||||
if (!my_strcmp(GETCMP(li->data, tag_component)->tag, "pause"))
|
||||
((gc_entity *)li->data)->destroy(li->data, scene);
|
||||
}
|
||||
}
|
||||
|
||||
bool toggle_pause(gc_engine *engine, int entity_id, gc_vector2 _)
|
||||
{
|
||||
if (!engine->scene->is_paused)
|
||||
prefab_load(engine, "prefabs/pause.gcprefab");
|
||||
else
|
||||
pause_destroy(engine->scene);
|
||||
engine->scene->is_paused = !engine->scene->is_paused;
|
||||
return (true);
|
||||
}
|
||||
|
||||
static void update_entity(gc_engine *engine, void *system, gc_entity *entity, \
|
||||
float dtime)
|
||||
{
|
||||
struct game_manager *manager = GETCMP(entity, game_manager);
|
||||
gc_scene *gameover_scene = NULL;
|
||||
|
||||
if (manager->happiness <= 0)
|
||||
gameover_scene = scene_create(engine, "prefabs/go/happiness.gcprefab");
|
||||
if (manager->stupidity >= 100)
|
||||
gameover_scene = scene_create(engine, "prefabs/go/stupidity.gcprefab");
|
||||
|
||||
if (gameover_scene)
|
||||
engine->change_scene(engine, gameover_scene);
|
||||
if (engine->is_keypressed(ESCAPE)) {
|
||||
toggle_pause(engine, 0, (gc_vector2){0, 0});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void destroy(void *system)
|
||||
{
|
||||
(void)system;
|
||||
}
|
||||
|
||||
const gc_system game_manager_system = {
|
||||
name: "game_cycle",
|
||||
component_name: "game_manager",
|
||||
size: sizeof(gc_system),
|
||||
ctr: NULL,
|
||||
dtr: NULL,
|
||||
check_dependencies: &system_check_dependencies,
|
||||
update_entity: &update_entity,
|
||||
destroy: &destroy
|
||||
};
|
||||
+34
-17
@@ -11,51 +11,68 @@
|
||||
#include "components/teams_component.h"
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <components/tag_component.h>
|
||||
#include <components/fixed_to_cam_component.h>
|
||||
#include <components/game_manager.h>
|
||||
#include "components/tag_component.h"
|
||||
#include "components/fixed_to_cam_component.h"
|
||||
#include "components/game_manager.h"
|
||||
#include "my.h"
|
||||
|
||||
static bool move_teams_up(gc_scene *scene, float amount)
|
||||
void pm_destroy(gc_scene *scene, int prefab_id)
|
||||
{
|
||||
for (gc_list *ent = scene->entities; ent; ent = ent->next)
|
||||
if (((gc_entity *)ent->data)->prefab_id == prefab_id)
|
||||
((gc_entity *)ent->data)->destroy(ent->data, scene);
|
||||
}
|
||||
|
||||
void pm_clicked(gc_engine *engine, int id)
|
||||
{
|
||||
gc_scene *scene = engine->scene;
|
||||
gc_entity *entity = scene->get_entity(scene, id);
|
||||
float y_pos = GETCMP(entity, fixed_to_cam)->pos.y;
|
||||
|
||||
pm_destroy(scene, entity->prefab_id);
|
||||
teams_move_up(scene, -15, y_pos);
|
||||
}
|
||||
|
||||
bool teams_move_up(gc_scene *scene, float amount, float y_level)
|
||||
{
|
||||
gc_list *list = scene->get_entity_by_cmp(scene, "tag_component");
|
||||
struct fixed_to_cam *fc;
|
||||
struct tag_component *tc;
|
||||
bool pm_timeout = false;
|
||||
int pm_to_destroy = -1;
|
||||
|
||||
for (; list; list = list->next) {
|
||||
tc = GETCMP(list->data, tag_component);
|
||||
if (my_strcmp(tc->tag, "teams"))
|
||||
continue;
|
||||
fc = GETCMP(list->data, fixed_to_cam);
|
||||
if (!fc)
|
||||
if (!fc || fc->pos.y > y_level)
|
||||
continue;
|
||||
fc->pos.y -= amount;
|
||||
if (fc->pos.y < 15) {
|
||||
((gc_entity *) list->data)->destroy(list->data, scene);
|
||||
pm_timeout = true;
|
||||
}
|
||||
if (fc->pos.y < 15)
|
||||
pm_to_destroy = ((gc_entity *)list->data)->prefab_id;
|
||||
}
|
||||
return (pm_timeout);
|
||||
if (pm_to_destroy != -1)
|
||||
pm_destroy(scene, pm_to_destroy);
|
||||
return (pm_to_destroy != -1);
|
||||
}
|
||||
|
||||
static void update_entity(gc_engine *engine, void *system, gc_entity *entity, \
|
||||
float dtime)
|
||||
{
|
||||
struct teams_component *team = GETCMP(entity, teams_component);
|
||||
gc_scene *scene = engine->scene;
|
||||
struct gc_list *m = scene->get_entity_by_cmp(scene, "game_manager");
|
||||
struct game_manager *manager;
|
||||
struct game_manager *manager = GETCMP(entity, game_manager);
|
||||
int index;
|
||||
|
||||
if (!manager) {
|
||||
my_printf("No game manager found. Teams is disabled.\n");
|
||||
return;
|
||||
}
|
||||
team->next_teams -= dtime;
|
||||
if (team->next_teams < 0 && team->prefab_count) {
|
||||
index = random() % team->prefab_count;
|
||||
team->next_teams = team->delay;
|
||||
if (move_teams_up(engine->scene, team->prefabs_size[index]) && m) {
|
||||
manager = GETCMP(m->data, game_manager);
|
||||
if (teams_move_up(engine->scene, team->prefabs_size[index], 1000))
|
||||
manager->happiness -= 10;
|
||||
}
|
||||
prefab_load(engine, team->prefabs[index]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// Created by anonymus-raccoon on 3/6/20.
|
||||
//
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "components/game_manager.h"
|
||||
#include <stdlib.h>
|
||||
#include "components/teams_component.h"
|
||||
#include "engine.h"
|
||||
|
||||
bool absent_check(gc_engine *engine, int id)
|
||||
{
|
||||
gc_scene *scene = engine->scene;
|
||||
gc_list *li = scene->get_entity_by_cmp(scene, "game_manager");
|
||||
|
||||
if (!li)
|
||||
return (false);
|
||||
GETCMP(li->data, game_manager)->happiness += 3;
|
||||
GETCMP(li->data, game_manager)->stupidity += random() % 5;
|
||||
pm_clicked(engine, id);
|
||||
return (true);
|
||||
}
|
||||
|
||||
bool absent_cross(gc_engine *engine, int id)
|
||||
{
|
||||
gc_scene *scene = engine->scene;
|
||||
gc_list *li = scene->get_entity_by_cmp(scene, "game_manager");
|
||||
|
||||
if (!li)
|
||||
return (false);
|
||||
GETCMP(li->data, game_manager)->happiness -= 3;
|
||||
GETCMP(li->data, game_manager)->stupidity -= random() % 5;
|
||||
pm_clicked(engine, id);
|
||||
return (true);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// Created by anonymus-raccoon on 3/6/20.
|
||||
//
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "components/game_manager.h"
|
||||
#include "components/teams_component.h"
|
||||
#include "engine.h"
|
||||
|
||||
bool forgot_lmfao(gc_engine *engine, int id)
|
||||
{
|
||||
gc_scene *scene = engine->scene;
|
||||
gc_list *li = scene->get_entity_by_cmp(scene, "game_manager");
|
||||
|
||||
if (!li)
|
||||
return (false);
|
||||
GETCMP(li->data, game_manager)->happiness -= 5;
|
||||
GETCMP(li->data, game_manager)->stupidity -= 5;
|
||||
pm_clicked(engine, id);
|
||||
return (true);
|
||||
}
|
||||
|
||||
bool forgot_ok(gc_engine *engine, int id)
|
||||
{
|
||||
gc_scene *scene = engine->scene;
|
||||
gc_list *li = scene->get_entity_by_cmp(scene, "game_manager");
|
||||
|
||||
if (!li)
|
||||
return (false);
|
||||
GETCMP(li->data, game_manager)->happiness += 2;
|
||||
GETCMP(li->data, game_manager)->stupidity += 6;
|
||||
pm_clicked(engine, id);
|
||||
return (true);
|
||||
}
|
||||
Reference in New Issue
Block a user