Break all of the text printing stuff out of game.c and into a separate screentext.c/h

git-svn-id: https://svn.eduke32.com/eduke32@5614 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2016-02-07 02:38:23 +00:00
parent 5b7a4a9a78
commit 023bc40020
12 changed files with 1339 additions and 1265 deletions

View file

@ -230,7 +230,7 @@ MAPSTER32_TARGET:=$(MAPSTER32)$(EXESUFFIX)
COMMON_OBJS=rev
COMMON_EDITOR_OBJS=m32common m32def m32exec m32vars rev
DUKE3D_OBJS=game global actors gamedef gameexec gamevars player premap sector anim animsounds common config demo input menus namesdyn net savegame rts osdfuncs osdcmds grpscan sounds soundsdyn cheats sbar
DUKE3D_OBJS=game global actors gamedef gameexec gamevars player premap sector anim animsounds common config demo input menus namesdyn net savegame rts osdfuncs osdcmds grpscan sounds soundsdyn cheats sbar screentext
DUKE3D_EDITOR_OBJS=astub common grpscan sounds_mapster32
ifneq ($(USE_LIBVPX),0)

View file

@ -56,6 +56,7 @@ $(DUKE3D_OBJ)/player.$o: $(DUKE3D_SRC)/player.c $(duke3d_h)
$(DUKE3D_OBJ)/premap.$o: $(DUKE3D_SRC)/premap.c $(duke3d_h) $(ENGINE_INC)/osd.h
$(DUKE3D_OBJ)/savegame.$o: $(DUKE3D_SRC)/savegame.c $(duke3d_h) $(DUKE3D_SRC)/savegame.h
$(DUKE3D_OBJ)/sbar.$o: $(DUKE3D_SRC)/sbar.c $(DUKE3D_SRC)/sbar.h
$(DUKE3D_OBJ)/screentext.$o: $(DUKE3D_SRC)/screentext.c $(DUKE3D_SRC)/screentext.h
$(DUKE3D_OBJ)/sector.$o: $(DUKE3D_SRC)/sector.c $(duke3d_h) $(DUKE3D_SRC)/input.h
$(DUKE3D_OBJ)/sounds.$o: $(DUKE3D_SRC)/sounds.c $(duke3d_h)
$(DUKE3D_OBJ)/soundsdyn.$o: $(DUKE3D_SRC)/soundsdyn.c $(duke3d_h)

View file

@ -197,6 +197,7 @@ DUKE3D_OBJS=$(DUKE3D_OBJ)\game.$o \
$(DUKE3D_OBJ)\animvpx.$o \
$(DUKE3D_OBJ)\cheats.$o \
$(DUKE3D_OBJ)\sbar.$o \
$(DUKE3D_OBJ)\screentext.$o \
$(DUKE3D_OBJ)\common.$o \
$(DUKE3D_OBJ)\demo.$o \
$(DUKE3D_OBJ)\gamedef.$o \

View file

@ -194,6 +194,7 @@
<ClInclude Include="source\quotes.h" />
<ClInclude Include="source\savegame.h" />
<ClInclude Include="source\sbar.h" />
<ClInclude Include="source\screentext.h" />
<ClInclude Include="source\sector.h" />
<ClInclude Include="source\_functio.h" />
<ClInclude Include="source\_midi.h" />
@ -343,6 +344,7 @@
<ClCompile Include="source\rts.c" />
<ClCompile Include="source\savegame.c" />
<ClCompile Include="source\sbar.c" />
<ClCompile Include="source\screentext.c" />
<ClCompile Include="source\sdlmusic.c" />
<ClCompile Include="source\sector.c" />
<ClCompile Include="source\sounds.c" />

View file

@ -516,6 +516,9 @@
<ClInclude Include="source\sbar.h">
<Filter>eduke32\source\editor</Filter>
</ClInclude>
<ClInclude Include="source\screentext.h">
<Filter>eduke32\headers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="build\src\a-c.c">
@ -905,6 +908,9 @@
<ClCompile Include="source\sbar.c">
<Filter>eduke32\source</Filter>
</ClCompile>
<ClCompile Include="source\screentext.c">
<Filter>eduke32\source</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="Makefile.msvc">

View file

