- Modified "Wave X" text for "Tabla del X"
- Implemented return values for messages - Implemented one digit answers - Project upgraded to VS2017
This commit is contained in:
0
.hgignore → .gitignore
vendored
0
.hgignore → .gitignore
vendored
@@ -64,7 +64,7 @@ void Enemies::Update() {
|
|||||||
if (betweenWaves > 0) {
|
if (betweenWaves > 0) {
|
||||||
betweenWaves--;
|
betweenWaves--;
|
||||||
if (betweenWaves < 240) {
|
if (betweenWaves < 240) {
|
||||||
char waveText[7] = "WAVE 0"; waveText[5] = wave + 48;
|
char waveText[12] = "TABLA DEL 0"; waveText[10] = 1+wave + 48;
|
||||||
Print(200, 120, waveText, 255, 255, 255);
|
Print(200, 120, waveText, 255, 255, 255);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -108,7 +108,7 @@ void Enemies::Update() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckEnemyHit(int n1, int n2) {
|
int CheckEnemyHit(int n1, int n2) {
|
||||||
for (int i = 0; i < MAX_ENEMIES; i++) {
|
for (int i = 0; i < MAX_ENEMIES; i++) {
|
||||||
if (enemies[i].y > -1) {
|
if (enemies[i].y > -1) {
|
||||||
if (enemies[i].m1 * enemies[i].m2 == n1 * 10 + n2) {
|
if (enemies[i].m1 * enemies[i].m2 == n1 * 10 + n2) {
|
||||||
@@ -121,15 +121,17 @@ void CheckEnemyHit(int n1, int n2) {
|
|||||||
if (kills == 16) {
|
if (kills == 16) {
|
||||||
betweenWaves = 360; wave++; ResetEnemies();
|
betweenWaves = 360; wave++; ResetEnemies();
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Enemies::ProcessMessage(const char* msg) {
|
void Enemies::ProcessMessage(const char* msg) {
|
||||||
if (msg == "CheckEnemyHit") {
|
if (msg == "CheckEnemyHit") {
|
||||||
int* params = GetMessageParams();
|
int* params = GetMessageParams();
|
||||||
CheckEnemyHit(params[0], params[1]);
|
SetMessageReturn(CheckEnemyHit(params[0], params[1]));
|
||||||
} else if (msg == "ResetEnemies") {
|
} else if (msg == "ResetEnemies") {
|
||||||
betweenWaves = 420; ResetEnemies();
|
betweenWaves = 420; ResetEnemies();
|
||||||
}
|
}
|
||||||
|
|||||||
9
api.cpp
9
api.cpp
@@ -16,6 +16,7 @@ std::vector<System*> systems;
|
|||||||
std::vector<std::string> msgTexts;
|
std::vector<std::string> msgTexts;
|
||||||
std::vector<System*> msgSystems;
|
std::vector<System*> msgSystems;
|
||||||
int msgParams[5];
|
int msgParams[5];
|
||||||
|
int msgReturn;
|
||||||
bool reseted = false;
|
bool reseted = false;
|
||||||
bool anyKey = false;
|
bool anyKey = false;
|
||||||
|
|
||||||
@@ -191,3 +192,11 @@ void SendMessage(const char* msg, int p1, int p2, int p3, int p4, int p5) {
|
|||||||
int* GetMessageParams() {
|
int* GetMessageParams() {
|
||||||
return msgParams;
|
return msgParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GetMessageReturn() {
|
||||||
|
return msgReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetMessageReturn(int value) {
|
||||||
|
msgReturn = value;
|
||||||
|
}
|
||||||
|
|||||||
2
api.h
2
api.h
@@ -47,3 +47,5 @@ void RegisterMessage(const char* msg, System* handler);
|
|||||||
void SendMessage(const char* msg, int p1 = 0, int p2 = 0, int p3 = 0, int p4 = 0, int p5 = 0);
|
void SendMessage(const char* msg, int p1 = 0, int p2 = 0, int p3 = 0, int p4 = 0, int p5 = 0);
|
||||||
|
|
||||||
int* GetMessageParams();
|
int* GetMessageParams();
|
||||||
|
int GetMessageReturn();
|
||||||
|
void SetMessageReturn(int value);
|
||||||
|
|||||||
@@ -18,8 +18,14 @@ void keyHandler(SDL_Scancode key) {
|
|||||||
int num = key == 98 ? 0 : key - 88;
|
int num = key == 98 ? 0 : key - 88;
|
||||||
if (digit == -1) {
|
if (digit == -1) {
|
||||||
digit = num;
|
digit = num;
|
||||||
|
SendMessage("CheckEnemyHit", 0, num);
|
||||||
|
if (GetMessageReturn() != 0) {
|
||||||
|
SendMessage("SetNumbers", -1, num);
|
||||||
|
digit = -1;
|
||||||
|
} else {
|
||||||
SendMessage("SetNumbers", num, -1);
|
SendMessage("SetNumbers", num, -1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
SendMessage("SetNumbers", -1, num);
|
SendMessage("SetNumbers", -1, num);
|
||||||
SendMessage("CheckEnemyHit", digit, num);
|
SendMessage("CheckEnemyHit", digit, num);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
@@ -14,18 +14,19 @@
|
|||||||
<ProjectGuid>{5CCE4316-2638-47DA-9C0B-3075E1120FD1}</ProjectGuid>
|
<ProjectGuid>{5CCE4316-2638-47DA-9C0B-3075E1120FD1}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>mathwars</RootNamespace>
|
<RootNamespace>mathwars</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user