shithub: choc

Download patch

ref: 2f20195e2aa6f17fc30626a566b70dc218d46e22
parent: f75826fa71ff17f3b8852918e9051ddee9f5e119
author: Simon Howard <fraggle@gmail.com>
date: Sat Oct 1 23:16:29 EDT 2005

ENDOOM support using text mode emulation

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 147

--- a/Makefile.am
+++ b/Makefile.am
@@ -15,5 +15,5 @@
 MAINTAINERCLEANFILES =  $(AUX_DIST_GEN)
 
 docdir=$(prefix)/share/doc/@PACKAGE@
-SUBDIRS=src 
+SUBDIRS=textscreen src 
 
--- a/configure.in
+++ b/configure.in
@@ -4,6 +4,7 @@
 orig_CFLAGS="$CFLAGS"
 
 AC_PROG_CC
+AC_PROG_RANLIB
 
 if test "$GCC" = "yes"
 then
@@ -46,6 +47,7 @@
 
 AC_OUTPUT([
 Makefile
+textscreen/Makefile
 src/Makefile
 src/chocolate-doom-res.rc
 ])
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,8 +3,8 @@
 
 bin_PROGRAMS = chocolate-doom
 
-CFLAGS = @CFLAGS@ @SDL_CFLAGS@ @SDLMIXER_CFLAGS@ @SDLNET_CFLAGS@ -Wall
-chocolate_doom_LDADD = @LDFLAGS@ @SDL_LIBS@ @SDLMIXER_LIBS@ @SDLNET_LIBS@ 
+AM_CFLAGS = -I../textscreen @SDL_CFLAGS@ @SDLMIXER_CFLAGS@ @SDLNET_CFLAGS@ -Wall
+chocolate_doom_LDADD = @LDFLAGS@ @SDL_LIBS@ @SDLMIXER_LIBS@ @SDLNET_LIBS@ ../textscreen/libtextscreen.a
 
 SOURCE_FILES=\
 am_map.c    d_think.h   i_video.c   p_floor.c   p_tick.c    r_things.h	\
--- a/src/i_system.c
+++ b/src/i_system.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: i_system.c 120 2005-09-22 13:13:47Z fraggle $
+// $Id: i_system.c 147 2005-10-02 03:16:29Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.11  2005/10/02 03:16:29  fraggle
+// ENDOOM support using text mode emulation
+//
 // Revision 1.10  2005/09/22 13:13:47  fraggle
 // Remove external statistics driver support (-statcopy):
 // nonfunctional on modern systems and never used.
@@ -60,7 +63,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: i_system.c 120 2005-09-22 13:13:47Z fraggle $";
+rcsid[] = "$Id: i_system.c 147 2005-10-02 03:16:29Z fraggle $";
 
 
 #include <stdlib.h>
@@ -79,8 +82,11 @@
 #include "g_game.h"
 
 #include "i_system.h"
+#include "txt_main.h"
 
 
+#include "w_wad.h"
+#include "z_zone.h"
 
 
 int	mb_used = 6;
@@ -154,7 +160,67 @@
     SDL_Init(SDL_INIT_TIMER);
 }
 
+// 
+// Displays the text mode ending screen after the game quits
 //
+
+void I_Endoom(void)
+{
+    unsigned char *endoom_data;
+    unsigned char *screendata;
+    unsigned int start_ms;
+    boolean waiting;
+    SDL_Event ev;
+
+    endoom_data = W_CacheLumpName("ENDOOM", PU_STATIC);
+    
+    // Set up text mode screen
+
+    TXT_Init();
+
+    // Make sure the new window has the right title and icon
+ 
+    I_SetWindowCaption();
+    I_SetWindowIcon();
+    
+    // Write the data to the screen memory
+  
+    screendata = TXT_GetScreenData();
+    memcpy(screendata, endoom_data, 4000);
+
+    TXT_UpdateScreen();
+    
+    // Wait for 10 seconds, or until a keypress or mouse click
+
+    waiting = true;
+    start_ms = I_GetTime();
+
+    while (waiting && I_GetTime() < start_ms + 10000)
+    {
+        if (!SDL_PollEvent(&ev))
+        {
+            I_Sleep(100);
+            continue;
+        }
+
+        switch (ev.type)
+        {
+            case SDL_MOUSEBUTTONDOWN:
+            case SDL_KEYDOWN:
+                waiting = false;
+                break;
+
+            default:
+                break;
+        }
+    }
+    
+    // Shut down text mode screen
+
+    TXT_Shutdown();
+}
+
+//
 // I_Quit
 //
 void I_Quit (void)
@@ -164,6 +230,7 @@
     I_ShutdownMusic();
     M_SaveDefaults ();
     I_ShutdownGraphics();
+    I_Endoom();
     exit(0);
 }
 
@@ -216,3 +283,4 @@
     
     exit(-1);
 }
+
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: i_video.c 145 2005-10-02 03:03:40Z fraggle $
+// $Id: i_video.c 147 2005-10-02 03:16:29Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.35  2005/10/02 03:16:29  fraggle
+// ENDOOM support using text mode emulation
+//
 // Revision 1.34  2005/10/02 03:03:40  fraggle
 // Make sure loading disk is only shown if the display is initialised
 //
@@ -144,7 +147,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: i_video.c 145 2005-10-02 03:03:40Z fraggle $";
+rcsid[] = "$Id: i_video.c 147 2005-10-02 03:16:29Z fraggle $";
 
 #include <SDL.h>
 #include <ctype.h>
@@ -743,7 +746,7 @@
 // Set the window caption
 //
 
-static void SetCaption(void)
+void I_SetWindowCaption(void)
 {
     char *buf;
 
@@ -758,7 +761,7 @@
 
 // Set the application icon
 
-static void SetIcon(void)
+void I_SetWindowIcon(void)
 {
     SDL_Surface *surface;
 
@@ -846,8 +849,8 @@
 
     // Setup title and icon
 
-    SetCaption();
-    SetIcon();
+    I_SetWindowCaption();
+    I_SetWindowIcon();
 
     UpdateFocus();
     UpdateGrab();
--- a/src/i_video.h
+++ b/src/i_video.h
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: i_video.h 110 2005-09-17 20:25:56Z fraggle $
+// $Id: i_video.h 147 2005-10-02 03:16:29Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -57,6 +57,9 @@
 void I_BeginRead (void);
 void I_EndRead (void);
 
+void I_SetWindowCaption(void);
+void I_SetWindowIcon(void);
+
 extern boolean screenvisible;
 extern int screenmultiply;
 extern boolean fullscreen;
@@ -67,6 +70,9 @@
 //-----------------------------------------------------------------------------
 //
 // $Log$
+// Revision 1.8  2005/10/02 03:16:29  fraggle
+// ENDOOM support using text mode emulation
+//
 // Revision 1.7  2005/09/17 20:25:56  fraggle
 // Set the default values for variables in their initialisers.  Remove the
 // "defaultvalue" parameter and associated code from the configuration