World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Указатель Классы Пространства имен Файлы Функции Переменные Определения типов Перечисления Элементы перечислений Друзья Группы Страницы
Файл Spellbook.cpp

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

Функции

void InitializeSpellBookTextures ()
 
void OnCloseSpellBookPage ()
 
void OnCloseSpellBook ()
 
void LoadSpellbook (unsigned int spell_school)
 
static void BookUI_Spellbook_DrawCurrentSchoolBackground ()
 

Переменные

std::array< char *, 9 > spellbook_texture_filename_suffices
 
std::array< std::array< unsigned char, 12 >, 9 > pSpellbookSpellIndices
 
Imageui_spellbook_btn_quckspell = nullptr
 
Imageui_spellbook_btn_quckspell_click = nullptr
 
Imageui_spellbook_btn_close = nullptr
 
Imageui_spellbook_btn_close_click = nullptr
 
std::array< Image *, 12 > SBPageCSpellsTextureList
 
std::array< Image *, 12 > SBPageSSpellsTextureList
 
std::array< Image *, 9 > ui_spellbook_school_backgrounds
 
std::array< std::array< Image *, 2 >, 9 > ui_spellbook_school_tabs
 

Функции

◆ InitializeSpellBookTextures()

void InitializeSpellBookTextures ( )

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

321  {
322  pAudioPlayer->StopChannels(-1, -1);
323  pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0);
324 
329 
330  static const char *texNames[9] = {"SBFB00", "SBAB00", "SBWB00",
331  "SBEB00", "SBSB00", "SBMB00",
332  "SBBB00", "SBLB00", "SBDB00"};
333 
334  for (unsigned int i = 0; i < 9; ++i) {
336  assets->GetImage_ColorKey(texNames[i], 0x7FF);
338  assets->GetImage_Alpha(StringPrintf("tab%da", i + 1));
340  assets->GetImage_Alpha(StringPrintf("tab%db", i + 1));
341  }
342 }

Перекрестные ссылки assets, AssetsManager::GetImage_Alpha(), AssetsManager::GetImage_ColorKey(), AssetsManager::GetImage_Solid(), pAudioPlayer, AudioPlayer::PlaySound(), SOUND_openbook, AudioPlayer::StopChannels(), StringPrintf(), ui_spellbook_btn_close, ui_spellbook_btn_close_click, ui_spellbook_btn_quckspell, ui_spellbook_btn_quckspell_click, ui_spellbook_school_backgrounds и ui_spellbook_school_tabs.

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

+ Граф вызовов:
+ Граф вызова функции:

◆ OnCloseSpellBookPage()

void OnCloseSpellBookPage ( )

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

382  {
383  for (unsigned int i = 1; i <= 11; i++) {
384  if (SBPageCSpellsTextureList[i]) {
385  SBPageCSpellsTextureList[i]->Release();
386  SBPageCSpellsTextureList[i] = nullptr;
387  }
388  if (SBPageSSpellsTextureList[i]) {
389  SBPageSSpellsTextureList[i]->Release();
390  SBPageSSpellsTextureList[i] = nullptr;
391  }
392  }
394 }

Перекрестные ссылки GUIWindow::DeleteButtons(), pGUIWindow_CurrentMenu, SBPageCSpellsTextureList и SBPageSSpellsTextureList.

Используется в GUIWindow_Spellbook::OpenSpellbookPage() и GUIWindow_Spellbook::Release().

+ Граф вызовов:
+ Граф вызова функции:

◆ OnCloseSpellBook()

void OnCloseSpellBook ( )

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

344  {
347  ui_spellbook_btn_close = nullptr;
348  }
352  }
353 
356  ui_spellbook_btn_quckspell = nullptr;
357  }
361  }
362 
363  for (uint i = 0; i < 9; ++i) {
365  ui_spellbook_school_backgrounds[i]->Release();
366  ui_spellbook_school_backgrounds[i] = nullptr;
367  }
368 
369  if (ui_spellbook_school_tabs[i][0]) {
370  ui_spellbook_school_tabs[i][0]->Release();
371  ui_spellbook_school_tabs[i][0] = nullptr;
372  }
373  if (ui_spellbook_school_tabs[i][1]) {
374  ui_spellbook_school_tabs[i][1]->Release();
375  ui_spellbook_school_tabs[i][1] = nullptr;
376  }
377  }
378 
379  pAudioPlayer->PlaySound(SOUND_openbook, 0, 0, -1, 0, 0);
380 }

Перекрестные ссылки pAudioPlayer, AudioPlayer::PlaySound(), Image::Release(), SOUND_openbook, ui_spellbook_btn_close, ui_spellbook_btn_close_click, ui_spellbook_btn_quckspell, ui_spellbook_btn_quckspell_click, ui_spellbook_school_backgrounds и ui_spellbook_school_tabs.

