Skip to content

Commit

Permalink
Starts to implement into. Removes some unused textures from game folder.
Browse files Browse the repository at this point in the history
  • Loading branch information
ikskuh committed Jul 1, 2019
1 parent 279b49d commit 396e394
Show file tree
Hide file tree
Showing 11 changed files with 134 additions and 2 deletions.
2 changes: 2 additions & 0 deletions game/AckCon19.pro
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ SOURCES += \
main.c \
src/ai.c \
src/ang.c \
src/briefing.c \
src/building.c \
src/camera.c \
src/credits.c \
Expand Down Expand Up @@ -80,6 +81,7 @@ HEADERS += \
shaders/terrain.fx \
src/ai.h \
src/ang.h \
src/briefing.h \
src/building.h \
src/camera.h \
src/console.h \
Expand Down
1 change: 1 addition & 0 deletions game/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,4 @@ function main()
#include "ini.c"
#include "settings.c"
#include "splashscreen.c"
#include "briefing.c"
100 changes: 100 additions & 0 deletions game/src/briefing.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#include "briefing.h"

BMAP * briefing_background = "intro_background.png";
BMAP * briefing_startbtn = "intro_start.png";
BMAP * briefing_rotor = "intro_rotor.png";
BMAP * briefing_startbtn_dis = "intro_start_inactive.png";

VECTOR briefing_startbutton_min, briefing_startbutton_max;

bool briefing_done;

void briefing_mouseclick()
{
if(mouse_pos.x < briefing_startbutton_min.x)
return;
if(mouse_pos.y < briefing_startbutton_min.y)
return;
if(mouse_pos.x >= briefing_startbutton_max.x)
return;
if(mouse_pos.y >= briefing_startbutton_max.y)
return;
briefing_done = true;
}

void briefing_init()
{

}

void briefing_open()
{
on_mouse_left = briefing_mouseclick;
briefing_done = false;
}

void briefing_update()
{
var scale_x = screen_size.x / bmap_width(briefing_background);
var scale_y = screen_size.y / bmap_height(briefing_background);
var scale = minv(scale_x, scale_y);

var pos_x = (screen_size.x - scale * bmap_width(briefing_background)) / 2;
var pos_y = (screen_size.y - scale * bmap_height(briefing_background)) / 2;

draw_quad(
briefing_background,
vector(pos_x, pos_y, 0),
NULL,
NULL,
vector(scale, scale, 0),
NULL,
100,
0);

draw_quad(
briefing_rotor,
vector(pos_x + scale * 1688, pos_y + scale * 764, 0),
NULL,
NULL,
vector(scale, scale, 0),
NULL,
100,
-total_ticks
);

briefing_startbutton_min.x = pos_x + scale * 1613;
briefing_startbutton_min.y = pos_y + scale * 59;
briefing_startbutton_max.x = briefing_startbutton_min.x + scale * bmap_width(briefing_startbtn);
briefing_startbutton_max.y = briefing_startbutton_min.y + scale * bmap_height(briefing_startbtn);

BMAP * bmp = briefing_startbtn_dis;
if(mouse_pos.x >= briefing_startbutton_min.x && mouse_pos.y >= briefing_startbutton_min.y)
{
if(mouse_pos.x < briefing_startbutton_max.x && mouse_pos.y < briefing_startbutton_max.y)
{
bmp = briefing_startbtn;
}
}

draw_quad(
bmp,
briefing_startbutton_min,
NULL,
NULL,
vector(scale, scale, 0),
NULL,
100,
0
);
}

void briefing_close()
{
on_mouse_left = NULL;
}

bool briefing_isDone()
{
return briefing_done;
}
12 changes: 12 additions & 0 deletions game/src/briefing.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef BRIEFING_H
#define BRIEFING_H

#include "global.h"

void briefing_init(void);
void briefing_open(void);
void briefing_update(void);
void briefing_close(void);
bool briefing_isDone(void);

#endif // BRIEFING_H
19 changes: 18 additions & 1 deletion game/src/framework.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "materials.h"
#include "settings.h"
#include "splashscreen.h"
#include "briefing.h"

#include <acknex.h>
#include <windows.h>
Expand All @@ -20,6 +21,7 @@
#define FRAMEWORK_STATE_GAME 2
#define FRAMEWORK_STATE_CREDITS 3
#define FRAMEWORK_STATE_SPLASH 4
#define FRAMEWORK_STATE_BRIEFING 5

typedef struct
{
Expand Down Expand Up @@ -179,6 +181,7 @@ void framework_update()
game_init();
credits_init();
splashscreen_init();
briefing_init();
#ifdef DEBUG_FRAMEWORK_FASTSTART
if(settings.skipIntro)
framework_transfer(FRAMEWORK_STATE_LOAD);
Expand Down Expand Up @@ -207,7 +210,7 @@ void framework_update()
switch(response)
{
case MAINMENU_RESPONSE_STARTGAME:
framework_transfer(FRAMEWORK_STATE_GAME);
framework_transfer(FRAMEWORK_STATE_BRIEFING);
break;
case MAINMENU_RESPONSE_CREDIT:
framework_transfer(FRAMEWORK_STATE_CREDITS);
Expand All @@ -234,6 +237,12 @@ void framework_update()
framework_transfer(FRAMEWORK_STATE_MAINMENU);
break;

case FRAMEWORK_STATE_BRIEFING:
briefing_update();
if(briefing_isDone())
framework_transfer(FRAMEWORK_STATE_GAME);
break;

default:
error(str_printf(NULL, "framework: unsupported state %d!", framework.state));

Expand Down Expand Up @@ -268,6 +277,10 @@ void framework_update()
splashscreen_close();
break;

case FRAMEWORK_STATE_BRIEFING:
briefing_close();
break;

default:
error(str_printf(NULL, "framework: unsupported state %d!", framework.state));
}
Expand Down Expand Up @@ -301,6 +314,10 @@ void framework_update()
splashscreen_open();
break;

case FRAMEWORK_STATE_BRIEFING:
briefing_open();
break;

default:
error(str_printf(NULL, "framework: unsupported state %d!", framework.state));
}
Expand Down
2 changes: 1 addition & 1 deletion game/src/splashscreen.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void splashscreen_update()
0
),
NULL,
30,
310,
0
);

Expand Down
Binary file removed game/ui/H5.png
Binary file not shown.
Binary file added game/ui/intro_background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added game/ui/intro_rotor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added game/ui/intro_start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added game/ui/intro_start_inactive.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 396e394

Please sign in to comment.