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

📄 menu.c

📁 一个runtils v2.0图形音乐库的demo程序
💻 C
📖 第 1 页 / 共 2 页
字号:
/*============================================================================*/
/*   PROJECT NUCLEUS.      (c) RocSoft, 1995.                                 */
/*   v1.0  18 Jan 95.                                                         */
/*============================================================================*/

#include <dos.h>
#include <rgenrl.h>
#include <rgraph.h>
#include <rsprite.h>
#include <rinout.h>
#include <rfileio.h>
#include <rsound.h>
#include <rblast.h>
#include <rmem.h>
#include <rmath.h>
#include "\rocco\glib\games.h"

#include <malloc.h>
#include <memory.h>
#include <string.h>

#include "defines.h"
#include "prototyp.h"
#include "globals.h"

#define  MAX_HELP_PAGES    6

/*====================[ Global Definition Structures ]======================*/

unsigned char     Load_Game_Flag;
unsigned int      No_Sound_Flag, Effects_Flag, Music_Flag;

GAME_MENU   GMenu=
{
    {
        { "New Game",    { 'n','N',0 },        &Menu_New_Game,    TRUE  },
        { "Load Game",   { 'l','L',0 },        &Menu_Load_Game,   TRUE  },
        { "Save Game",   { 's','S',0 },        &Menu_Save_Game,   FALSE },
        { "Help",        { 'h','H','?',0 },    &Menu_Help,        TRUE  },
        { "High Scores", { 0 },                &Menu_High_Scores, TRUE  },
        { "Register",    { 'r','R',0 },        &Menu_Register,    TRUE  },
        { "Options",     { 'o','O',0 },        &Menu_Options,     TRUE  },
        { "Back To Game",{ 'b','B',0 },        &Menu_Back_To_Game,FALSE },
        { "Demo",        { 'd','D',0 },        &Menu_Demo,        TRUE  },
        { "Exit",        { 'x','X','e','E',0 },&Menu_Exit,        TRUE  }
    },
    10,
    L_GREY, GREY, WHITE, BLACK,
    2,
    16,
    90,50,
    SFont,
    &Option_Pointer,
    -2,
    &Menu_Predisplay,
    &Menu_Postdisplay,
    &Menu_Soundfx
};

GAME_OPTIONS GOptions=
{
    {
        { "Sound",        { 0 },              FALSE, NULL,             TRUE,  NULL },
        { "No Sound",     { 'n','N',0 },      TRUE,  &No_Sound_Flag,   FALSE, &GOptions_No_Sound },
        { "Effects",      { 'e','E',0 },      TRUE,  &Effects_Flag,    FALSE, NULL },
        { "Music",        { 'm','M',0 },      TRUE,  &Music_Flag,      FALSE, &GOptions_Music }
    },
    4,
    L_GREY, GREY, WHITE, BLACK,
    2,
    16,
    100, 50,
    SFont,
    &Option_Pointer,
    -2,
    &GOptions_Predisplay,
    &GOptions_Postdisplay,
    &Menu_Soundfx
};

GAME_SLOTS GSlots=
{
    { "free","free","free","free","free","free" },
    L_GREY,GREY,WHITE,BLACK,
    2,
    94,50,
    ROM_8x8,
    &Option_Pointer,
    1,
    &GSlot_Predisplay,
    &GSlot_Postdisplay,
    &Menu_Soundfx
};

HIGH_SCORE_TABLE  High_Scores=
{
    { "JOE","BUD","JIM","ROY","SAM","DAN" },
    {  600L, 500L, 400L, 300L, 200L, 100L },
    L_GREY,GREY,WHITE,BLACK,
    2,
    108,40,
    SFont,
    &High_Scores_Predisplay,
    &High_Scores_Postdisplay,
    &High_Scores_Soundfx
};

/*=============================[ Local Declarations ]=========================*/

static char  *RegisterMsgs[]=
{
    "Project Nucleus v1.0 is released  as",
    "ShareWare which entitles you  to use",
    "this software for a trial period  of",
    "10 days. If you continue to  use  it",
    "after this time please register (see",
    "REGISTER.FRM). Registration provides",
    "the latest version of  the  software",
    "as well as details of a  cheat mode,",
    "bonus levels AND a level  editor  to",
    "create your own games! Also provided",
    "is a 25% discount voucher redeemable",
    "against future RocSoft games!",
    NULL
};

static char  *HelpPg0[]=
{
    "You are a nuclear physicist of a large",
    "company charged with monitoring a",
    "series of perilous atomic experiments.",
    "Each task will require you to prevent",
    "a nuclear meltdown from occurring and",
    "killing not only you but everything",
    "within a 50 mile radius. These tasks",
    "will vary in complexity and involve the",
    "use of different tools to help prevent",
    "disaster by protecting or destroying",
    "nuclei formed by a number of atomic",
    "particles.",
    NULL
};

