124 lines
2.9 KiB
C
124 lines
2.9 KiB
C
// Copyright © 2017 Project Golan, all rights reserved.
|
|
// See COPYING for more information.
|
|
#include "g_stage.h"
|
|
#include "g_object.h"
|
|
#include "g_player.h"
|
|
#include "m_str.h"
|
|
|
|
#include <Doominati.h>
|
|
|
|
#include <math.h>
|
|
|
|
// Static Functions ----------------------------------------------------------|
|
|
|
|
//
|
|
// R_drawHitboxes
|
|
//
|
|
static void R_drawHitboxes(void)
|
|
{
|
|
DGE_Texture_Bind(0);
|
|
DGE_Draw_SetColor(1lr, 0, 0, 0.5lr);
|
|
|
|
unsigned head = DGE_Thinker_Head();
|
|
DGE_Point2 vp = DGE_Renderer_GetViewpoint();
|
|
|
|
for(DGE_Thinker th = {head}; (th.id = th.next) != head;)
|
|
{
|
|
DGE_PhysicsThinker pth;
|
|
if((pth.id = DGE_Object_Cast(th.id, DGE_OT_PhysicsThinker))) {
|
|
fixed tx = pth.x - vp.x, ty = pth.y - vp.y;
|
|
DGE_Draw_Rectangle(tx - pth.sx, ty - pth.sy, tx + pth.sx, ty + pth.sy);
|
|
}
|
|
}
|
|
|
|
DGE_Draw_SetColor();
|
|
}
|
|
|
|
//
|
|
// R_Draw
|
|
//
|
|
DGE_Callback [[__script("Draw")]]
|
|
static void R_draw(ulfra delta)
|
|
{
|
|
static float yadd;
|
|
|
|
lfxpt time = G_Time + (lfxpt)delta;
|
|
|
|
if(G_Time < 60 && time)
|
|
yadd = -logf(0.7 / time);
|
|
|
|
DGE_Texture_Bind(DGE_Texture_Get(s"bkg/space"));
|
|
DGE_Draw_Rectangle(30, 30, 30+510, 30+660);
|
|
|
|
DGE_Texture_Bind(DGE_Texture_Get(s"bkg/earth"));
|
|
DGE_Draw_Rectangle(30, 30, 30+510, 30+660 + yadd*4 + time/60);
|
|
|
|
if(G_Time < 50) {
|
|
DGE_Texture_Bind(DGE_Texture_Get(s"bkg/station"));
|
|
DGE_Draw_Rectangle(30, 30, 30+510, 30+660 + yadd*100);
|
|
}
|
|
}
|
|
|
|
//
|
|
// R_DrawPlace
|
|
//
|
|
static void R_drawPlace(lfxpt time)
|
|
{
|
|
if(G_Time < 200)
|
|
{
|
|
if(G_Time > 100) DGE_Draw_SetColor(1lr, 1lr, 1lr, 1 - (time-100) / 100);
|
|
|
|
DGE_Font_Bind(DGE_Font_Get(s"place"));
|
|
DGE_Draw_SetTextAlign(DGE_Align_Center, DGE_Align_Center);
|
|
DGE_Draw_Text(285, 50, M_StrGet(G_Place));
|
|
|
|
DGE_Font_Bind(DGE_Font_Get(s"base"));
|
|
DGE_Draw_SetTextAlign(DGE_Align_Left, DGE_Align_Top);
|
|
DGE_Draw_Text(50, 80, M_StrGet(G_PlaceIntro));
|
|
}
|
|
else
|
|
{
|
|
if(G_Time < 225) DGE_Draw_SetColor(1lr, 1lr, 1lr, (time-200) / 25);
|
|
DGE_Draw_SetTextAlign(DGE_Align_Center, DGE_Align_Top);
|
|
DGE_Draw_Text(780, 20, M_StrGet(G_Place));
|
|
}
|
|
|
|
DGE_Draw_SetColor();
|
|
}
|
|
|
|
//
|
|
// R_DrawPost
|
|
//
|
|
DGE_Callback [[__script("DrawPost")]]
|
|
static void R_drawPost(ulfra delta)
|
|
{
|
|
lfxpt time = G_Time + (lfxpt)delta;
|
|
|
|
DGE_Texture_Bind(DGE_Texture_Get(s"gui/border"));
|
|
DGE_Draw_Rectangle(0, 0, 960, 720);
|
|
|
|
DGE_Font_Bind(DGE_Font_Get(s"base"));
|
|
|
|
DGE_Draw_SetTextAlign(DGE_Align_Left, DGE_Align_Top);
|
|
DGE_Draw_Text(610, 70, M_StrGet(s"gui/highscore"));
|
|
DGE_Draw_Text(620, 97, M_StrFmt("%.20i", 0));
|
|
|
|
for(int i = 0; i < G_Player_Count; i++)
|
|
{
|
|
int const y = 250 * i;
|
|
|
|
DGE_Texture_Bind(DGE_Texture_Get(s"gui/playerback"));
|
|
DGE_Draw_Rectangle(0, y, 960, 720 + y);
|
|
|
|
DGE_Draw_SetTextAlign(DGE_Align_Left);
|
|
DGE_Draw_Text(620, 160 + y, M_StrFmt(M_StrGet(s"gui/player"), i + 1));
|
|
DGE_Draw_Text(630, 207 + y, M_StrFmt(u8"%.20i\n\n%i\n\n∞", 0, 5));
|
|
}
|
|
|
|
R_drawPlace(time);
|
|
|
|
// R_drawHitboxes();
|
|
}
|
|
|
|
// EOF
|