-
Notifications
You must be signed in to change notification settings - Fork 0
/
GameLoad.h
167 lines (155 loc) · 3.14 KB
/
GameLoad.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#pragma once
#include<iostream>
#include <graphics.h> // 引用图形库头文件
#include<vector>
#include<ctime>
#include<string>
#include <stdio.h>
#include <cmath>
#include <mmsystem.h>
#include<stdlib.h>
#include<Windows.h>
#include<conio.h>
#pragma warning (disable:4996)
#pragma comment( lib, "MSIMG32.LIB")
#pragma comment( lib, "winmm.lib")
using namespace std;
#define GRASS 0
extern IMAGE potatoBoom; //定义各种图片
extern IMAGE potato;
extern IMAGE grave[8];
extern IMAGE hammer[13];
extern IMAGE tmpImg;
extern IMAGE tmpImg2;
extern IMAGE potaotoMinePictures[8];
extern IMAGE iceshroomPictures[11];
extern IMAGE gravebusterPictures[28];
extern IMAGE sunPictures[22];
extern IMAGE normalZombieWalkPictures[47];
extern IMAGE normalZombieEmergePictures[20];
extern IMAGE normalZombieEatPictures[10];
extern IMAGE coneheadZombieWalkPictures[47];
extern IMAGE coneheadZombieEmergePictures[20];
extern IMAGE coneheadZombieEatPictures[10];
extern IMAGE bucketheadZombieWalkPictures[47];
extern IMAGE bucketheadZombieEmergePictures[20];
extern IMAGE bucketheadZombieEatPictures[10];
extern IMAGE plantsBar;
extern IMAGE menu;
extern IMAGE background;
extern IMAGE selectID;
extern IMAGE iceTrap;
extern IMAGE snow;
extern IMAGE lawnmower;
extern IMAGE loseGame;
extern IMAGE winGame;
extern IMAGE bang;
// 游戏参数
extern int mapState[32][32]; // 地图状态。0:空,1:墓碑,2:地雷(没出土),3:地雷(已出土),4:寒冰菇
struct coordinate //坐标结构!
{
int x;
int y;
};
extern coordinate xys[32][32]; //地图?
extern int currentSunshine;
extern double normalfrequency;
extern double coneheadfrequency;
extern double bucketheadfrequency;
extern double SunsFrequency;
extern int isNewGame;
extern int isHitting;
extern int hammerRadius;
extern int drawingHint;
extern int hintCountDown;
extern int snowCountDown;
extern int graveNum;
extern int Win1Lose2;
void loadImages(IMAGE imgs[], const char path[], int n, int begin);
void loading();
void transparentImage(IMAGE* dstimg, int x, int y, IMAGE* srcimg);
void addIce(IMAGE* targetImage, IMAGE* srcImage, int addRed = 0, int addGreen = 0, int addBlue = 50);
void HpSleep(int ms);
template<class T>
class Node
{
public:
T* content;
Node* next = NULL;
Node(T* t)
{
content = t;
}
};
template<class T>
class LinkList
{
public:
Node<T>* head;
Node<T>* tail;
LinkList()
{
head = NULL;
tail = NULL;
};
LinkList(Node<T> node)
{
head = node;
tail = node;
};
~LinkList()
{
DeleteAllNode();
}
void InsertNode(T* t)
{
Node<T>* node = new Node<T>(t);
if (head == NULL)
{
head = node;
tail = node;
}
else
{
tail->next = node;
tail = node;
}
};
void DeleteNode(int No)
{
Node<T>* cur = head, * pre = NULL;
while (cur != NULL && cur->content->No != No)
{
pre = cur;
cur = cur->next;
}
if (pre == NULL)
{
head = cur->next;
}
else if (cur == NULL)
{
cout << "没有找到符合条件的结点!" << endl;
return;
}
else
{
pre->next = cur->next;
}
if (cur == tail)
{
tail = pre;
}
delete cur;
};
void DeleteAllNode()
{
Node<T>* cur = head, * pre = NULL;
while (tail != NULL)
{
pre = cur;
cur = cur->next;
DeleteNode(pre->content->No);
}
};
};