📄 myfunction.cpp
字号:
#include "RpgMain.h"
int kk=0;
//---------------Rect Functions------------------------------------
void MakeRect(int left,int top,int right,int bottom)
{
if (left<0)
left=0;
if (top<0)
top=0;
if (temp==1)
{
if (right>640)
right=640;
if (bottom>480)
bottom=480;
}
r.bottom=bottom;
r.left=left;
r.right=right;
r.top=top;
}
void MakeRect(int left,int top)
{
r.bottom=top+32;
r.left=left;
r.right=left+32;
r.top=top;
}
//---------------Init & Quit Game Functions-------------------------------
void InitGame()
{
for(int i=0;i<MaxHuman;i++)
{
Human[i]=new HUMAN;
Human[i]->id=i;
Human[i]->face=up;
for(int j=0;j<20;j++)
Human[i]->Thing[j]=-1;
}
for(i=0;i<MaxBullet;i++)
{
Bullet[i]=new BULLET;
Bullet[i]->id=i;
}
Human[Boy]->SetXY(4,10);
Human[Girl]->SetXY(7,10);
Human[Girl2]->SetXY(5,11);
Human[Boy2]->SetXY(6,11);
Human[Boy]->ThingAmount=0;
Human[Boy]->health=100;
Human[Boy]->nei=100;
Map[Inn]=new MAP(Inn,20,15,"Inn.dat","Inn.bmp");
Map[Outside]= new MAP(Outside,20,15,"Outside.dat","Outside.bmp");
}
void StartGame()
{
Human[Teacher]->face=down;
Human[Teacher]->SetXY(5,8);
LongTalk=1;
Human[Teacher]->SayTo(Boy,"大家安静一下,现在上数学课了!!!");
SetAll(Busy);
SetTimer(GetActiveWindow(),1,58,GameTimer);
}
void Quit(void)
{
GameOver=1;
for(int i=0;i<MaxHuman;i++)
delete Human[i];
for(int j=0;j<MaxMap;j++)
delete Map[j];
for(int k=0;k<MaxBullet;k++)
delete Bullet[k];
PostQuitMessage(888);
}
//---------------Game Functions------------------------------------
void SetAll(int stat)
{
for(int i=0;i<MaxHuman;i++)
if (Human[i]->status!=Dead)
Human[i]->status=stat;
}
//---------------Status Functions----------------------------------
void ShowNei()
{
int newnei=Human[Boy]->nei;
MakeRect(30,0,40,100-newnei);
lpDDSOver->BltFast(627,377,lpDDSBar,&r,SrcKey);
MakeRect(20,100-newnei,30,100);
lpDDSOver->BltFast(627,477-newnei,lpDDSBar,&r,SrcKey);
}
void ShowTi()
{
int newti=Human[Boy]->ti;
MakeRect(30,0,40,100-newti);
lpDDSOver->BltFast(607,377,lpDDSBar,&r,SrcKey);
MakeRect(10,100-newti,20,100);
lpDDSOver->BltFast(607,477-newti,lpDDSBar,&r,SrcKey);
}
void ShowHealth()
{
int newhealth=Human[Boy]->health;
MakeRect(30,0,40,100-newhealth);
lpDDSOver->BltFast(587,377,lpDDSBar,&r,SrcKey);
MakeRect(0,100-newhealth,10,100);
lpDDSOver->BltFast(587,477-newhealth,lpDDSBar,&r,SrcKey);
}
//---------------Other------------------------------------
void CleanDialog()
{
MakeRect(0,320,160,480);
CleanRect(lpDDSOver);
MakeRect(180,400,580,420);
CleanRect(lpDDSOver);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -