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

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

Классы

class  Sprite
 
class  SpriteFrame
 
struct  SpriteFrameTable
 

Функции

void _46E26D_collide_against_sprites (int a1, int a2)
 
SpriteFrameLevelDecorationChangeSeason (DecorationDesc *desc, int t, int month)
 

Переменные

struct SpriteFrameTablepSpriteFrameTable
 

Функции

◆ _46E26D_collide_against_sprites()

void _46E26D_collide_against_sprites ( int  a1,
int  a2 
)

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

447  {
448  int v2; // edx@5
449  unsigned __int16 *v3; // eax@5
450  unsigned __int16 v4; // ax@6
451  LevelDecoration *v5; // edi@7
452  DecorationDesc *v6; // esi@8
453  int v7; // edx@9
454  int v8; // eax@9
455  int v9; // ecx@11
456  int v10; // ebx@13
457  int v11; // esi@13
458  int v12; // ebp@15
459  int v13; // ebx@15
460  int v14; // esi@16
461  int v15; // edi@17
462  int v16; // eax@17
463  int v17; // esi@19
464  char v18; // zf@23
465  int v19; // [sp+0h] [bp-10h]@15
466  unsigned __int16 *v20; // [sp+4h] [bp-Ch]@5
467  int v21; // [sp+8h] [bp-8h]@15
468  int v22; // [sp+Ch] [bp-4h]@13
469 
470  if (a1 >= 0) {
471  if (a1 <= 127) {
472  if (a2 >= 0) {
473  if (a2 <= 127) {
474  v2 = a1 + (a2 << 7);
476  v20 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]];
477  if (v3) {
478  do {
479  v4 = *v3;
480  if (PID_TYPE(v4) == OBJECT_Decoration) {
481  v5 =
482  &pLevelDecorations[(signed __int16)v4 >> 3];
483  if (!(v5->uFlags &
486  if (!v6->CanMoveThrough()) {
487  v7 = v6->uRadius;
488  v8 = v5->vPosition.x;
489  if (stru_721530.sMaxX <= v8 + v7) {
490  if (stru_721530.sMinX >= v8 - v7) {
491  v9 = v5->vPosition.y;
492  if (stru_721530.sMaxY <=
493  v9 + v7) {
494  if (stru_721530.sMinY >=
495  v9 - v7) {
496  v10 =
497  v6->uDecorationHeight;
498  v11 = v5->vPosition.z;
499  v22 = v10;
500  if (stru_721530.sMaxZ <=
501  v11 + v10) {
502  if (stru_721530
503  .sMinZ >=
504  v11) {
505  v12 =
506  v8 -
508  .normal
509  .x;
510  v19 =
511  v9 -
513  .normal
514  .y;
515  v13 =
517  .prolly_normal_d +
518  v7;
519  v21 =
520  ((v8 -
522  .normal
523  .x) *
525  .direction
526  .y -
527  (v9 -
529  .normal
530  .y) *
532  .direction
533  .x) >>
534  16;
535  if (abs(v21) <=
537  .prolly_normal_d +
538  v7) {
539  v14 =
540  (v12 *
542  .direction
543  .x +
544  v19 *
546  .direction
547  .y) >>
548  16;
549  if (v14 >
550  0) {
551  v15 =
552  v5->vPosition
553  .z;
554  v16 =
556  .normal
557  .z +
558  fixpoint_mul(
560  .direction
561  .z,
562  v14);
563  if (v16 >=
564  v15) {
565  if (v16 <=
566  v22 +
567  v15) {
568  v17 =
569  v14 -
570  integer_sqrt(
571  v13 *
572  v13 -
573  v21 *
574  v21);
575  if (v17 <
576  0)
577  v17 =
578  0;
579  if (v17 <
581  .field_7C) {
583  .field_7C =
584  v17;
586  .pid =
587  (signed __int16)*v20;
588  }
589  }
590  }
591  }
592  }
593  }
594  }
595  }
596  }
597  }
598  }
599  }
600  }
601  }
602  v3 = v20 + 1;
603  v18 = *v20 == 0;
604  ++v20;
605  } while (!v18);
606  }
607  }
608  }
609  }
610  }
611 }

