Advertisement
Nihthelm

Untitled

Jul 24th, 2021
1,291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.17 KB | None | 0 0
  1.  
  2. NOALIGN struct _BinTree_
  3. {
  4.  _BinTree_* left;
  5.  _BinTree_* parent;
  6.  _BinTree_* right;
  7.  _char_ name[12];
  8.  _dword_ name_end;
  9.  _BinTreeItem_* item;
  10.  _dword_ field_20;
  11.  
  12.  // my
  13.  inline _BinTreeItem_* FindItem(char* name)
  14.  {
  15.   if (name)
  16.   {
  17.    _BinTree_* search_result = CALL_2(_BinTree_*, __thiscall, 0x55EE00, this, name);
  18.    if ((search_result == this->parent) || (_strcmpi(name, search_result->name) < 0))
  19.     return NULL;
  20.    return search_result->item;
  21.   }
  22.   else
  23.    return NULL;
  24.  }
  25.  
  26.  inline void AddItem(_BinTreeItem_* item, char* name)
  27.  {
  28.   _ptr_ buf[2];
  29.   char named_item_block[20];
  30.   MemCopy(named_item_block, name, 12);
  31.   *(_dword_*)(named_item_block + 12) = 0;
  32.   *(_BinTreeItem_**)(named_item_block + 16) = item;
  33.   CALL_3(void, __thiscall, 0x55DDF0, this, buf, named_item_block);
  34.  }
  35. };
  36.  
  37. ...
  38. NOALIGN struct _TxtLine_
  39. {
  40.     //int    Exist;        // 1=выделена память, 0=нет
  41.     //char **Start;
  42.     //char **Stop;
  43.     //char **End;
  44.     _List_<_cstr_> items;
  45. };
  46. #define o_LoadTxt(name) CALL_1(_Txt_*, __fastcall, 0x55C2B0, name)
  47. NOALIGN struct _Txt_ : public _BinTreeItem_
  48. {
  49.     _List_<_TxtLine_*> Lines;
  50.     //_TxtLine_** StartLine;  // +20 ук на первую строку
  51.     //_TxtLine_** StopLine;   // +24 ук на строку за последней
  52.  
  53.  
  54.      inline static _Txt_* Load(char* filename) {return o_LoadTxt(filename);}
  55.      inline char* GetString(int index) { return *(char **)(*(_ptr_*)((_ptr_)(this) + 32) + (_dword_)(index)*4);}
  56. };
  57.  
  58.  
  59.  
  60. ...
  61.  
  62.  
  63. int __stdcall ReadSptraitsLineHook(HiHook* h, _Txt_** file_ptr, int spell, int line_num)
  64. {  
  65.     _Txt_* file = *file_ptr;
  66.     char* anim_ix = file->Lines[line_num]->items[33];
  67. /*
  68. char mess[255];
  69.     sprintf(mess,"%s %i", anim_ix,  atoi(anim_ix) );
  70.     MessageBoxA(0,(LPCSTR)mess,"",0);*/
  71.  
  72.     if(*anim_ix)
  73.         o_Spell[spell].animation_ix = atoi(anim_ix);
  74.    
  75.     o_Spell[spell].flags = 0;
  76.     for(int i = 0; i!=32; i++)
  77.     {
  78.         char* flag = file->Lines[line_num]->items[35+i];
  79.  
  80.         if(*flag)
  81.             o_Spell[spell].flags |= 1 << i;
  82.     }
  83.  
  84.     return CALL_3(int,__cdecl,h->GetOriginalFunc(),file_ptr,spell,line_num);
  85. }
  86.  
  87. ....
  88.  
  89.         patcher->WriteHiHook(0x775990,SPLICE_,EXTENDED_, CDECL_, (void*)ReadSptraitsLineHook);
  90.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement