int PrinceEngine::checkMob(Graphics::Surface *screen, Common::Array<Mob> &mobList, bool usePriorityList) { if (_mouseFlag == 0 || _mouseFlag == 3) { return -1; } Common::Point mousePos = _system->getEventManager()->getMousePos(); int mobNumber = getMob(mobList, usePriorityList, mousePos.x + _picWindowX, mousePos.y); if (mobNumber != -1) { Common::String mobName = mobList[mobNumber]._name; if (getLanguage() == Common::DE_DEU) { for (uint i = 0; i < mobName.size(); i++) { switch (mobName[i]) { case '\xc4': mobName.setChar('\x83', i); break; case '\xd6': mobName.setChar('\x84', i); break; case '\xdc': mobName.setChar('\x85', i); break; case '\xdf': mobName.setChar('\x7f', i); break; case '\xe4': mobName.setChar('\x80', i); break; case '\xf6': mobName.setChar('\x81', i); break; case '\xfc': mobName.setChar('\x82', i); break; } } } uint16 textW = getTextWidth(mobName.c_str()); uint16 x = mousePos.x - textW / 2; if (x > screen->w) { x = 0; } if (x + textW > screen->w) { x = screen->w - textW; } uint16 y = mousePos.y - _font->getFontHeight(); if (y > screen->h) { y = _font->getFontHeight() - 2; } _font->drawString(screen, mobName, x, y, screen->w, 216); } return mobNumber; }
std::vector<t_stage *> Stage::getWaves() { std::vector<t_stage *> tmp; int val = 0; for (int i = 0; i < 4; i++) // 4 ennemis par vagues { srand(time(NULL)); val = rand() % 4 + 1 + MONSTER1; tmp.push_back(getMob(1, val)); } return (tmp); }
void Game::Start() { if(_gameState != Uninitialized) { return; } /* Initialize all prototype arrays and game objects */ /* Load resources and xml files */ ConstructResources(); // load all files into memory ConstructPrototypes(); // construct entity prototypes (from xml raw files) _gameState = Playing; _inventoryConsole = NULL; _inventoryInfo = NULL; Turns = 0; // Initialize player: player.cam_follow = true; player.speed = 100.0f; player.viewinginventory = false; player.Message("Have a secure day!", TCODColor::green, TCODColor::black); GameMap.Initialize(100, 100, getTurf("t_wall"), this); RandomGen = new TCODRandom(); const char* smap[] = { "##############################################", "####################### #################", "##################### # ###############", "###################### ### ###########", "################## ##### ####", "################ ######## ###### ####", "############### #################### ####", "################ ###### ##", "######## ####### ###### # # # ##", "######## ###### ### ##", "######## ##", "#### ###### ### # # # ##", "#### ### ########## #### ##", "#### ### ########## ########### ##########", "#### ################## ##### #####", "#### ### #### ##### #####", "#### # #### #####", "######## # #### ##### #####", "######## ##### ####### #######", "#########++ ++####################++++########", "## ##", "# #", "# g #", "# g g #", "# M #", "# @ #", "# g #", "# #", "# #", "# #", "# #", "# #", "# #", "# S #", "# S S S #", "# #", "# #", "# #", "# #", "# #", "# #", "# #", "# //////////////////// / //////////////// #", "# / / [ #", "# / ? #", "# #", "# #", "# #", "# #", "# #", "# #", "#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#", "##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~##", "##############################################", }; for (int y=0; y < 54; y++ ) { for (int x=0; x < 46; x++ ) { if ( smap[y][x] == '#' ) { GameMap.SpawnTurf(x, y, getTurf("t_wall")); } else if ( smap[y][x] == '~' ) { GameMap.SpawnTurf(x, y, getTurf("t_water")); } else if ( smap[y][x] == 'g' ) { GameMap.SpawnTurf(x, y, getTurf("t_grass")); GameMap.SpawnMob(x, y, getMob("m_goat")); } else if ( smap[y][x] == 'M' ) { GameMap.SpawnTurf(x, y, getTurf("t_grass")); GameMap.SpawnMob(x, y, getMob("m_kelrah")); } else if ( smap[y][x] == 'S' ) { GameMap.SpawnTurf(x, y, getTurf("t_grass")); GameMap.SpawnMob(x, y, getMob("m_skeleton")); } else if ( smap[y][x] == '+' ) { GameMap.SpawnTurf(x, y, getTurf("t_window")); } else if ( smap[y][x] == '@' ) { GameMap.SpawnTurf(x, y, getTurf("t_grass")); GameMap.InsertMob(x, y, &player); player.x = x; player.y = y; player.cam_x = player.x; player.cam_y = player.y; } else if ( smap[y][x] == '/' ) { GameMap.SpawnTurf(x, y, getTurf("t_grass")); GameMap.SpawnItem(x, y, getItem("i_shortsword")); } else if ( smap[y][x] == '[' ) { GameMap.SpawnTurf(x, y, getTurf("t_grass")); GameMap.SpawnItem(x, y, getItem("i_backpack")); } else if ( smap[y][x] == '?' ) { GameMap.SpawnTurf(x, y, getTurf("t_grass")); GameMap.SpawnItem(x, y, getItem("i_flail")); } else { GameMap.SpawnTurf(x, y, getTurf("t_grass")); } } } Test = "Lol!"; // Initialize TCOD //TCODConsole::setCustomFont("terminal12x12.png", TCOD_FONT_LAYOUT_ASCII_INROW); TCODConsole::initRoot(VIEW_WIDTH, VIEW_HEIGHT, "Origin: Tales of Anarchy", false); TCODSystem::setFps(15); TCODConsole::setKeyboardRepeat(30, 5); DrawHud(true); std::cout << "Game Started" << std::endl << std::endl; LoadGame(); while(!IsExiting()) { GameLoop(); } SaveGame(); }