@ -143,6 +143,7 @@ EDUKE32_STATIC_ASSERT(7 <= MAXTILES-MAXUSERTILES);
#include "gamedef.h"
#include "gameexec.h"
#include "gamevars.h"
#include "screentext.h"
#ifdef LUNATIC
# include "lunatic_game.h"

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 2010 EDuke32 developers and contributors
Copyright (C) 2016 EDuke32 developers and contributors
This file is part of EDuke32.
@ -20,6 +20,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#pragma once
#ifndef game_h_
#define game_h_
@ -96,31 +98,6 @@ enum LogoFlags_t {
LOGO_NODUKETEAMPIC = 0x00100000,
};
enum ScreenTextFlags_t {
TEXT_XRIGHT = 0x00000001,
TEXT_XCENTER = 0x00000002,
TEXT_YBOTTOM = 0x00000004,
TEXT_YCENTER = 0x00000008,
TEXT_INTERNALSPACE = 0x00000010,
TEXT_TILESPACE = 0x00000020,
TEXT_INTERNALLINE = 0x00000040,
TEXT_TILELINE = 0x00000080,
TEXT_XOFFSETZERO = 0x00000100,
TEXT_XJUSTIFY = 0x00000200,
TEXT_YOFFSETZERO = 0x00000400,
TEXT_YJUSTIFY = 0x00000800,
TEXT_LINEWRAP = 0x00001000,
TEXT_UPPERCASE = 0x00002000,
TEXT_INVERTCASE = 0x00004000,
TEXT_IGNOREESCAPE = 0x00008000,
TEXT_LITERALESCAPE = 0x00010000,
TEXT_BACKWARDS = 0x00020000,
TEXT_GAMETEXTNUMHACK = 0x00040000,
TEXT_DIGITALNUMBER = 0x00080000,
TEXT_BIGALPHANUM = 0x00100000,
TEXT_GRAYFONT = 0x00200000,
};
void A_DeleteSprite(int32_t s);
static inline int32_t G_GetLogoFlags(void)
@ -275,11 +252,6 @@ extern char ror_protectedsectors[MAXSECTORS];
extern float r_ambientlight;
extern int32_t althud_flashing;
extern int32_t althud_numberpal;
extern int32_t althud_numbertile;
extern int32_t althud_shadows;
extern int32_t g_Debug;
extern int32_t g_Shareware;
#if !defined LUNATIC
@ -316,16 +288,11 @@ extern uint32_t g_frameDelay;
extern user_defs ud;
int32_t A_CheckInventorySprite(spritetype *s);
int32_t A_InsertSprite(int16_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int16_t s_pn,int8_t s_s,uint8_t s_xr,uint8_t s_yr,int16_t s_a,int16_t s_ve,int16_t s_zv,int16_t s_ow,int16_t s_ss);
int32_t A_InsertSprite(int16_t whatsect, int32_t s_x, int32_t s_y, int32_t s_z, int16_t s_pn, int8_t s_s, uint8_t s_xr,
uint8_t s_yr, int16_t s_a, int16_t s_ve, int16_t s_zv, int16_t s_ow, int16_t s_ss);
int32_t A_Spawn(int32_t j,int32_t pn);
int32_t G_DoMoveThings(void);
//int32_t G_EndOfLevel(void);
int32_t G_GameTextLen(int32_t x,const char *t);
int32_t G_PrintGameText(int32_t hack,int32_t tile,int32_t x,int32_t y,const char *t,int32_t s,int32_t p,int32_t o,int32_t x1,int32_t y1,int32_t x2,int32_t y2,int32_t z, int32_t a);
extern int32_t minitext_lowercase;
extern int32_t minitext_yofs;
int32_t minitext_(int32_t x,int32_t y,const char *t,int32_t s,int32_t p,int32_t sb);
int32_t mpgametext(int32_t y,const char *t,int32_t s,int32_t dabits);
#ifdef YAX_ENABLE
void Yax_SetBunchZs(int32_t sectnum, int32_t cf, int32_t daz);
@ -379,18 +346,8 @@ void G_Shutdown(void);
void G_UpdatePlayerFromMenu(void);
void M32RunScript(const char *s);
void P_DoQuote(int32_t q,DukePlayer_t *p);
extern int32_t textsc(int32_t sc);
void P_SetGamePalette(DukePlayer_t *player, uint32_t palid, int32_t set);
extern int32_t G_GetStringLineLength(const char *text, const char *end, const int32_t iter);
extern int32_t G_GetStringNumLines(const char *text, const char *end, const int32_t iter);
extern char* G_GetSubString(const char *text, const char *end, const int32_t iter, const int32_t length);
extern int32_t G_GetStringTile(int32_t font, char *t, int32_t f);
extern vec2_t G_ScreenTextSize(const int32_t font, int32_t x, int32_t y, const int32_t z, const int32_t blockangle, const char *str, const int32_t o, int32_t xspace, int32_t yline, int32_t xbetween, int32_t ybetween, const int32_t f, const int32_t x1, const int32_t y1, const int32_t x2, const int32_t y2);
extern void G_AddCoordsFromRotation(vec2_t *coords, const vec2_t *unitDirection, const int32_t magnitude);
extern vec2_t G_ScreenText(const int32_t font, int32_t x, int32_t y, const int32_t z, const int32_t blockangle, const int32_t charangle, const char *str, const int32_t shade, int32_t pal, int32_t o, int32_t alpha, int32_t xspace, int32_t yline, int32_t xbetween, int32_t ybetween, const int32_t f, int32_t x1, int32_t y1, int32_t x2, int32_t y2);
extern vec2_t G_ScreenTextShadow(int32_t sx, int32_t sy, const int32_t font, int32_t x, int32_t y, const int32_t z, const int32_t blockangle, const int32_t charangle, const char *str, const int32_t shade, int32_t pal, int32_t o, const int32_t alpha, int32_t xspace, int32_t yline, int32_t xbetween, int32_t ybetween, const int32_t f, int32_t x1, int32_t y1, int32_t x2, int32_t y2);
#define NEG_ALPHA_TO_BLEND(alpha, blend, orientation) do { \
if (alpha < 0) { blend = -alpha; alpha = 0; orientation |= RS_TRANS1; } \
} while (0)
@ -414,15 +371,6 @@ static inline int32_t G_GetTeamPalette(int32_t team)
return pal[team];
}
#define minitextshade(x, y, t, s, p, sb) minitext_(x,y,t,s,p,sb)
#define minitext(x, y, t, p, sb) minitext_(x,y,t,0,p,sb)
#define menutext(x,y,s,p,t) menutext_(x,y,s,p,OSD_StripColors(menutextbuf,t),10+16)
#define gametext(x,y,t,s,dabits) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536, 0)
#define gametextscaled(x,y,t,s,dabits) G_PrintGameText(1,STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536, 0)
#define gametextpal(x,y,t,s,p) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,p,26,0, 0, xdim-1, ydim-1, 65536, 0)
#define gametextpalbits(x,y,t,s,p,dabits,a) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,p,dabits,0, 0, xdim-1, ydim-1, 65536, a)
#define mpgametext(y, t, s, dabits) G_PrintGameText(4,STARTALPHANUM, 5,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536, 0);
#define A_CheckSpriteFlags(iActor, iType) (((g_tile[sprite[iActor].picnum].flags^actor[iActor].flags) & iType) != 0)
// (unsigned)iPicnum check: AMC TC Rusty Nails, bayonet MG alt. fire, iPicnum == -1 (via aplWeaponShoots)
#define A_CheckSpriteTileFlags(iPicnum, iType) (((unsigned)iPicnum < MAXTILES) && (g_tile[iPicnum].flags & iType) != 0)