Используется в GUIWindow_Spellbook::Release().

+ Граф вызовов:
+ Граф вызова функции:

◆ LoadSpellbook()

void LoadSpellbook ( unsigned int  spell_school)

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

279  {
280  byte_506550 = 0;
281  if (pPlayers[uActiveCharacter]->uQuickSpell &&
282  (unsigned __int8)pPlayers[uActiveCharacter]->uQuickSpell / 11 ==
283  spell_school)
285  (unsigned __int8)pPlayers[uActiveCharacter]->uQuickSpell -
286  11 * spell_school;
287  else
289 
290  for (unsigned int i = 1; i <= 11; ++i) {
291  if (pPlayers[uActiveCharacter]->spellbook.pChapters[spell_school].bIsSpellAvailable[i - 1] ||
292  engine->config->debug_all_magic) {
293  char pContainer[20];
294  sprintf(pContainer, "SB%sS%02d",
296  pSpellbookSpellIndices[spell_school][i]);
298 
299  sprintf(pContainer, "SB%sC%02d",
301  pSpellbookSpellIndices[spell_school][i]);
303  }
304  }
305 }

Перекрестные ссылки assets, byte_506550, engine, AssetsManager::GetImage_Solid(), pPlayers, pSpellbookSpellIndices, quick_spell_at_page, SBPageCSpellsTextureList, SBPageSSpellsTextureList, spellbook_texture_filename_suffices и uActiveCharacter.

Используется в GUIWindow_Spellbook::OpenSpellbook().

+ Граф вызовов:
+ Граф вызова функции:

◆ BookUI_Spellbook_DrawCurrentSchoolBackground()

static void BookUI_Spellbook_DrawCurrentSchoolBackground ( )
static

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