static char  *HelpPg1[]=
{
    "These nuclei may cause a meltdown in",
    "two different ways. If left alone once",
    "formed they become unstable after a",
    "CRITICAL TIME at which point they will",
    "split. If a particle collides with a",
    "nucleus it can join it. If, however,",
    "the total mass of a nucleus reaches a",
    "CRITICAL MASS it will split. Either of",
    "these two situations may/may not cause",
    "a nuclear meltdown. As if this wasn't",
    "enough your experiment may be subject",
    "to 'contamination' by ROGUE ATOMIC RAYS",
    "or high velocity ROGUE PARTICLES.",
    NULL
};

static char  *HelpPg2[]=
{
    "These rogue elements will periodically",
    "manifest themselves at random intervals",
    "and will cause a nuclear meltdown if",
    "they are in collision with a nucleus.",
    "It is therefore imperative that this is",
    "prevented.",
    "",
    "To help you in your tasks you have at",
    "your disposal an ATOMIC INJECTOR to",
    "shoot high velocity neutrons and atomic",
    "shields at a nucleus. These are fired",
    "using the left and right mouse buttons",
    "respectively.",
    NULL
};

static char  *HelpPg3[]=
{
    "Hitting a nucleus with a neutron will",
    "cause it to split in a SAFE manner.",
    "Firing a shield at a neucleus will act",
    "as a protection mechanism and not allow",
    "another particle or ray to penetrate.",
    "Needless to say that  the  supply  of",
    "both neutrons and shields is limited at",
    "the start of each experiment. By the",
    "judicious use of these two items you",
    "must attempt to finish each experiment.",
    "As an aid, your supply of neutrons and",
    "shields may be boosted by picking up a",
    "bonus icon that may sometimes appear.",
    NULL
};

static char  *HelpPg4[]=
{
    "Your actions will be closely monitored",
    "and points awarded for your skill.",
    "",
    "To aid clarity you will be briefed for",
    "each experiment and informed of what",
    "the dangers are. It is important to",
    "remember that once you are dead it is",
    "final! You are NOT a feline and have",
    "only the one life.",
    "",
    "A game can be paused at any time with",
    "the 'P' key and resumed with any other",
    "key press. ESCape will take you back to",
    "the menu where you may save or load a",
    "game, etc.",
    NULL
};

static char  *HelpPg5[]=
{
    "The following will help identify items",
    "within the experiments:-",
    NULL
};

static char  **HelpPgs[MAX_HELP_PAGES]={ HelpPg0,HelpPg1,HelpPg2,HelpPg3,HelpPg4,HelpPg5 };

/*===========================[ External Declarations ]========================*/

extern int        LogoIndex1[], LogoIndex2[], ParticleMass[];

/*==========================[ Menu Service Routines ]=========================*/

int Menu_Back_To_Game( int page )
{
    return( TRUE );
}

int Menu_Demo( int page )
{
    return( TRUE );
}

int Menu_Exit( int page )
{
    char   *msgs[2] = { "Exit To DOS Y or N?",NULL };
    int    key;

    key = Show_Error_Message( msgs,SFX_WARNING,0,page );

    return( (key=='y' || key=='Y') );
}

int Menu_Help( int page )
{
    char         *h="Help", *msg;
    int          wh=Spr_Strlen(SFont,h), xh=(VS.mx+1-wh)>>1, yh, i, p=0, key;
    int          rpf=0, rrf=0, sf=NUM_OF_SHIELDS-2, npf=8, nsf=0, d;
    FONT         f;

    rom_font( &f,ROM_8x8 );
    Draw_Edged_Box( 0,0,VS.mx,VS.my,WHITE,GREY,L_GREY,1 );
    Spr_Print( SFont,h,xh,10,PROPORTIONAL,HORIZ,1 );
    line( xh-1,19,xh+wh,19,WHITE,1 );
    line( xh-2,20,xh+wh+1,20,GREY,1 );

    fadeout( &Pal,0 );
    showpage( 1 );
    CONSUME_KEYS;
    fadein( &Pal,0 );

    do
    {
        rect( 10,30,VS.mx-10,VS.my-6,L_GREY,FILL,1 );

        for ( i=wh=0; HelpPgs[p][i]; i++ )
          if ( (xh=Spr_Strlen(SFont,HelpPgs[p][i]))>wh ) wh=xh;

        xh = (VS.mx+1-wh)>>1;

        for ( i=0; HelpPgs[p][i]; i++ )
          Spr_Print( SFont,HelpPgs[p][i],xh,30+i*10,PROPORTIONAL,HORIZ,1 );

        if ( p==MAX_HELP_PAGES-1 )

⌨️ 快捷键说明

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