diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2024-12-01 10:09:58 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2024-12-01 10:09:58 +0100 |
| commit | da90ecb4c88d81568c14b060a6a05508c2b37f35 (patch) | |
| tree | 8529d3ad3001a2ca0c9d6c26a37bccedb4109d6c /src | |
| parent | 6615a01df56d410a17b724d42660eb9821087470 (diff) | |
close #33
Diffstat (limited to 'src')
| -rw-r--r-- | src/include/world.h | 6 | ||||
| -rw-r--r-- | src/scenes/world_map.c | 97 | ||||
| -rw-r--r-- | src/world.c | 2 |
3 files changed, 45 insertions, 60 deletions
diff --git a/src/include/world.h b/src/include/world.h index 2d58f3b..dc11460 100644 --- a/src/include/world.h +++ b/src/include/world.h @@ -62,11 +62,6 @@ typedef struct t_employee employee; #define RAISE_PER_YEAR 55
#define MAX_PAY 3250
-typedef enum t_minor_event
-{
- EXTERNAL_INSPECTION, // Check overworking, safety
-} minor_event;
-
typedef enum t_weekday
{
MONDAY = 1,
@@ -348,7 +343,6 @@ typedef struct t_money_data_collection typedef struct t_company_investments
{
- u32 safety;
u32 marketing;
u32 human_resources;
u32 training;
diff --git a/src/scenes/world_map.c b/src/scenes/world_map.c index 57c1500..2642bdb 100644 --- a/src/scenes/world_map.c +++ b/src/scenes/world_map.c @@ -6,6 +6,7 @@ typedef enum t_world_map_scene_state WORLD_SCENE_STATE_INSIGHTS,
WORLD_SCENE_STATE_INVEST,
WORLD_SCENE_MENU,
+ WORLD_SCENE_BANK,
} world_map_scene_state;
typedef union t_world_map_scene_data
@@ -165,7 +166,9 @@ static void world_map_draw_info_panel(platform_window* window, bool enabled) }
// Bank button
- push_info_panel_button(scale, img_bank, screen_center_x - (total_btn_w/2) + (btn_size+btn_spacing)*2, btn_y, btn_size, enabled, false);
+ if (push_info_panel_button(scale, img_bank, screen_center_x - (total_btn_w/2) + (btn_size+btn_spacing)*2, btn_y, btn_size, enabled, false)) {
+ scene_state = (scene_state == WORLD_SCENE_BANK) ? WORLD_SCENE_STATE_IDLE : WORLD_SCENE_BANK;
+ }
// Event log button
if (push_info_panel_button(scale, img_invest, screen_center_x - (total_btn_w/2) + (btn_size+btn_spacing)*3, btn_y, btn_size, enabled, false)) {
@@ -771,11 +774,11 @@ static void world_map_draw_invest_panel(platform_window* window) hovered_investment_panel_item_index = -1;
- world_map_push_invest_panel_item(x, y, w, 0, "Workspace safety", (s32*)(&_active_world->investments.safety));
- world_map_push_invest_panel_item(x, y, w, 1, "Marketing", (s32*)(&_active_world->investments.marketing));
- world_map_push_invest_panel_item(x, y, w, 2, "Human resources", (s32*)(&_active_world->investments.human_resources));
- world_map_push_invest_panel_item(x, y, w, 3, "Employee training", (s32*)(&_active_world->investments.training));
- s32 item_bottom = world_map_push_invest_panel_item(x, y, w, 4, "Legal department", (s32*)(&_active_world->investments.legal));
+ //world_map_push_invest_panel_item(x, y, w, 0, "Workspace safety", (s32*)(&_active_world->investments.safety));
+ world_map_push_invest_panel_item(x, y, w, 0, "Marketing", (s32*)(&_active_world->investments.marketing));
+ world_map_push_invest_panel_item(x, y, w, 1, "Human resources", (s32*)(&_active_world->investments.human_resources));
+ world_map_push_invest_panel_item(x, y, w, 2, "Employee training", (s32*)(&_active_world->investments.training));
+ s32 item_bottom = world_map_push_invest_panel_item(x, y, w, 3, "Legal department", (s32*)(&_active_world->investments.legal));
float detail_panel_y = item_bottom + halfpad;
float detail_panel_h = h - (detail_panel_y-y)-halfpad;
@@ -787,15 +790,13 @@ static void world_map_draw_invest_panel(platform_window* window) char* info_text = 0;
switch (hovered_investment_panel_item_index)
{
- case 0: info_text = "Increasing the budget for workspace safety will ensure employees receive the proper workspace safety training.";
- break;
- case 1: info_text = "Increasing the marketing budget will give your business more publicity and will secure more work proposals.";
+ case 0: info_text = "Increasing the marketing budget will give your business more publicity and will secure more work proposals.";
break;
- case 2: info_text = "Investing in human resources will guarantee more responses to vacancies.";
+ case 1: info_text = "Investing in human resources will guarantee more responses to vacancies.";
break;
- case 3: info_text = "Providing training for your employees will increase happiness for your employees and make them work more efficiently.";
+ case 2: info_text = "Providing training for your employees will increase happiness for your employees and make them work more efficiently.";
break;
- case 4: info_text = "The legal department is essential for settling legal disputes.";
+ case 3: info_text = "The legal department is essential for settling legal disputes.";
break;
}
@@ -1105,34 +1106,16 @@ static void world_map_draw_night(platform_window* window) renderer->render_image_tint(img_shadow, shadow2_offset, area.y + camera_y, area.w*zoom, area.h*zoom, rgba(255,255,255,100));
}
-#define PUSH_MENU_BTN(txt, index, ref)\
-{\
- ref = false;\
- char* _txt = txt;\
- font* fnt_big = fnt_rd24;\
- s32 _txt_pad = 15*scale;\
- s32 _pad = 40*scale;\
- s32 _btn_x = panel_x + _pad;\
- s32 _btn_w = panel_w - (_pad*2);\
- s32 _btn_h = fnt_big->px_h + (_txt_pad*2);\
- s32 _btn_y = panel_y + _pad + (_btn_h * index) + index*3;\
- bool hovered = (_global_mouse.x >= _btn_x && _global_mouse.x <= _btn_x+_btn_w\
- && _global_mouse.y >= _btn_y && _global_mouse.y <= _btn_y+_btn_h);\
-\
- s32 _txt_x = _btn_x + (_btn_w/2) - (renderer->calculate_text_width(fnt_big, _txt) / 2);\
- s32 _txt_y = _btn_y + _txt_pad;\
-\
- if (!hovered) renderer->render_rectangle(_btn_x, _btn_y, _btn_w, _btn_h, COLOR_BUTTON);\
- else renderer->render_rectangle(_btn_x, _btn_y, _btn_w, _btn_h, LEGENDA_HOVER_BACKGROUND_COLOR);\
- \
- renderer->render_text(fnt_big, _txt_x, _txt_y, _txt, COLOR_TEXT);\
- if (hovered) {\
- platform_set_cursor(window, CURSOR_POINTER); \
- if (is_left_clicked()) {\
- ref = true;\
- }\
- else ref = false;\
- }\
+static void world_map_draw_bank(platform_window* window)
+{
+ s32 screen_center_x = area.x + (area.w/2);
+ s32 screen_center_y = area.y + (area.h/2);
+
+ s32 panel_w = 400 * scale;
+ s32 panel_h = 350 * scale;
+ s32 panel_x = screen_center_x - (panel_w/2);
+ s32 panel_y = screen_center_y - (panel_h/2);
+ panel_render(scale, panel_x, panel_y, panel_w, panel_h);
}
static void world_map_draw_menu(platform_window* window)
@@ -1140,35 +1123,39 @@ static void world_map_draw_menu(platform_window* window) s32 screen_center_x = area.x + (area.w/2);
s32 screen_center_y = area.y + (area.h/2);
- s32 panel_h = 350 * scale;
- s32 panel_w = 350 * scale;
-
+ s32 panel_w = 198 * scale;
+ s32 panel_h = 193 * scale;
s32 panel_x = screen_center_x - (panel_w/2);
s32 panel_y = screen_center_y - (panel_h/2);
panel_render(scale, panel_x, panel_y, panel_w, panel_h);
- bool clicked = false;
- PUSH_MENU_BTN("Continue", 0, clicked);
- if (clicked) {
+ s32 button_w = 178 * scale;
+ s32 button_h = 37 * scale;
+ s32 vertical_pad = 10 * scale;
+ s32 pad_x = (panel_w - button_w)/2;
+ float pad_y = (panel_h - (vertical_pad*2) - button_h*4)/5.0f;
+
+ if (button_render(scale, BUTTON_ENABLED, "Continue", panel_x + pad_x, vertical_pad + panel_y + pad_y*1, button_w, button_h))
+ {
scene_state = WORLD_SCENE_STATE_IDLE;
}
- PUSH_MENU_BTN("Save", 1, clicked);
- if (clicked) {
+ if (button_render(scale, BUTTON_ENABLED, "Save", panel_x + pad_x, vertical_pad + panel_y + pad_y*2 + button_h*1, button_w, button_h))
+ {
game_set_active_scene(GAME_STATE_SELECT_SAVE);
scene_state = WORLD_SCENE_STATE_IDLE;
is_selecting_save_location = true;
}
- PUSH_MENU_BTN("Settings", 2, clicked);
- if (clicked) {
+ if (button_render(scale, BUTTON_ENABLED, "Settings", panel_x + pad_x, vertical_pad + panel_y + pad_y*3 + button_h*2, button_w, button_h))
+ {
game_set_active_scene(GAME_STATE_SETTINGS);
scene_state = WORLD_SCENE_STATE_IDLE;
is_editing_settings_from_ingame = true;
}
-
- PUSH_MENU_BTN("Quit", 5, clicked);
- if (clicked) {
+
+ if (button_render(scale, BUTTON_ENABLED, "Quit", panel_x + pad_x, vertical_pad + panel_y + pad_y*4 + button_h*3, button_w, button_h))
+ {
game_set_active_scene(GAME_STATE_MENU);
scene_state = WORLD_SCENE_STATE_IDLE;
}
@@ -1202,6 +1189,10 @@ void world_map_scene_render(platform_window* window) case WORLD_SCENE_MENU:
world_map_draw_menu(window);
break;
+
+ case WORLD_SCENE_BANK:
+ world_map_draw_bank(window);
+ break;
}
renderer->set_render_depth(3);
diff --git a/src/world.c b/src/world.c index bff0345..4b478e9 100644 --- a/src/world.c +++ b/src/world.c @@ -1147,7 +1147,7 @@ static void world_update_employee_happiness(world* world, employee* emp) { // Pay investments daily. Run once per day.
static void world_pay_investments(world* world)
{
- ADD_EXPENSE(world, 0, expenses_from_utility, world->investments.safety/28.0f);
+ //ADD_EXPENSE(world, 0, expenses_from_utility, world->investments.safety/28.0f);
ADD_EXPENSE(world, 0, expenses_from_utility, world->investments.marketing/28.0f);
ADD_EXPENSE(world, 0, expenses_from_utility, world->investments.human_resources/28.0f);
ADD_EXPENSE(world, 0, expenses_from_utility, world->investments.training/28.0f);
|
