From 8849d1b66c538fa6a00bdafefe7f17930fba0a2f Mon Sep 17 00:00:00 2001 From: Thomas R Date: Thu, 13 Jan 2022 10:23:26 +0100 Subject: [PATCH] hey --- doc/SAE102-SpaceInvaders/html/db/d86/display_8cpp.html | 6 +++--- .../html/db/d86/display_8cpp_source.html | 8 ++++---- doc/SAE102-SpaceInvaders/html/globals.html | 2 +- doc/SAE102-SpaceInvaders/html/globals_func.html | 2 +- doc/SAE102-SpaceInvaders/latex/db/d86/display_8cpp.tex | 2 +- .../latex/db/d86/display_8cpp_source.tex | 2 +- src/display.cpp | 6 +++--- src/godManager.cpp | 8 ++++---- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/doc/SAE102-SpaceInvaders/html/db/d86/display_8cpp.html b/doc/SAE102-SpaceInvaders/html/db/d86/display_8cpp.html index 1bb7107..e6a0bec 100644 --- a/doc/SAE102-SpaceInvaders/html/db/d86/display_8cpp.html +++ b/doc/SAE102-SpaceInvaders/html/db/d86/display_8cpp.html @@ -133,7 +133,7 @@ Include dependency graph for display.cpp: - +

Functions

void applyBezierCurbe (Position &pos, const Position &point, const double percent)
void applyBezierCurve (Position &pos, const Position &point, const double percent)
 

Detailed Description

@@ -147,13 +147,13 @@ SIMAILA Djalim

Definition in file display.cpp.

Function Documentation

-

◆ applyBezierCurbe()

+

◆ applyBezierCurve()

