From 18c1326be9a59bdf0506b7bb55700a17fc17c3bc Mon Sep 17 00:00:00 2001 From: Spoike <acceptthis@users.sourceforge.net> Date: Sun, 14 Jun 2015 09:34:55 +0000 Subject: [PATCH] git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4900 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_main.c | 8 +-- engine/client/cl_screen.c | 92 ++++++++++++++++++++++++++++++++-- engine/client/screen.h | 3 +- engine/common/protocol.h | 13 ++++- engine/droid/configs/touch.cfg | 14 ++++++ engine/droid/fte.cfg | 4 +- 6 files changed, 122 insertions(+), 12 deletions(-) create mode 100644 engine/droid/configs/touch.cfg diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 9484d3d22..feb04d945 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -3721,7 +3721,8 @@ void CL_Init (void) Cmd_AddCommand ("timedemo", CL_TimeDemo_f); Cmd_AddCommand ("crashme_endgame", CL_CrashMeEndgame_f); - Cmd_AddCommandD ("showpic", SCR_ShowPic_Script_f, "showpic <imagename> <placename> <x> <y> <zone> [width] [height] [touchcommand]\nDisplays an image onscreen."); + Cmd_AddCommandD ("showpic", SCR_ShowPic_Script_f, "showpic <imagename> <placename> <x> <y> <zone> [width] [height] [touchcommand]\nDisplays an image onscreen, that potentially has a key binding attached to it when clicked/touched.\nzone should be one of: TL, TR, BL, BR, MM, TM, BM, ML, MR. This serves as an extra offset to move the image around the screen without any foreknowledge of the screen resolution."); + Cmd_AddCommandD ("showpic_removeall", SCR_ShowPic_Remove_f, "removes any pictures inserted with the showpic command."); Cmd_AddCommand ("startdemos", CL_Startdemos_f); Cmd_AddCommand ("demos", CL_Demos_f); @@ -5288,10 +5289,12 @@ void Host_Shutdown(void) M_Shutdown(true); Mod_Shutdown(true); Wads_Flush(); + Con_History_Save(); //do this outside of the console code so that the filesystem is still running at this point but still allowing the filesystem to make console prints (you might not see them, but they should be visible to sys_printf still, for debugging). #ifndef CLIENTONLY SV_Shutdown(); #else NET_Shutdown (); + FS_Shutdown(); #endif Stats_Clear(); @@ -5307,9 +5310,6 @@ void Host_Shutdown(void) Cmd_Shutdown(); Key_Unbindall_f(); - Con_History_Save(); //do this outside of the console code so that the filesystem is still running at this point but still allowing the filesystem to make console prints (you might not see them, but they should be visible to sys_printf still, for debugging). - - FS_Shutdown(); #ifdef PLUGINS Plug_Shutdown(true); diff --git a/engine/client/cl_screen.c b/engine/client/cl_screen.c index 51c7f6854..a73c9b283 100644 --- a/engine/client/cl_screen.c +++ b/engine/client/cl_screen.c @@ -802,9 +802,9 @@ static void SP_RecalcXY ( float *xx, float *yy, int origin ) midy = vid.height * 0.5;// >>1 midx = vid.width * 0.5;// >>1 - // Tei - new showlmp - switch ( origin ) + switch (origin) { + //tei's original encoding case SL_ORG_NW: break; case SL_ORG_NE: @@ -835,6 +835,39 @@ static void SP_RecalcXY ( float *xx, float *yy, int origin ) y = midy + (y - 8000);//NegCoded x = vid.height - x; //Inverse break; + + //spike's attempt to provide sane origins that are a little more predictable. + case SL_ORG_TL: + break; + case SL_ORG_TR: + x += vid.width; + break; + case SL_ORG_BL: + y += vid.height; + break; + case SL_ORG_BR: + x += vid.width; + y += vid.height; + break; + case SL_ORG_MM: + x += midx; + y += midy; + break; + case SL_ORG_TM: + x += midx; + break; + case SL_ORG_BM: + x += midx; + y += vid.height; + break; + case SL_ORG_ML: + y += midy; + break; + case SL_ORG_MR: + x += vid.height; + y += midy; + break; + default: break; } @@ -912,7 +945,7 @@ char *SCR_ShowPics_ClickCommand(int cx, int cy) } //all=false clears only server pics, not ones from configs. -void SCR_ShowPic_Clear(qboolean all) +void SCR_ShowPic_Clear(qboolean persistflag) { showpic_t **link, *sp; int pnum; @@ -925,7 +958,7 @@ void SCR_ShowPic_Clear(qboolean all) for (link = &showpics; (sp=*link); ) { - if (sp->persist) + if (sp->persist == persistflag) { link = &sp->next; continue; @@ -1045,6 +1078,50 @@ void SCR_ShowPic_Update(void) CL_CheckOrEnqueDownloadFile(sp->picname, sp->picname, 0); } +static int SCR_ShowPic_MapZone(char *zone) +{ + //sane coding scheme + if (!Q_strcasecmp(zone, "tr")) + return SL_ORG_TR; + if (!Q_strcasecmp(zone, "tl")) + return SL_ORG_TL; + if (!Q_strcasecmp(zone, "br")) + return SL_ORG_BR; + if (!Q_strcasecmp(zone, "bl")) + return SL_ORG_BL; + if (!Q_strcasecmp(zone, "mm")) + return SL_ORG_MM; + if (!Q_strcasecmp(zone, "tm")) + return SL_ORG_TM; + if (!Q_strcasecmp(zone, "bm")) + return SL_ORG_BM; + if (!Q_strcasecmp(zone, "mr")) + return SL_ORG_MR; + if (!Q_strcasecmp(zone, "ml")) + return SL_ORG_MR; + + //compasy directions (but uses tei's coding scheme...) + if (!Q_strcasecmp(zone, "nw")) + return SL_ORG_NW; + if (!Q_strcasecmp(zone, "ne")) + return SL_ORG_NE; + if (!Q_strcasecmp(zone, "sw")) + return SL_ORG_SW; + if (!Q_strcasecmp(zone, "sw")) + return SL_ORG_SE; + if (!Q_strcasecmp(zone, "cc")) + return SL_ORG_CC; + if (!Q_strcasecmp(zone, "cn")) + return SL_ORG_CN; + if (!Q_strcasecmp(zone, "cs")) + return SL_ORG_CS; + if (!Q_strcasecmp(zone, "cw")) + return SL_ORG_CW; + if (!Q_strcasecmp(zone, "ce")) + return SL_ORG_CE; + + return atoi(zone); +} void SCR_ShowPic_Script_f(void) { char *imgname; @@ -1058,7 +1135,7 @@ void SCR_ShowPic_Script_f(void) name = Cmd_Argv(2); x = atoi(Cmd_Argv(3)); y = atoi(Cmd_Argv(4)); - zone = atoi(Cmd_Argv(5)); + zone = SCR_ShowPic_MapZone(Cmd_Argv(5)); w = atoi(Cmd_Argv(6)); h = atoi(Cmd_Argv(7)); @@ -1083,6 +1160,11 @@ void SCR_ShowPic_Script_f(void) } +void SCR_ShowPic_Remove_f(void) +{ + SCR_ShowPic_Clear(!Cmd_FromGamecode()); +} + //============================================================================= void QDECL SCR_Fov_Callback (struct cvar_s *var, char *oldvalue) diff --git a/engine/client/screen.h b/engine/client/screen.h index 3ae498215..4bf7f6e30 100644 --- a/engine/client/screen.h +++ b/engine/client/screen.h @@ -73,9 +73,10 @@ void SCR_ShowPic_Create(void); void SCR_ShowPic_Hide(void); void SCR_ShowPic_Move(void); void SCR_ShowPic_Update(void); -void SCR_ShowPic_Clear(qboolean all); +void SCR_ShowPic_Clear(qboolean persistflag); char *SCR_ShowPics_ClickCommand(int cx, int cy); void SCR_ShowPic_Script_f(void); +void SCR_ShowPic_Remove_f(void); //a header is better than none... void Draw_TextBox (int x, int y, int width, int lines); diff --git a/engine/common/protocol.h b/engine/common/protocol.h index 98965d31a..6f2b6a219 100644 --- a/engine/common/protocol.h +++ b/engine/common/protocol.h @@ -906,7 +906,7 @@ enum { #define CTE_PERSISTANT 64 #define CTE_ISBEAM 128 -//FTE's version of TEI_SHOWLMP2 +//FTE's version of TEI_SHOWLMP2. tei's values and coding scheme which makes no sense to anyone but him. #define SL_ORG_NW 0 #define SL_ORG_NE 1 #define SL_ORG_SW 2 @@ -917,6 +917,17 @@ enum { #define SL_ORG_CW 7 #define SL_ORG_CE 8 +//relative coding where offsets are predictable +#define SL_ORG_TL 20 +#define SL_ORG_TR 21 +#define SL_ORG_BL 22 +#define SL_ORG_BR 23 +#define SL_ORG_MM 24 +#define SL_ORG_TM 25 +#define SL_ORG_BM 26 +#define SL_ORG_ML 27 +#define SL_ORG_MR 28 + /* ========================================================== diff --git a/engine/droid/configs/touch.cfg b/engine/droid/configs/touch.cfg new file mode 100644 index 000000000..514428143 --- /dev/null +++ b/engine/droid/configs/touch.cfg @@ -0,0 +1,14 @@ +showpic_removeall + +sv_aim 0.90 //quake style, avoid needing to pitch too much +showpic gfx/touch_forward.png forward 96 -88 bm 32 32 +forward +showpic gfx/touch_back.png moveback 96 -56 bm 32 32 +back +showpic gfx/touch_moveleft.png moveleft 64 -56 bm 32 32 +moveleft +showpic gfx/touch_moveright.png moveright 128 -56 bm 32 32 +moveright + +showpic gfx/touch_attack.png attack 32 -56 bm 32 32 +attack +showpic gfx/touch_jump.png jump 160 -56 bm 32 32 +jump + +showpic gfx/touch_turnleft.png turnleft 0 -56 bm 32 32 +left +showpic gfx/touch_turnright.png turnright 192 -56 bm 32 32 +right + diff --git a/engine/droid/fte.cfg b/engine/droid/fte.cfg index 8bcfc6b83..aa2c5d38e 100644 --- a/engine/droid/fte.cfg +++ b/engine/droid/fte.cfg @@ -9,4 +9,6 @@ bind volup +showteamscores // Appearance settings brightness "0.2" contrast "1.2" -vid_conautoscale "4" // Text/Menu size. 2 is the default. 4 is bigger \ No newline at end of file +vid_conautoscale "4" // Text/Menu size. 2 is the default. 4 is bigger + +exec configs/touch.cfg