Перекрестные ссылки DecorationDesc_mm6::CanMoveThrough(), stru141_actor_collision_object::direction, stru141_actor_collision_object::field_7C, fixpoint_mul(), DecorationList::GetDecoration(), integer_sqrt(), LEVEL_DECORATION_INVISIBLE, stru141_actor_collision_object::normal, OBJECT_Decoration, pDecorationList, OutdoorLocation::pFaceIDLIST, stru141_actor_collision_object::pid, pLevelDecorations, OutdoorLocation::pOMAP, pOutdoor, stru141_actor_collision_object::prolly_normal_d, stru141_actor_collision_object::sMaxX, stru141_actor_collision_object::sMaxY, stru141_actor_collision_object::sMaxZ, stru141_actor_collision_object::sMinX, stru141_actor_collision_object::sMinY, stru_721530, LevelDecoration::uDecorationDescID, DecorationDesc_mm6::uDecorationHeight, LevelDecoration::uFlags, DecorationDesc_mm6::uRadius и LevelDecoration::vPosition.

Используется в ODM_ProcessPartyActions(), UpdateActors_ODM() и SpriteObject::UpdateObject_fn0_ODM().

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

◆ LevelDecorationChangeSeason()

SpriteFrame* LevelDecorationChangeSeason ( DecorationDesc desc,
int  t,
int  month 
)

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

614  {
615  switch (month/*pParty->uCurrentMonth*/) {
616  // case 531 (tree60), 536 (tree65), 537 (tree66) have no autumn/winter
617  // sprites
618  case 11:
619  case 0:
620  case 1: // winter
621  {
622  switch (desc->uSpriteID) {
623  // case 468: //bush02 grows on swamps, which are
624  // evergreeen actually
625  case 548: // flower10
626  case 547: // flower09
627  case 541: // flower03
628  case 539: // flower01
629  return nullptr;
630 
631  case 483: // tree01
632  case 486: // tree04
633  case 492: // tree10
634  {
636  return pSpriteFrameTable->GetFrame(desc->uSpriteID + 2, t);
637  }
638 
639  default:
640  return pSpriteFrameTable->GetFrame(desc->uSpriteID, t);
641  }
642  }
643 
644  case 2:
645  case 3:
646  case 4: // spring
647  {
648  // switch (desc->uSpriteID) {}
649  return pSpriteFrameTable->GetFrame(desc->uSpriteID, t);
650  }
651 
652  case 8:
653  case 9:
654  case 10: // autumn
655  {
656  switch (desc->uSpriteID) {
657  // case 468: //bush02 grows on swamps, which are evergreeen
658  // actually
659  case 548: // flower10
660  case 547: // flower09
661  case 541: // flower03
662  case 539: // flower01
663  return nullptr;
664 
665  case 483: // tree01
666  case 486: // tree04
667  case 492: // tree10
668  {
670  return pSpriteFrameTable->GetFrame(desc->uSpriteID + 1, t);
671  }
672 
673  default:
674  return pSpriteFrameTable->GetFrame(desc->uSpriteID, t);
675  }
676  } break;
677 
678  case 5:
679  case 6:
680  case 7: // summer
681  // all green by default
682  {
683  return pSpriteFrameTable->GetFrame(desc->uSpriteID, t);
684  }
685 
686  default:
687  assert(/*pParty->uCurrentMonth*/month >= 0 && /*pParty->uCurrentMonth*/month < 12);
688  }
689 }

Перекрестные ссылки SpriteFrameTable::GetFrame(), SpriteFrameTable::InitializeSprite(), pSpriteFrameTable и DecorationDesc_mm6::uSpriteID.

Используется в RenderOpenGL::PrepareDecorationsRenderList_ODM() и Render::PrepareDecorationsRenderList_ODM().

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

Переменные

◆ pSpriteFrameTable

pLevelDecorations
std::array< LevelDecoration, 3000 > pLevelDecorations
Definition: Decoration.cpp:8
OutdoorLocation::pOMAP
unsigned int * pOMAP
Definition: Outdoor.h:122
DecorationList::GetDecoration
DecorationDesc * GetDecoration(unsigned int index)
Definition: DecorationList.h:65
pSpriteFrameTable
struct SpriteFrameTable * pSpriteFrameTable
Definition: Sprites.cpp:22
stru141_actor_collision_object::sMaxZ
int sMaxZ
Definition: Indoor.h:180
z
GLdouble GLdouble z
Definition: SDL_opengl_glext.h:407
stru141_actor_collision_object::normal
Vec3_int_ normal
Definition: Indoor.h:159
OBJECT_Decoration
@ OBJECT_Decoration
Definition: Actor.h:69
DecorationDesc_mm6::uRadius
int16_t uRadius
Definition: DecorationList.h:41
y
EGLSurface EGLint EGLint y
Definition: SDL_egl.h:1596
LevelDecoration::vPosition
Vec3_int_ vPosition
Definition: Decoration.h:28
OutdoorLocation::pFaceIDLIST
uint16_t * pFaceIDLIST
Definition: Outdoor.h:121
stru141_actor_collision_object::sMinY
int sMinY
Definition: Indoor.h:179
LEVEL_DECORATION_INVISIBLE
@ LEVEL_DECORATION_INVISIBLE
Definition: Decoration.h:14
stru141_actor_collision_object::field_7C
int field_7C
Definition: Indoor.h:172
SpriteFrameTable::GetFrame
SpriteFrame * GetFrame(unsigned int uSpriteID, unsigned int uTime)
Definition: Sprites.cpp:277
DecorationDesc_mm6::CanMoveThrough
bool CanMoveThrough()
Definition: DecorationList.h:26
LevelDecoration::uFlags
uint16_t uFlags
Definition: Decoration.h:27
fixpoint_mul
__int64 fixpoint_mul(int a1, int a2)
Definition: OurMath.cpp:138
LevelDecoration
Definition: Decoration.h:20
stru141_actor_collision_object::sMaxX
int sMaxX
Definition: Indoor.h:176
stru141_actor_collision_object::sMinX
int sMinX
Definition: Indoor.h:177
SpriteFrameTable::InitializeSprite
void InitializeSprite(signed int uSpriteID)
Definition: Sprites.cpp:46
stru141_actor_collision_object::sMaxY
int sMaxY
Definition: Indoor.h:178
t
GLdouble GLdouble t
Definition: SDL_opengl.h:2071
LevelDecoration::uDecorationDescID
uint16_t uDecorationDescID
Definition: Decoration.h:26
stru141_actor_collision_object::prolly_normal_d
int prolly_normal_d
Definition: Indoor.h:152
DecorationDesc_mm6::uSpriteID
uint16_t uSpriteID
Definition: DecorationList.h:43
v2
GLfloat GLfloat GLfloat v2
Definition: SDL_opengl_glext.h:695
integer_sqrt
int integer_sqrt(int val)
Definition: OurMath.cpp:164
v3
GLfloat GLfloat GLfloat GLfloat v3
Definition: SDL_opengl_glext.h:696
DecorationDesc_mm6::uDecorationHeight
uint16_t uDecorationHeight
Definition: DecorationList.h:40
stru141_actor_collision_object::direction
Vec3_int_ direction
Definition: Indoor.h:165
DecorationDesc
Definition: DecorationList.h:49
stru_721530
stru141_actor_collision_object stru_721530
Definition: Indoor.cpp:58
pOutdoor
OutdoorLocation * pOutdoor
Definition: Outdoor.cpp:48
pDecorationList
struct DecorationList * pDecorationList
Definition: DecorationList.cpp:11
stru141_actor_collision_object::pid
unsigned int pid
Definition: Indoor.h:171