⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cfghelp.c

📁 C++游戏开发书籍的实例非常适合初学但又又想往游戏开发方面发展的人学习哦
💻 C
字号:
/*
 * This module contains all the routines needed to create a new help
 * screen.  The new help screen is read from a file which must exist before
 * executing this routine.
 *
 * Program Name:  tdecfg
 * Author:        Frank Davis
 * Date:          October 5, 1991
 */

#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "tdecfg.h"
#include "cfghelp.h"

extern struct vcfg cfg;
extern FILE *tde_exe;                  /* FILE pointer to tde.exe */
extern long help_offset;

static WINDOW *w_ptr;


/********    EXTREMELY IMPORTANT   ************/
/*
 * If you modify tde, it is your responsibility to find the offset of
 * the help screen in your new executable, tde.exe.
 *
 */



/*
 * Name:    tdehelp
 * Date:    October 1, 1991
 * Notes:   Set up most of the window global variables.
 */
void tdehelp( void )
{
int c;
int i;
char line[200];
char out_line[82];
char fname[82];
char *rc;
FILE *help_file;                  /* FILE pointer to help screen */
long offset;


   cls( );
   show_box( 0, 0, help_screen, NORMAL );
   xygoto( 42, 14 );
   c = getkey( );
   while (c != '1' && c != '2')
      c = getkey( );
   if (c == '1') {
      puts( "" );
      puts( "" );
      puts( "" );
      puts( "Enter file name that contains new help screen :" );
      gets( fname );
      if ((c = access( fname, EXIST )) != 0) {
         puts( "\nFile not found.  Press any key to continue." );
         c = getkey( );
         cls( );
         return;
      } else if ((help_file = fopen( fname, "r" )) == NULL ) {
         puts( "\nCannot open help file.  Press any key to contine." );
         c = getkey( );
         cls( );
         return;
      }
      offset = help_offset + 8;
      rc = fgets( line, 100, help_file );
      for (c=0; c<25 && rc != NULL; c++) {
         memset( out_line, '\0', 82 );
         for (i=0; i<80 && line[i] != '\n'; i++)
             out_line[i] = line[i];
         fseek( tde_exe, offset, SEEK_SET );
         fwrite( out_line, sizeof( char ), 81, tde_exe );
         offset += 81;
         rc = fgets( line, 100, help_file );
      }
      fclose( help_file );
      puts( "" );
      puts( "" );
      puts( "" );
      puts( "New help screen successfully installed.  Press any key to continue." );
      c = getkey( );
   }
   cls( );
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -