World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Файл MapBook.h

См. исходные тексты.

Классы

struct  GUIWindow_MapBook
 

Функции

const char * GetMapBookHintText (int mouse_x, int mouse_y)
 

Функции

◆ GetMapBookHintText()

const char* GetMapBookHintText ( int  mouse_x,
int  mouse_y 
)

См. определение в файле MapBook.cpp строка 337

337  {
338  int v20 = viewparams->sViewCenterX;
339  int v21 = viewparams->sViewCenterY;
340  if (viewparams->uMapBookMapZoom == 384) {
343  }
344 
345  unsigned int pX = mouse_x;
346  unsigned int pY = mouse_y;
347 
348  double v0 = 1.0 / (float)((signed int)viewparams->uMapBookMapZoom * 0.000015258789);
349 
350  int global_coord_X = (__int64)((double)(pX - 229.) * v0 + (double)v20);
351  int global_coord_Y = (__int64)((double)v21 - (double)(pY - 181.) * v0);
352 
353  const char *result = "";
354 
355  // In the mapbook only lady Margaret dispays for defoult zoom(В
356  // книге карты только Леди Маргарита всплывает при дефолтном зуме)
357  int map_tile_X = abs(global_coord_X + 22528) / 512;
358  int map_tile_Y = abs(global_coord_Y - 22528) / 512;
359  if (pOutdoor->IsMapCellFullyRevealed(map_tile_X, map_tile_Y) &&
361  !pOutdoor->pBModels.empty()) {
362  for (BSPModel &model : pOutdoor->pBModels) {
364  abs((int)model.vBoundingCenter.x - global_coord_X),
365  abs((int)model.vBoundingCenter.y - global_coord_Y),
366  0) < model.sBoundingRadius) {
367  for (ODMFace &face : model.pFaces) {
368  if (face.sCogTriggeredID) {
369  if (!(face.uAttributes & FACE_HAS_EVENT)) {
370  if (GetEventHintString(face.sCogTriggeredID)) {
371  if (_stricmp(GetEventHintString(face.sCogTriggeredID), "")) {
372  result = GetEventHintString(face.sCogTriggeredID);
373  }
374  }
375  }
376  }
377  }
378  }
379  }
380  }
381 
382  return result;
383 }

Перекрестные ссылки GetEventHintString(), ViewingParams::indoor_center_x, ViewingParams::indoor_center_y, int_get_vector_length(), OutdoorLocation::IsMapCellFullyRevealed(), LEVEL_Outdoor, OutdoorLocation::pBModels, BSPModel::pFaces, pOutdoor, BSPModel::sBoundingRadius, ViewingParams::sViewCenterX, ViewingParams::sViewCenterY, uCurrentlyLoadedLevelType, ViewingParams::uMapBookMapZoom, BSPModel::vBoundingCenter и viewparams.

Используется в UI_OnMouseRightClick().

+ Граф вызовов:
+ Граф вызова функции:
face
GLenum GLuint GLint GLenum face
Definition: SDL_opengl_glext.h:3022
int_get_vector_length
uint32_t int_get_vector_length(int32_t x, int32_t y, int32_t z)
Definition: VectorTypes.cpp:8
OutdoorLocation::pBModels
BSPModelList pBModels
Definition: Outdoor.h:119
ViewingParams::indoor_center_x
int16_t indoor_center_x
Definition: Viewport.h:70
BSPModel::sBoundingRadius
int32_t sBoundingRadius
Definition: BSPModel.h:187
OutdoorLocation::IsMapCellFullyRevealed
bool IsMapCellFullyRevealed(signed int a2, signed int a3)
Definition: Outdoor.cpp:1549
result
GLuint64EXT * result
Definition: SDL_opengl_glext.h:9435
ViewingParams::indoor_center_y
int16_t indoor_center_y
Definition: Viewport.h:71
viewparams
struct ViewingParams * viewparams
Definition: mm7_data.cpp:22
GetEventHintString
char * GetEventHintString(unsigned int uEventID)
Definition: Events.cpp:1159
LEVEL_Outdoor
@ LEVEL_Outdoor
Definition: Indoor.h:287
BSPModel::pFaces
std::vector< ODMFace > pFaces
Definition: BSPModel.h:190
ODMFace
Definition: BSPModel.h:93
BSPModel::vBoundingCenter
Vec3_int_ vBoundingCenter
Definition: BSPModel.h:186
ViewingParams::sViewCenterY
int sViewCenterY
Definition: Viewport.h:69
uCurrentlyLoadedLevelType
LEVEL_TYPE uCurrentlyLoadedLevelType
Definition: Indoor.cpp:52
ViewingParams::sViewCenterX
int sViewCenterX
Definition: Viewport.h:68
v0
GLfloat v0
Definition: SDL_opengl_glext.h:693
BSPModel
Definition: BSPModel.h:163
pOutdoor
OutdoorLocation * pOutdoor
Definition: Outdoor.cpp:48
ViewingParams::uMapBookMapZoom
unsigned int uMapBookMapZoom
Definition: Viewport.h:67