View file

@ -24,6 +24,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h"
#include "sbar.h"
int32_t althud_flashing = 1;
int32_t althud_numbertile = 2930;
int32_t althud_numberpal = 0;
#ifdef EDUKE32_TOUCH_DEVICES
int32_t althud_shadows = 0;
#else
int32_t althud_shadows = 1;
#endif
int32_t sbarsc(int32_t sc)
{
return scale(sc, ud.statusbarscale, 100);

View file

@ -19,6 +19,14 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#pragma once
extern int32_t althud_flashing;
extern int32_t althud_numberpal;
extern int32_t althud_numbertile;
extern int32_t althud_shadows;
int32_t sbarsc(int32_t sc);
int32_t sbarx16(int32_t x);
int32_t sbary16(int32_t y);

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,80 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 2016 EDuke32 developers and contributors
This file is part of EDuke32.
EDuke32 is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#pragma once
#define MAXUSERQUOTES 6
extern int32_t quotebot, quotebotgoal;
extern int32_t user_quote_time[MAXUSERQUOTES];
extern int32_t minitext_lowercase;
extern int32_t minitext_yofs;
enum ScreenTextFlags_t {
TEXT_XRIGHT = 0x00000001,
TEXT_XCENTER = 0x00000002,
TEXT_YBOTTOM = 0x00000004,
TEXT_YCENTER = 0x00000008,
TEXT_INTERNALSPACE = 0x00000010,
TEXT_TILESPACE = 0x00000020,
TEXT_INTERNALLINE = 0x00000040,
TEXT_TILELINE = 0x00000080,
TEXT_XOFFSETZERO = 0x00000100,
TEXT_XJUSTIFY = 0x00000200,
TEXT_YOFFSETZERO = 0x00000400,
TEXT_YJUSTIFY = 0x00000800,
TEXT_LINEWRAP = 0x00001000,
TEXT_UPPERCASE = 0x00002000,
TEXT_INVERTCASE = 0x00004000,
TEXT_IGNOREESCAPE = 0x00008000,
TEXT_LITERALESCAPE = 0x00010000,
TEXT_BACKWARDS = 0x00020000,
TEXT_GAMETEXTNUMHACK = 0x00040000,
TEXT_DIGITALNUMBER = 0x00080000,
TEXT_BIGALPHANUM = 0x00100000,
TEXT_GRAYFONT = 0x00200000,
};
extern int32_t minitext_(int32_t x, int32_t y, const char *t, int32_t s, int32_t p, int32_t sb);
extern int32_t textsc(int32_t sc);
#define minitextshade(x, y, t, s, p, sb) minitext_(x,y,t,s,p,sb)
#define minitext(x, y, t, p, sb) minitext_(x,y,t,0,p,sb)
#define menutext(x,y,s,p,t) menutext_(x,y,s,p,OSD_StripColors(menutextbuf,t),10+16)
#define gametext(x,y,t,s,dabits) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536, 0)
#define gametextscaled(x,y,t,s,dabits) G_PrintGameText(1,STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536, 0)
#define gametextpal(x,y,t,s,p) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,p,26,0, 0, xdim-1, ydim-1, 65536, 0)
#define gametextpalbits(x,y,t,s,p,dabits,a) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,p,dabits,0, 0, xdim-1, ydim-1, 65536, a)
#define mpgametext(y, t, s, dabits) G_PrintGameText(4,STARTALPHANUM, 5,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536, 0);
extern int32_t G_GameTextLen(int32_t x, const char *t);
extern int32_t G_PrintGameText(int32_t hack, int32_t tile, int32_t x, int32_t y, const char *t, int32_t s, int32_t p,
int32_t o, int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t z, int32_t a);
extern int32_t G_GetStringLineLength(const char *text, const char *end, const int32_t iter);
extern int32_t G_GetStringNumLines(const char *text, const char *end, const int32_t iter);
extern char* G_GetSubString(const char *text, const char *end, const int32_t iter, const int32_t length);
extern int32_t G_GetStringTile(int32_t font, char *t, int32_t f);
extern vec2_t G_ScreenTextSize(const int32_t font, int32_t x, int32_t y, const int32_t z, const int32_t blockangle, const char *str, const int32_t o, int32_t xspace, int32_t yline, int32_t xbetween, int32_t ybetween, const int32_t f, const int32_t x1, const int32_t y1, const int32_t x2, const int32_t y2);
extern void G_AddCoordsFromRotation(vec2_t *coords, const vec2_t *unitDirection, const int32_t magnitude);
extern vec2_t G_ScreenText(const int32_t font, int32_t x, int32_t y, const int32_t z, const int32_t blockangle, const int32_t charangle, const char *str, const int32_t shade, int32_t pal, int32_t o, int32_t alpha, int32_t xspace, int32_t yline, int32_t xbetween, int32_t ybetween, const int32_t f, int32_t x1, int32_t y1, int32_t x2, int32_t y2);
extern vec2_t G_ScreenTextShadow(int32_t sx, int32_t sy, const int32_t font, int32_t x, int32_t y, const int32_t z, const int32_t blockangle, const int32_t charangle, const char *str, const int32_t shade, int32_t pal, int32_t o, const int32_t alpha, int32_t xspace, int32_t yline, int32_t xbetween, int32_t ybetween, const int32_t f, int32_t x1, int32_t y1, int32_t x2, int32_t y2);