- + diff --git a/doc/SAE102-SpaceInvaders/html/db/d86/display_8cpp_source.html b/doc/SAE102-SpaceInvaders/html/db/d86/display_8cpp_source.html index 7722eaf..a539a26 100644 --- a/doc/SAE102-SpaceInvaders/html/db/d86/display_8cpp_source.html +++ b/doc/SAE102-SpaceInvaders/html/db/d86/display_8cpp_source.html @@ -169,7 +169,7 @@ $(document).ready(function(){initNavTree('db/d86/display_8cpp_source.html','../.
93 }
94}
95
-
96void applyBezierCurbe(Position& pos, const Position& point, const double percent) {
+
96void applyBezierCurve(Position& pos, const Position& point, const double percent) {
97 pos += (point-pos)*percent;
98}
99
@@ -207,8 +207,8 @@ $(document).ready(function(){initNavTree('db/d86/display_8cpp_source.html','../.
131 Position pos(god.getRightHandPos(pm->getScreenWidth()));
132 Position endPos = invIndexToPos(god.thrownInvPosX, god.thrownInvPosY);
133
-
134 applyBezierCurbe(pos, god.thrownTransition, god.counter / 100.0);
-
135 applyBezierCurbe(pos, endPos, god.counter / 100.0);
+
134 applyBezierCurve(pos, god.thrownTransition, god.counter / 100.0);
+
135 applyBezierCurve(pos, endPos, god.counter / 100.0);
136
137 // pos is now the position we need to draw our hand to
138 pm->drawSprite(pm->rightHand, pos);
@@ -256,7 +256,7 @@ $(document).ready(function(){initNavTree('db/d86/display_8cpp_source.html','../.
InvaderType thrownInvType
type of the invader thrown by the hand of god
Definition: god.h:75
unsigned thrownInvPosX
x index (column in the grid) of the invader thrown by the hand of god
Definition: god.h:65
player's projectiles
Definition: projectiles.h:22
-
void applyBezierCurbe(Position &pos, const Position &point, const double percent)
Definition: display.cpp:96
+
void applyBezierCurve(Position &pos, const Position &point, const double percent)
Definition: display.cpp:96
full game logic and display management
#define GOD_HAND_DISTANCE
Definition: god.h:36
#define GOD_BENCH_SIZE
Definition: god.h:34
diff --git a/doc/SAE102-SpaceInvaders/html/globals.html b/doc/SAE102-SpaceInvaders/html/globals.html index 1fe2a7c..b630856 100644 --- a/doc/SAE102-SpaceInvaders/html/globals.html +++ b/doc/SAE102-SpaceInvaders/html/globals.html @@ -93,7 +93,7 @@ $(document).ready(function(){initNavTree('globals.html',''); initResizable(); })

- a -

  • ADD_SPRITE_TASK : pixelManager.h
  • -
  • applyBezierCurbe() : display.cpp
  • +
  • applyBezierCurve() : display.cpp
  • applyTransformation() : utils.h, utils.cpp
  • ARCHITECTURE_ID : CMakeCCompilerId.c, CMakeCXXCompilerId.cpp
  • areLinesColliding() : utils.h, utils.cpp
  • diff --git a/doc/SAE102-SpaceInvaders/html/globals_func.html b/doc/SAE102-SpaceInvaders/html/globals_func.html index 38b862b..959e6e0 100644 --- a/doc/SAE102-SpaceInvaders/html/globals_func.html +++ b/doc/SAE102-SpaceInvaders/html/globals_func.html @@ -85,7 +85,7 @@ $(document).ready(function(){initNavTree('globals_func.html',''); initResizable(
     
      -
    • applyBezierCurbe() : display.cpp
    • +
    • applyBezierCurve() : display.cpp
    • applyTransformation() : utils.h, utils.cpp
    • areLinesColliding() : utils.h, utils.cpp
    • main() : CMakeCCompilerId.c, CMakeCXXCompilerId.cpp, main.cpp
    • diff --git a/doc/SAE102-SpaceInvaders/latex/db/d86/display_8cpp.tex b/doc/SAE102-SpaceInvaders/latex/db/d86/display_8cpp.tex index a6c4182..906e803 100644 --- a/doc/SAE102-SpaceInvaders/latex/db/d86/display_8cpp.tex +++ b/doc/SAE102-SpaceInvaders/latex/db/d86/display_8cpp.tex @@ -45,7 +45,7 @@ Definition in file \mbox{\hyperlink{display_8cpp_source}{display.\+cpp}}. \mbox{\Hypertarget{display_8cpp_a72e79615fef9e4505aad10d5b4fb4b5e}\label{display_8cpp_a72e79615fef9e4505aad10d5b4fb4b5e}} \index{display.cpp@{display.cpp}!applyBezierCurbe@{applyBezierCurbe}} \index{applyBezierCurbe@{applyBezierCurbe}!display.cpp@{display.cpp}} -\doxysubsubsection{\texorpdfstring{applyBezierCurbe()}{applyBezierCurbe()}} +\doxysubsubsection{\texorpdfstring{applyBezierCurbe()}{applyBezierCurve()}} {\footnotesize\ttfamily void apply\+Bezier\+Curbe (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}} \&}]{pos, }\item[{const \mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}} \&}]{point, }\item[{const double}]{percent }\end{DoxyParamCaption})} diff --git a/doc/SAE102-SpaceInvaders/latex/db/d86/display_8cpp_source.tex b/doc/SAE102-SpaceInvaders/latex/db/d86/display_8cpp_source.tex index 290b992..fb600de 100644 --- a/doc/SAE102-SpaceInvaders/latex/db/d86/display_8cpp_source.tex +++ b/doc/SAE102-SpaceInvaders/latex/db/d86/display_8cpp_source.tex @@ -123,7 +123,7 @@ \DoxyCodeLine{\Hypertarget{display_8cpp_source_l00132}00132 \mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}} endPos = invIndexToPos(god.\mbox{\hyperlink{class_god_ae7ed525f130083f511728c791c35a95d}{thrownInvPosX}}, god.\mbox{\hyperlink{class_god_a26fbb775dff480eaa6a19d4a3ef9731c}{thrownInvPosY}});} \DoxyCodeLine{\Hypertarget{display_8cpp_source_l00133}00133 } \DoxyCodeLine{\Hypertarget{display_8cpp_source_l00134}00134 \mbox{\hyperlink{display_8cpp_a72e79615fef9e4505aad10d5b4fb4b5e}{applyBezierCurbe}}(pos, god.\mbox{\hyperlink{class_god_a41b9ceec78e403a54cf8afaf6e50519a}{thrownTransition}}, god.\mbox{\hyperlink{class_god_a1000165e05f6719539b7702ab3f09a66}{counter}} / 100.0);} -\DoxyCodeLine{\Hypertarget{display_8cpp_source_l00135}00135 \mbox{\hyperlink{display_8cpp_a72e79615fef9e4505aad10d5b4fb4b5e}{applyBezierCurbe}}(pos, endPos, god.\mbox{\hyperlink{class_god_a1000165e05f6719539b7702ab3f09a66}{counter}} / 100.0);} +\DoxyCodeLine{\Hypertarget{display_8cpp_source_l00135}00135 \mbox{\hyperlink{display_8cpp_a72e79615fef9e4505aad10d5b4fb4b5e}{applyBezierCurve}}(pos, endPos, god.\mbox{\hyperlink{class_god_a1000165e05f6719539b7702ab3f09a66}{counter}} / 100.0);} \DoxyCodeLine{\Hypertarget{display_8cpp_source_l00136}00136 } \DoxyCodeLine{\Hypertarget{display_8cpp_source_l00137}00137 \textcolor{comment}{// pos is now the position we need to draw our hand to}} \DoxyCodeLine{\Hypertarget{display_8cpp_source_l00138}00138 pm-\/>drawSprite(pm-\/>rightHand, pos);} diff --git a/src/display.cpp b/src/display.cpp index 19ee8a8..ee1dace 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -94,7 +94,7 @@ void Game::displayInvader(const Position& pos, InvaderType type) const { } } -void applyBezierCurbe(Position& pos, const Position& point, const double percent) { +void applyBezierCurve(Position& pos, const Position& point, const double percent) { pos += (point-pos)*percent; } @@ -132,8 +132,8 @@ void Game::displayGod() const { Position pos(god.getRightHandPos(pm->getScreenWidth())); Position endPos = invIndexToPos(god.thrownInvPosX, god.thrownInvPosY); - applyBezierCurbe(pos, god.thrownTransition, god.counter / 100.0); - applyBezierCurbe(pos, endPos, god.counter / 100.0); + applyBezierCurve(pos, god.thrownTransition, god.counter / 100.0); + applyBezierCurve(pos, endPos, god.counter / 100.0); // pos is now the position we need to draw our hand to pm->drawSprite(pm->rightHand, pos); diff --git a/src/godManager.cpp b/src/godManager.cpp index 8ac929a..dad71e0 100644 --- a/src/godManager.cpp +++ b/src/godManager.cpp @@ -47,6 +47,7 @@ bool Game::manageGod() { // init throw god.counter = 0; god.state = GodState::RETRIEVE1; + // We're sure there is at least one valid column/invader, else the game would have ended and we would not be here god.thrownInvPosX = grid.randomValidCol(); god.thrownInvPosY = grid[god.thrownInvPosX].randomValidInv(); god.thrownInvType = InvaderType::NONE; @@ -116,10 +117,6 @@ bool Game::manageGod() { (invaderPos.getX() < 0 || invaderPos.getX() + confData.invadersSize >= pm->getScreenWidth())) { touched = true; - /* there are no invaders in the grid anymore, and the one thrown just went out of bound - * So... return true, the player wins*/ - if(!areThereInvadersLeft())return true; - // check player collision } else if (invaderPos.getY() + confData.invadersSize >= pm->getScreenHeight() - PLAYER_HEIGHT) { for (Player &p: players) { @@ -138,6 +135,9 @@ bool Game::manageGod() { if (touched) { god.state = GodState::WAIT; god.counter = 0; + /* there are no invaders in the grid anymore, and the one thrown just disappeared + * So... return true, the player wins*/ + if(!areThereInvadersLeft())return true; } /* we do not need to reset other members, they'll be treated as non-initialized * When we cycle back between states*/
void applyBezierCurbe void applyBezierCurve ( Position pos,