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

📄 game.c

📁 SEAL是DOS 下的32位保护模式的GUI程序
💻 C
字号:
/******************************************************************
 * SEAL 2.0                                                       *
 * Copyright (c) 1999-2002 SEAL Developers. All Rights Reserved.  *
 *                                                                *
 * Web site: http://sealsystem.sourceforge.net/                   *
 * E-mail (current maintainer): orudge@users.sourceforge.net      *
 ******************************************************************/

/*
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include <seal.h>
#include <sound.h>
#include <screen.h>

FONT *arial20 = NULL;

FONT *arial10 = NULL;

//extern volatile int mouse_x;
//extern volatile int mouse_y;

// bitmaps
BITMAP *stars = NULL; // zoli etoile
BITMAP *logop = NULL; // logo pmad

BITMAP *my_mouse_sprite = NULL;

l_char map[12][9] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 12 x 9
                   { 0, 1, 1, 1, 0, 0, 0, 0, 0 },
                   { 0, 1, 0, 1, 0, 1, 1, 1, 0 },
                   { 0, 0, 0, 1, 0, 1, 1, 1, 0 },
                   { 0, 0, 1, 1, 0, 0, 0, 1, 0 },
                   { 0, 1, 1, 1, 0, 0, 0, 1, 0 },
                   { 0, 1, 1, 1, 1, 1, 1, 1, 0 },
                   { 0, 0, 1, 1, 0, 1, 1, 1, 0 },
                   { 0, 0, 1, 1, 0, 1, 1, 1, 0 },
                   { 0, 0, 0, 1, 0, 0, 1, 1, 0 },
                   { 0, 0, 0, 1, 0, 0, 1, 1, 0 },
                   { 0, 0, 0, 0, 0, 0, 0, 0, 0 }};

#define plan_x 9
#define plan_y 12

#define case_x 30
#define case_y 30

BITMAP *fond = NULL;
BITMAP *mapb = NULL;

void afficher_case ( BITMAP *out, l_int x, l_int y ) {
  set_clip(out,x*case_x,y*case_y,x*case_x+case_x,y*case_y+case_y);
  blit ( (map[y][x]) ? fond : mapb, out,x*case_x,y*case_y,x*case_x,y*case_y,case_x,case_y);
};

void afficher_plan ( BITMAP *out, l_int nx, l_int ny, l_int bx, l_int by ) {
  l_int x=nx,y=ny;
  while ( x < bx ) {
    y=ny;
    while ( y < by ) {
      afficher_case(out,x,y);
      y++;
    };
    x++;
  };
};

// fin bitmap

p_play snd = NULL;

////////////////////////////////////////////////////////////////////////////////
void game_timer ( p_object o ) {

  if ( snd ) if ( !snd->poll_file(snd) ) snd->play_file(snd) ;

};
////////////////////////////////////////////////////////////////////////////////
void exit_game ( p_object o ) {

  if ( mapb )  destroy_bitmap(mapb);
  if ( snd )   snd->stop_file(snd);

  screen_reload ( ); // Reload Seal Screen

  desktop->show(desktop); // Show desktop

  mouse->show(mouse);  // Show mouse

  dispose(o); // Unload Game Object

};
/* Evenements souris ..
#  MO_SF_MOUSEMOVE
#  MO_SF_MOUSELDOWN
#  MO_SF_MOUSELUP
#  MO_SF_MOUSERDOWN
#  MO_SF_MOUSERUP
#  MO_SF_MOUSEMDOWN
#  MO_SF_MOUSEMUP
#  MO_SF_MOUSESHOW
#  MO_SF_MOUSEHIDE
#  MO_SF_MOUSELAUTO
#  MO_SF_MOUSEMAUTO
#  MO_SF_MOUSERAUTO
#  MO_SF_MOUSELDOUBLE
#  MO_SF_MOUSERDOUBLE
#  MO_SF_MOUSEMDOUBLE
#  MO_SF_MOUSEDOWN
#  MO_SF_MOUSEUP
#  MO_SF_MOUSEAUTO
#  MO_SF_MOUSEDOUBLE

*/
////////////////////////////////////////////////////////////////////////////////
void game_translate_event ( p_object o, t_event *event ) {


  obj_translate_event(o, event); // Call object event handler

  if ( event->type == EV_KEYBOARD ) { // If a keyboard event happen

    exit_game ( o ); // Unload Game

    DLXUnload(ap_id); // Unload XDL

    clear_event(event); // Clear event

  } else if ( event->type == EV_MOUSE ) { // If a mouse event happen
    if ( OBJECT(mouse)->state & MO_SF_MOUSELDOWN ) { // Boutton gauche cliqu

⌨️ 快捷键说明

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