资源简介
这是一个模仿任天堂经典游戏《超级玛丽》的克隆游戏。目前支持windows 和linux两种操作系统。你应该已经得到了这个游戏的全部源代码和地图编辑器 的源代码。地图编辑器( MapEdit目录下 )使你可以充分发挥想象力,轻而易举 地创造出游戏中的关卡( 目前我只做了两关 )。

代码片段和文件信息
//-----------------------------------------------------------------------------
//
// Copyright (C) July 24 2000 by Zhang Yong
// Email: z-meng@yeah.net
// This source is available for distribution and/or modification
// only under the terms of the GPL license.
//
// The source is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the GPL.txt for more details.
//
//-----------------------------------------------------------------------------
#include “sprite.h“
#include “plane.h“
#include “sound.h“
#include “input.h“
#include
#include
#include “mytime.h“
CBitmap g_bmTile;
CBitmap g_bmPlayer;
CBitmap g_bmGhost;
CBitmap g_bmTurtle;
CBitmap g_bmCoin;
CBitmap g_bmMushroom;
CBitmap g_bmDebris;
CBitmap g_bmBullet;
CBitmap g_bmExplode;
CBitmap g_bmFlower;
CPlane g_plane;
CPlayer g_player;
CSpriteList g_sprites;
CInput g_input;
BOOL g_bPaused;
BOOL g_bShowStats;
int g_level;
BOOL g_darken;
CTime g_lasttime;
void TRACE( char *format ... );
void SetPalette( PALETTEENTRY ape[] );
void ClearBackground();
void OutputText( int x int y char *text );
void FlipScreen();
/*
* LoadPalette
*
* Create a DirectDrawPalette from a palette file
*
* if the palette files cant be found make a default 332 palette
*/
BOOL LoadPalette( char *fname PALETTEENTRY ape[] )
{
FILE *fp;
struct {
DWORD dwRiff;
DWORD dwFileSize;
DWORD dwPal;
DWORD dwData;
DWORD dwDataSize;
WORD palVersion;
WORD palNumEntries;
} header;
header.dwRiff = 0;
if( fname )
{
fp = fopen( fname “rb“ );
if( fp )
fread( &header sizeof(header) 1 fp );
}
/*
* if the file is not a palette file or does not exist
* default to a 332 palette
*/
if (header.dwRiff != 0x46464952 || // ‘RIFF‘
header.dwPal != 0x204C4150 || // ‘PAL ‘
header.dwData != 0x61746164 || // ‘data‘
header.palVersion != 0x0300 ||
header.palNumEntries > 256 ||
header.palNumEntries < 1)
{
TRACE( “Can‘t open palette file using default 332.“ );
for( int i = 0; i < 256; i++ )
{
ape[i].peRed = (BYTE)(((i >> 5) & 0x07) * 255 / 7);
ape[i].peGreen = (BYTE)(((i >> 2) & 0x07) * 255 / 7);
ape[i].peBlue = (BYTE)(((i >> 0) & 0x03) * 255 / 3);
ape[i].peFlags = (BYTE)0;
}
return FALSE;
}
fread( ape sizeof(PALETTEENTRY) 256 fp );
fclose( fp );
return TRUE;
} /* LoadPalette */
void PauseGame()
{
g_bPaused = !g_bPaused;
if( g_bPaused )
{
#ifdef _WIN32
PauseMidi();
#endif
}
else
{
#ifdef _WIN32
ResumeMidi();
#en
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1023 2000-07-26 11:50 supermario\bitmap.h
文件 1048 2000-05-25 21:29 supermario\bright.pal
文件 1048 2000-07-23 23:37 supermario\darken.pal
文件 8664 2000-07-26 19:47 supermario\game.cpp
文件 1017 2000-07-26 19:47 supermario\game.h
文件 2102 2000-07-23 16:03 supermario\graphics\bullet.bmp
文件 2614 2000-07-21 10:25 supermario\graphics\coin.bmp
文件 2102 2000-07-23 11:02 supermario\graphics\debris.bmp
文件 4150 2000-07-26 14:40 supermario\graphics\explode.bmp
文件 2102 2000-07-23 13:35 supermario\graphics\flower.bmp
文件 7222 2000-07-22 11:24 supermario\graphics\ghost.bmp
文件 2102 2000-07-23 13:36 supermario\graphics\mushroom.bmp
文件 50230 2000-07-24 15:33 supermario\graphics\pla
文件 33846 2000-07-23 22:27 supermario\graphics\tile.bmp
文件 19510 2000-07-25 17:05 supermario\graphics\turtle.bmp
文件 1283 2000-07-26 18:54 supermario\input.h
文件 24225 2000-07-25 18:17 supermario\level\level1.dat
文件 22728 2000-07-25 11:35 supermario\level\level2.dat
文件 2992 2000-07-26 19:45 supermario\linux\bitmap.cpp
文件 2796 2000-07-26 19:46 supermario\linux\input.cpp
文件 2276 2000-07-26 19:46 supermario\linux\main.cpp
文件 741 2000-07-26 18:10 supermario\linux\Makefile
文件 926 2000-07-26 19:46 supermario\linux\mytime.cpp
文件 2534 2000-07-24 14:22 supermario\MapEdit\GhostList.cpp
文件 811 2000-07-24 14:22 supermario\MapEdit\GhostList.h
文件 2641 2000-07-24 11:55 supermario\MapEdit\MainFrm.cpp
文件 1629 2000-07-22 19:26 supermario\MapEdit\MainFrm.h
文件 4389 2000-07-24 22:21 supermario\MapEdit\MapEdit.clw
文件 4213 2000-07-22 15:56 supermario\MapEdit\MapEdit.cpp
文件 5333 2000-07-26 00:29 supermario\MapEdit\MapEdit.dsp
............此处省略63个文件信息
相关资源
- C++中头文件与源文件的作用详解
- C++多线程网络编程Socket
- VC++ 多线程文件读写操作
- 利用C++哈希表的方法实现电话号码查
- 移木块游戏,可以自编自玩,vc6.0编写
- C++纯文字DOS超小RPG游戏
- LINUX下命令行界面的C语言细胞游戏
- 尚观培训linux许巍老师关于c语言的课
- VC++MFC小游戏实例教程(实例)+MFC类库
- 连铸温度场计算程序(C++)
- 6自由度机器人运动学正反解C++程序
- Em算法(使用C++编写)
- libstdc++-4.4.7-4.el6.i686.rpm
- VC++实现CMD命令执行与获得返回信息
- 白话C++(全)
- C++标准库第1、2
- 大数类c++大数类
- C++语言编写串口调试助手
- c++素数筛选法
- 《Linux程序设计》第四版pdf高清电子版
- C++ mqtt 用法
- 商品库存管理系统 C++ MFC
- c++ 多功能计算器
- C++17 In Detail
- linux 0.11内核代码
- linux ac108多麦方案驱动(ac108.c)
- 共享内存 读写
- 简易web服务器的设计与实现
- 《LINUX C编程从初学到精通》光盘源码
- 嵌入式QtC++编程课件
评论
共有 条评论