void PlayerState_AtBase() { GfxDbgPrintf("You are at the base \n"); g_iActualArtefacts += g_iPlayerInventory; GfxDbgPrintf("You put %d artefacts in the base, you actually have %d artefacts\n", g_iPlayerInventory, g_iActualArtefacts); g_iPlayerInventory = 0; g_TPlayerData.m_ePlayerState = g_TPlayerData.EPlayerState_GoingToCave; }
void TXML_Data::FindNextTag(char * pCurrentTagEnd, char *& pNextTagOpening, char *& pNextTagClosing) { bool bValidTag = true; //SEARCH START OF NEXT TAG char * pChar = strchr(pCurrentTagEnd, '<'); if (pChar == nullptr) //end of file found { pNextTagOpening = strchr(pCurrentTagEnd, '\0'); pNextTagClosing = pNextTagOpening; bValidTag = false; } else { pNextTagOpening = pChar; //SEARCH END OF NEXT TAG pChar = strchr(pNextTagOpening, '>'); if (pChar == nullptr) //error end of file found before closing { pNextTagOpening = nullptr; pNextTagClosing = nullptr; GfxDbgPrintf("ERROR : TAG NOT CLOSED"); bValidTag = false; } else { pNextTagClosing = pChar; pChar = strchr(pNextTagOpening + 1, '<'); if (pChar != nullptr && pChar < pNextTagClosing) //error new tag oppened before closing { pNextTagOpening = nullptr; pNextTagClosing = nullptr; GfxDbgPrintf("ERROR : TAG NOT CLOSED"); bValidTag = false; } } } //CHECK IF TAG IS TO BE IGNORED AND IF YES FIND NEXT ONE if (bValidTag && (TagToIgnore(pNextTagOpening, pNextTagClosing, "?xml", "?") || TagToIgnore(pNextTagOpening, pNextTagClosing, "!--", "--"))) { char * pTempNextTagClosing = pNextTagClosing; FindNextTag(pTempNextTagClosing, pNextTagOpening, pNextTagClosing); } }
void TXML_Data::BoundariesStrncpyMaxed(char * pStart, char * pEnd, char * pTarget, int iMaxSize, const char pWarningParam[]) { int iSize = pEnd - pStart; if (iSize > iMaxSize) { GfxDbgPrintf("WARNING : "); GfxDbgPrintf(pWarningParam); GfxDbgPrintf(" exceeds max size, truncation will occur \n"); iSize = iMaxSize; } strncpy(pTarget, pStart, iSize); }
void PlayerState_Searching() { if (g_bSearchingLaunch == false) { g_iTime = GfxMathGetRandomInteger(1, 3); g_bSearchingLaunch = true; } if (g_iTime > 0) { g_iTime -= GfxTimeFrameGetCurrentDurationInSeconds(); } if (g_iTime <= 0) { g_pCave[g_iCurrentCaveTarget].bIsSearched = true; g_iPlayerInventory = GfxMathGetRandomInteger(0, 3); GfxDbgPrintf("You finished searching and you found %d artefacts\n", g_iPlayerInventory); g_iTime = 0; g_bSearchingLaunch = false; if (g_iPlayerInventory > 0) { g_TPlayerData.m_ePlayerState = g_TPlayerData.EPlayerState_GoingToBase; } else { g_TPlayerData.m_ePlayerState = g_TPlayerData.EPlayerState_GoingToCave; } } }
void CalculateDebugTime(const char * pText) { g_iNowTime = GfxTimeGetMilliseconds(); g_iDebugTime = (g_iNowTime - g_iFirstTime); GfxDbgPrintf("%s take %i milisecond\n", pText, int(g_iDebugTime)); g_iFirstTime = GfxTimeGetMilliseconds(); }
void PlayerState_GoingToBase() { if (g_bMoving == false) { GfxDbgPrintf("You are going to the base\n"); } g_bMoving = true; //----------------------------------------- TRY ---------------------------------------------------------------- int sizeX = (GfxGetDisplaySizeX() / 2); int sizeY = (GfxGetDisplaySizeY() / 2); ArcheoStuffs::Move(TGfxVec2(sizeX - 8, sizeY - 8), TGfxVec2(float(g_TPlayerData.iPosX), float(g_TPlayerData.iPosY))); }
int TInterface::CheckInput() { if( GfxInputIsJustReleased( EGfxInputID_MouseLeft ) ) { const float fMouseX = ( float ) GfxGetCurrentMouseX(); const float fMouseY = ( float ) GfxGetCurrentMouseY(); const TGfxVec2 tMousePos = TGfxVec2( fMouseX, fMouseY ); for( int i = 0; i < BUTTON_MAX; i++ ) { if( m_pButtons[i] != nullptr && m_pButtons[i]->CollidePoint( tMousePos ) ) { GfxDbgPrintf( "CLICK %d\n", i ); return i; } } } return BUTTON_NULL; }
void PlayerState_GoingToCave() { if (g_bMoving == false) { do { g_iCurrentCaveTarget = GfxMathGetRandomInteger(0, 5); } while (g_pCave[g_iCurrentCaveTarget].bIsSearched == true); GfxDbgPrintf("You are going to the cave number %d\n", g_iCurrentCaveTarget + 1); } g_bMoving = true; //----------------------------------------- TRY ---------------------------------------------------------------- ArcheoStuffs::Move(TGfxVec2(float(g_pCave[g_iCurrentCaveTarget].iPosX), float(g_pCave[g_iCurrentCaveTarget].iPosY)), TGfxVec2(float(g_TPlayerData.iPosX), float(g_TPlayerData.iPosY))); }
void PlayerState_AtCave() { GfxDbgPrintf("You are at the cave number %d\n", g_iCurrentCaveTarget + 1); g_TPlayerData.m_ePlayerState = g_TPlayerData.EPlayerState_Searching; }
void Initialize() { TGfxFile * pFile = GfxFileOpenRead("test2.XML"); int iFileSize = GfxFileSize(pFile); char * g_ToParse = static_cast<char*>(GfxMemAlloc(iFileSize + 1)); int iAlign = 0; for (int i = 0; i < iFileSize; i++) { g_ToParse[i] = GfxFileReadChar(pFile); } g_ToParse[iFileSize] = 0; int iPointeur = 0; int iNbrAttribut = 0; GfxFileClose(pFile); char * pch; // Création de la position dans la mémoire actuelle, un pointeur. GfxDbgPrintf("Parsing the xml file : \n\n%s\n\n", g_ToParse); // Printf d'explication pch = strchr(g_ToParse, '<'); while ((pch - g_ToParse) < iFileSize) { if (pch != nullptr) { if ((strchr(pch, '/')) < (strchr(pch, '>'))) // Balise auto fermante ou fermante { if ((strchr(pch, '/')) - 1 == pch) // Balise fermante { //int iCpt = ((strchr(pch, '>')) - (strchr(pch, '<'))); //char * cTest = (strchr(pch, '<') + 1); //for (int i = 0; i < iCpt - 1; i++) //{ // GfxDbgPrintf("%c", cTest[i]); //} iAlign--; for (int i = 0; i < iAlign; i++) { GfxDbgPrintf("\t"); } GfxDbgPrintf("Balise Fermante : "); /* Afficher le nom de l'élément : */ int iCpt = ((strchr(pch, '>')) - (strchr(pch, '<'))); char * cTest = (strchr(pch, '<') + 1); for (int i = 1; i < iCpt - 1; i++) { GfxDbgPrintf("%c", cTest[i]); } GfxDbgPrintf("\n"); if (strchr(pch+1, '<') == nullptr) { break; } pch = (strchr(pch+1, '<')); } else // Balise auto fermante { iNbrAttribut = 0; for (int i = 0; i < iAlign; i++) { GfxDbgPrintf("\t"); } GfxDbgPrintf("Balise Auto-Fermante : "); if (strchr(pch + 1, '=') == nullptr) { iNbrAttribut = 0; } else { if (strchr(pch + 1, '=') > strchr(pch + 1, '>')) { iNbrAttribut = 0; } else { iNbrAttribut = 1; char * secondpch = ((strchr(pch, '=')) + 1); for (;;) { if ((strchr(secondpch, '=') == nullptr)) { break; } else { if (strchr(secondpch, '=') < strchr(secondpch, '>')) { iNbrAttribut++; secondpch = ((strchr(secondpch, '=')) + 1); } else { break; } } } } } if (iNbrAttribut == 0) { int iCpt = ((strchr(pch, '>')) - (strchr(pch, '<'))); char * cTest = (strchr(pch, '<') + 1); for (int i = 0; i < iCpt - 2; i++) { GfxDbgPrintf("%c", cTest[i]); } GfxDbgPrintf(" : %i Attributes\n", iNbrAttribut); } else { int iCpt = ((strchr(pch, ' ')) - (strchr(pch, '<'))); char * cTest = (strchr(pch, '<') + 1); for (int i = 0; i < iCpt - 1; i++) { GfxDbgPrintf("%c", cTest[i]); } GfxDbgPrintf(" : %i Attributes : ", iNbrAttribut); char * secondpch = (strchr(pch, ' ') + 1); for (int i = 0; i < iNbrAttribut; i++) { iCpt = ((strchr(secondpch, '=')) - secondpch); GfxDbgPrintf("Att. %i = ", i + 1); for (int i = 0; i < iCpt; i++) { GfxDbgPrintf("%c", secondpch[i]); } secondpch += iCpt + 1; if (i == iNbrAttribut - 1) { iCpt = ((strchr(secondpch, '/')) - secondpch); } else { iCpt = ((strchr(secondpch, ' ')) - secondpch); } GfxDbgPrintf(" = "); for (int i = 0; i < iCpt; i++) { GfxDbgPrintf("%c", secondpch[i]); } GfxDbgPrintf(" | "); secondpch += ((strchr(secondpch, ' ') + 1) - secondpch); } GfxDbgPrintf("\n"); } if (strchr(pch+1, '<') == nullptr) { break; } pch = (strchr(pch + 1, '<')); } } else // Balise ouvrante ---------------------------------------------------- { for (int i = 0; i < iAlign; i++) { GfxDbgPrintf("\t"); } GfxDbgPrintf("Balise Ouvrante : "); if (strchr(pch + 1, '=') == nullptr) { iNbrAttribut = 0; } else { if (strchr(pch + 1, '=') > strchr(pch + 1, '>')) { iNbrAttribut = 0; } else { iNbrAttribut = 1; char * secondpch = ((strchr(pch, '=')) + 1); for (;;) { if ((strchr(secondpch, '=') == nullptr)) { break; } else { if (strchr(secondpch, '=') < strchr(secondpch, '>')) { iNbrAttribut++; secondpch = ((strchr(secondpch, '=')) + 1); } else { break; } } } } } if (iNbrAttribut == 0) { int iCpt = ((strchr(pch, '>')) - (strchr(pch, '<'))); char * cTest = (strchr(pch, '<') + 1); for (int i = 0; i < iCpt - 1; i++) { GfxDbgPrintf("%c", cTest[i]); } GfxDbgPrintf(" : %i Attributes\n", iNbrAttribut); } else { int iCpt = ((strchr(pch, ' ')) - (strchr(pch, '<'))); char * cTest = (strchr(pch, '<') + 1); for (int i = 0; i < iCpt - 1; i++) { GfxDbgPrintf("%c", cTest[i]); } GfxDbgPrintf(" : %i Attributes : ", iNbrAttribut); char * secondpch = (strchr(pch, ' ') + 1); for (int i = 0; i < iNbrAttribut; i++) { iCpt = ((strchr(secondpch, '=')) - secondpch); GfxDbgPrintf("Att. %i = ", i+1); for (int i = 0; i < iCpt; i++) { GfxDbgPrintf("%c", secondpch[i]); } secondpch += iCpt + 1; if (i == iNbrAttribut - 1) { iCpt = ((strchr(secondpch, '>')) - secondpch); } else { iCpt = ((strchr(secondpch, ' ')) - secondpch); } GfxDbgPrintf(" = "); for (int i = 0; i < iCpt; i++) { GfxDbgPrintf("%c", secondpch[i]); } GfxDbgPrintf(" | "); secondpch += ((strchr(secondpch, ' ') + 1) - secondpch); } GfxDbgPrintf("\n"); } if (strchr(pch+1, '<') == nullptr) { break; } pch = (strchr(pch+1, '<')); //pch = (strchr(pch, '>') + 1); iAlign++; // \t = tabulation } } } GfxDbgPrintf("\n\n"); //char * pch; // Création de pch //GfxDbgPrintf("Looking for the '<' character in \n\"---------------------\"\n%s\"---------------------\"\n", g_ToParse); // Printf d'explication //pch = strchr(g_ToParse, '<'); // //while (pch != NULL) //{ // GfxDbgPrintf("found at %d\n", pch - g_ToParse + 1); // pch = strchr(pch + 1, '<'); //} //while (g_ToParse[iPointeur] != 0) //{ // GfxDbgPrintf("%c", g_ToParse[iPointeur]); // iPointeur++; //} // //GfxDbgPrintf("\nNombres de caractères du fichier : %d", iPointeur); // //GfxMemFree(g_ToParse); // Recursive for (int i = 4; i < 60; i++) { unsigned int Recur = RecursiveInt(i); long long RecurLong = RecursiveLong(i); GfxDbgPrintf("%i -> Int : %i HEXA : %x Long Long : %lld \n", i, Recur, RecurLong, RecurLong); } int valeur = 1; for (int i = 1; i < 60; i++) { valeur *= i; GfxDbgPrintf("%i -> %i \n", i, valeur); } }
TDoor::TDoor() :TSpriteElement(), m_pOtherSide(0), m_pOwnRoom(0) { GfxDbgPrintf("TDoor constructor\n"); }
TDoor::~TDoor() { GfxDbgPrintf("TDoor destructor\n"); }
TDoor::TDoor(TGfxVec2 tPos, TGfxVec2 tSize, TGfxTexture *pTexture, TDoor *pDoor, TRoom *pRoom) : TSpriteElement(tPos, tSize, pTexture), m_pOtherSide(pDoor), m_pOwnRoom(pRoom) { GfxDbgPrintf("TDoor constructor\n"); }
TDoor::TDoor( TGfxVec2 tPos, TGfxVec2 tSize, char *pTextureLocation, TDoor *pDoor, TRoom *pRoom ) : TSpriteElement(tPos, tSize, GfxTextureLoad(pTextureLocation)), m_pOtherSide(pDoor), m_pOwnRoom(pRoom) { GfxDbgPrintf("TDoor constructor\n"); }
TDoor::TDoor(TDoor &tDoor) : TSpriteElement(tDoor.GetPos(), tDoor.GetSize(), tDoor.GetTexture()), m_pOtherSide(tDoor.GetOtherSideDoor()), m_pOwnRoom(tDoor.GetRoom()) { GfxDbgPrintf("TDoor constructor\n"); }