307  {
308  int pTexID = 0;
309  if (uActiveCharacter) {
310  pTexID = pParty->pPlayers[uActiveCharacter - 1].lastOpenedSpellbookPage;
311  }
312  render->DrawTextureAlphaNew(8 / 640.0f, 8 / 480.0f,
314 
315  render->DrawTextureAlphaNew(476 / 640.0f, 450 / 480.0f,
317  render->DrawTextureAlphaNew(561 / 640.0f, 450 / 480.0f,
319 }

Перекрестные ссылки pParty, Party::pPlayers, render, uActiveCharacter, ui_spellbook_btn_close, ui_spellbook_btn_quckspell и ui_spellbook_school_backgrounds.

Используется в GUIWindow_Spellbook::Update().

+ Граф вызова функции:

Переменные

◆ spellbook_texture_filename_suffices

std::array<char *, 9> spellbook_texture_filename_suffices
Инициализатор
= {
{"f", "a", "w", "e", "s", "m", "b", "l", "d"}}

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

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

◆ pSpellbookSpellIndices

std::array<std::array<unsigned char, 12>, 9> pSpellbookSpellIndices
Инициализатор
=
{{
{0, 3, 1, 8, 11, 7, 4, 10, 6, 2, 5, 9},
{0, 11, 2, 9, 6, 8, 5, 10, 3, 7, 1, 4},
{0, 4, 8, 9, 1, 10, 3, 11, 7, 6, 2, 5},
{0, 7, 10, 8, 2, 11, 1, 5, 3, 6, 4, 9},
{0, 5, 10, 11, 7, 2, 8, 1, 4, 9, 3, 6},
{0, 5, 9, 8, 3, 7, 6, 4, 1, 11, 2, 10},
{0, 1, 6, 9, 3, 5, 8, 11, 7, 10, 4, 2},
{0, 1, 10, 11, 9, 4, 3, 6, 5, 7, 8, 2},
{0, 9, 3, 7, 1, 5, 2, 10, 11, 8, 6, 4}}}

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

Используется в LoadSpellbook(), GUIWindow_Spellbook::OpenSpellbook() и GUIWindow_Spellbook::Update().

◆ ui_spellbook_btn_quckspell

Image* ui_spellbook_btn_quckspell = nullptr

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

Используется в BookUI_Spellbook_DrawCurrentSchoolBackground(), InitializeSpellBookTextures(), OnCloseSpellBook() и GUIWindow_Spellbook::OpenSpellbook().

◆ ui_spellbook_btn_quckspell_click

Image* ui_spellbook_btn_quckspell_click = nullptr

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

Используется в InitializeSpellBookTextures(), OnCloseSpellBook() и GUIWindow_Spellbook::OpenSpellbook().

◆ ui_spellbook_btn_close

Image* ui_spellbook_btn_close = nullptr

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

Используется в BookUI_Spellbook_DrawCurrentSchoolBackground(), InitializeSpellBookTextures(), OnCloseSpellBook() и GUIWindow_Spellbook::OpenSpellbook().

◆ ui_spellbook_btn_close_click

Image* ui_spellbook_btn_close_click = nullptr

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

Используется в InitializeSpellBookTextures() и OnCloseSpellBook().

◆ SBPageCSpellsTextureList

std::array<Image *, 12> SBPageCSpellsTextureList

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

Используется в LoadSpellbook(), OnCloseSpellBookPage() и GUIWindow_Spellbook::Update().

◆ SBPageSSpellsTextureList

std::array<Image *, 12> SBPageSSpellsTextureList

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

Используется в LoadSpellbook(), OnCloseSpellBookPage(), GUIWindow_Spellbook::OpenSpellbook() и GUIWindow_Spellbook::Update().

◆ ui_spellbook_school_backgrounds

std::array<Image *, 9> ui_spellbook_school_backgrounds

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

Используется в BookUI_Spellbook_DrawCurrentSchoolBackground(), InitializeSpellBookTextures() и OnCloseSpellBook().

◆ ui_spellbook_school_tabs

std::array<std::array<Image *, 2>, 9> ui_spellbook_school_tabs

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

Используется в InitializeSpellBookTextures(), OnCloseSpellBook() и GUIWindow_Spellbook::Update().

AssetsManager::GetImage_Solid
Texture * GetImage_Solid(const String &name)
Definition: AssetsManager.cpp:51
pGUIWindow_CurrentMenu
GUIWindow * pGUIWindow_CurrentMenu
Definition: GUIWindow.cpp:54
ui_spellbook_btn_quckspell
Image * ui_spellbook_btn_quckspell
Definition: Spellbook.cpp:42
AudioPlayer::PlaySound
void PlaySound(SoundID eSoundID, int pid, unsigned int uNumRepeats, int x, int y, int a7)
Definition: AudioPlayer.cpp:195
engine
std::shared_ptr< Engine > engine
Definition: Engine.cpp:130
Party::pPlayers
std::array< Player, 4 > pPlayers
Definition: Party.h:310
SBPageSSpellsTextureList
std::array< Image *, 12 > SBPageSSpellsTextureList
Definition: Spellbook.cpp:48
spellbook_texture_filename_suffices
std::array< char *, 9 > spellbook_texture_filename_suffices
Definition: Spellbook.cpp:26
pPlayers
NZIArray< struct Player *, 5 > pPlayers
Definition: Player.cpp:46
ui_spellbook_school_backgrounds
std::array< Image *, 9 > ui_spellbook_school_backgrounds
Definition: Spellbook.cpp:50
pParty
Party * pParty
Definition: Party.cpp:30
GUIWindow::DeleteButtons
void DeleteButtons()
Definition: GUIWindow.cpp:305
byte_506550
char byte_506550
Definition: mm7_data.cpp:531
quick_spell_at_page
int quick_spell_at_page
Definition: mm7_data.cpp:530
ui_spellbook_school_tabs
std::array< std::array< Image *, 2 >, 9 > ui_spellbook_school_tabs
Definition: Spellbook.cpp:51
AssetsManager::GetImage_ColorKey
Texture * GetImage_ColorKey(const String &name, uint16_t colorkey)
Definition: AssetsManager.cpp:34
AudioPlayer::StopChannels
void StopChannels(int uStartChannel, int uEndChannel)
Definition: AudioPlayer.cpp:331
f
GLfloat f
Definition: SDL_opengl_glext.h:1873
pSpellbookSpellIndices
std::array< std::array< unsigned char, 12 >, 9 > pSpellbookSpellIndices
Definition: Spellbook.cpp:30
SBPageCSpellsTextureList
std::array< Image *, 12 > SBPageCSpellsTextureList
Definition: Spellbook.cpp:47
assets
AssetsManager * assets
Definition: AssetsManager.cpp:12
uint
unsigned int uint
Definition: MM7.h:4
uActiveCharacter
unsigned int uActiveCharacter
Definition: mm7_data.cpp:555
ui_spellbook_btn_close
Image * ui_spellbook_btn_close
Definition: Spellbook.cpp:44
AssetsManager::GetImage_Alpha
Texture * GetImage_Alpha(const String &name)
Definition: AssetsManager.cpp:66
SOUND_openbook
@ SOUND_openbook
Definition: AudioPlayer.h:93
pAudioPlayer
AudioPlayer * pAudioPlayer
Definition: AudioPlayer.cpp:20
ui_spellbook_btn_close_click
Image * ui_spellbook_btn_close_click
Definition: Spellbook.cpp:45
ui_spellbook_btn_quckspell_click
Image * ui_spellbook_btn_quckspell_click
Definition: Spellbook.cpp:43
StringPrintf
String StringPrintf(const char *fmt,...)
Definition: Strings.cpp:9
Image::Release
bool Release()
Definition: Image.cpp:335
render
std::shared_ptr< IRender > render
Definition: RenderOpenGL.cpp:52