资源简介
斗兽棋游戏:带动物叫声 C++ VS2005
代码片段和文件信息
#include “StdAfx.h“
#include “AniChess.h“
#include “Resource.h“
#include
POINT CAniChess::CBCORR_[CBROW][CBCOL];
const unsigned int CAniChess::WAVERES[8]=\
{IDR_WA_ELEPHANTIDR_WA_LIONIDR_WA_TIGERIDR_WA_LEOPARD\
IDR_WA_WOLFIDR_WA_DOGIDR_WA_CATIDR_WA_MOUSE};
//IDR_WS_EATIDR_WS_GOIDR_WS_WINIDR_WS_LOSE
const POINT CAniChess::ENDPICSIZE[5]={{760499}{692512}{615446}\
{687464}{469621}};
CAniChess::CAniChess(void)
{
}
CAniChess::~CAniChess(void)
{
}
extern const int JC_BACK_CLR;
void CAniChess::InitOnce()
{
//CBROW=9CBCOL=7;
int ij;
for(i=0;i {
for(j=0;j {
CBCORR_[i][j].x=HOLEWIDTH*j+HOFFSET;
CBCORR_[i][j].y=HOLEHEIGHT*i+VOFFSET;
chessboard_[i][j]=0;
}
}
SetHoleType();
brush_.CreateSolidBrush(JC_BACK_CLR);
}
void CAniChess::Init()
{
int ij;
for(i=0;i {
for(j=0;j {
ClearChessType(ij);
}
}
who_=1;
selrow_=selcol_=INVRC;
SetChessType(26CHESS_ELEPHANT1);
SetChessType(00CHESS_LION1);
SetChessType(06CHESS_TIGER1);
SetChessType(22CHESS_LEOPARD1);
SetChessType(24CHESS_WOLF1);
SetChessType(11CHESS_DOG1);
SetChessType(15CHESS_CAT1);
SetChessType(20CHESS_MOUSE1);
SetChessType(60CHESS_ELEPHANT2);
SetChessType(86CHESS_LION2);
SetChessType(80CHESS_TIGER2);
SetChessType(64CHESS_LEOPARD2);
SetChessType(62CHESS_WOLF2);
SetChessType(75CHESS_DOG2);
SetChessType(71CHESS_CAT2);
SetChessType(66CHESS_MOUSE2);
gainchessidx_[0]=gainchessidx_[1]=0;
endbmpindx_=0;
gameendhold_=false;
}
void CAniChess::SetChessType(int rowint colunsigned char chessunsigned char who)
{
//lower 5 bits (4~0): chess id
//---bit 43: 00:no chess 01:player 1 chess 10:player 2 chess 11: reserved.
//---bit 210: CHESSID
/*
static const unsigned char CHESS_ELEPHANT=0;
static const unsigned char CHESS_LION=1;
static const unsigned char CHESS_TIGER=2;
static const unsigned char CHESS_LEOPARD=3;
static const unsigned char CHESS_WOLF=4;
static const unsigned char CHESS_DOG=5;
static const unsigned char CHESS_CAT=6;
static const unsigned char CHESS_MOUSE=7;
*/
ClearChessType(rowcol);
unsigned char tct=0;
if(who==1) // player 1
tct|=1<<3;
else //player 2
tct|=1<<4;
tct|=chess;
chessboard_[row][col]|=tct;
}
void CAniChess::ClearChessType(int rowint col)
{
chessboard_[row][col]&=0xe0;//0xe0 = bin 11100000 clear lower 5 bits (4~0)
}
void CAniChess::GetChessType(int rowint colunsigned char &chessunsigned char &who)
{
who=(chessboard_[row][col]&0x18)>>3; //0x18 = bin 00011000
//00:no chess 01:player 1 chess 10:player 2 chess 11: reserved.
chess=chessboard_[row][col]&0x7; //0x7=00000111
}
void CAniChess::SetHoleType()
{
//higher 3 bits (7~5): hole type
//---000 normal hole
//---001 river
//---010 player 1 trap
//---011 player 2 trap
//---100
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 898 2015-08-24 22:19 AnimalChess.sln
文件 15232000 2016-09-07 21:14 AnimalChess.ncb
文件 16445 2015-11-09 21:24 AnimalChess\AniChess.cpp
文件 3149 2015-11-05 23:41 AnimalChess\AniChess.h
文件 8996604 2015-11-05 23:04 AnimalChess\AnimalChess.aps
文件 2906 2015-08-24 22:22 AnimalChess\AnimalChess.cpp
文件 501 2015-08-24 22:19 AnimalChess\AnimalChess.h
文件 11997 2015-11-05 23:04 AnimalChess\AnimalChess.rc
文件 632 2015-08-24 22:19 AnimalChess\AnimalChess.reg
文件 10553 2015-11-05 23:04 AnimalChess\AnimalChess.vcproj
文件 1427 2016-09-07 21:14 AnimalChess\AnimalChess.vcproj.UBPJ19NPZWDN1SU.Administrator.user
文件 1181 2015-11-02 22:51 AnimalChess\AnimalChessDoc.cpp
文件 621 2015-08-24 23:12 AnimalChess\AnimalChessDoc.h
文件 6837 2015-11-05 23:41 AnimalChess\AnimalChessView.cpp
文件 1456 2015-11-05 22:57 AnimalChess\AnimalChessView.h
文件 1006 2015-08-24 22:20 AnimalChess\MainFrm.cpp
文件 509 2015-08-24 22:19 AnimalChess\MainFrm.h
文件 3170 2015-08-24 22:19 AnimalChess\ReadMe.txt
文件 21630 2015-08-26 00:07 AnimalChess\res\AnimalChess.ico
文件 367 2015-08-24 22:19 AnimalChess\res\AnimalChess.rc2
文件 1078 2015-08-24 22:33 AnimalChess\res\AnimalChessDoc.ico
文件 1694390 2015-10-26 21:16 AnimalChess\res\pics\chessboard.bmp
文件 1137774 2015-11-05 23:04 AnimalChess\res\pics\end bmp\end-cat.bmp
文件 1062966 2015-11-05 23:04 AnimalChess\res\pics\end bmp\end-dog.bmp
文件 824262 2015-11-05 23:04 AnimalChess\res\pics\end bmp\end-elephant.bmp
文件 957750 2015-11-05 23:04 AnimalChess\res\pics\end bmp\end-shuimu.bmp
文件 874422 2015-11-05 23:04 AnimalChess\res\pics\end bmp\end-tiger.bmp
文件 144054 2015-11-05 22:06 AnimalChess\res\pics\end bmp\redwin - 副本.bmp
文件 144054 2015-11-05 22:57 AnimalChess\res\pics\end bmp\redwin.bmp
文件 144054 2015-11-05 22:09 AnimalChess\res\pics\end bmp\yellowwin - 副本.bmp
............此处省略39个文件信息
- 上一篇:跳棋游戏(人人对弈)
- 下一篇:灰色预测模型资料和程序.rar
评论
共有 条评论