Merge branch 'master' of github.com:diasurgical/devilution
This commit is contained in:
commit
fa3785a475
21 changed files with 760 additions and 1019 deletions
|
|
@ -757,7 +757,7 @@ static void RightMouseDown()
|
|||
}
|
||||
}
|
||||
|
||||
static void diablo_pause_game()
|
||||
void diablo_pause_game()
|
||||
{
|
||||
if (gbMaxPlayers <= 1) {
|
||||
if (PauseMode) {
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ BOOL StartGame(BOOL bNewGame, BOOL bSinglePlayer);
|
|||
void diablo_quit(int exitStatus);
|
||||
int DiabloMain(int argc, char **argv);
|
||||
BOOL TryIconCurs();
|
||||
void diablo_pause_game();
|
||||
BOOL PressEscKey();
|
||||
void DisableInputWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
void GM_Game(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ extern "C" {
|
|||
extern DIABOOL doomflag;
|
||||
extern int DoomQuestState;
|
||||
|
||||
int doom_get_frame_from_time();
|
||||
void doom_init();
|
||||
void doom_close();
|
||||
void doom_draw();
|
||||
|
|
|
|||
|
|
@ -1162,7 +1162,7 @@ void FreeMonsterSnd()
|
|||
}
|
||||
}
|
||||
|
||||
static BOOL calc_snd_position(int x, int y, int *plVolume, int *plPan)
|
||||
BOOL calc_snd_position(int x, int y, int *plVolume, int *plPan)
|
||||
{
|
||||
int pan, volume;
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ BOOL effect_is_playing(int nSFX);
|
|||
void stream_stop();
|
||||
void InitMonsterSND(int monst);
|
||||
void FreeMonsterSnd();
|
||||
BOOL calc_snd_position(int x, int y, int *plVolume, int *plPan);
|
||||
void PlayEffect(int i, int mode);
|
||||
void PlaySFX(int psfx);
|
||||
void PlaySfxLoc(int psfx, int x, int y);
|
||||
|
|
|
|||
|
|
@ -18,17 +18,13 @@ extern const InvXY InvRect[73];
|
|||
|
||||
void FreeInvGFX();
|
||||
void InitInv();
|
||||
void InvDrawSlotBack(int X, int Y, int W, int H);
|
||||
void DrawInv();
|
||||
void DrawInvBelt();
|
||||
BOOL AutoPlace(int pnum, int ii, int sx, int sy, BOOL saveflag);
|
||||
BOOL SpecialAutoPlace(int pnum, int ii, int sx, int sy, BOOL saveflag);
|
||||
BOOL GoldAutoPlace(int pnum);
|
||||
BOOL WeaponAutoPlace(int pnum);
|
||||
int SwapItem(ItemStruct *a, ItemStruct *b);
|
||||
void CheckInvPaste(int pnum, int mx, int my);
|
||||
void CheckInvSwap(int pnum, BYTE bLoc, int idx, WORD wCI, int seed, BOOL bId);
|
||||
void CheckInvCut(int pnum, int mx, int my);
|
||||
void inv_update_rem_item(int pnum, BYTE iv);
|
||||
void RemoveInvItem(int pnum, int iv);
|
||||
#ifdef HELLFIRE
|
||||
|
|
@ -38,8 +34,6 @@ void RemoveSpdBarItem(int pnum, int iv);
|
|||
void CheckInvItem();
|
||||
void CheckInvScrn();
|
||||
void CheckItemStats(int pnum);
|
||||
void CheckBookLevel(int pnum);
|
||||
void CheckQuestItem(int pnum);
|
||||
void InvGetItem(int pnum, int ii);
|
||||
void AutoGetItem(int pnum, int ii);
|
||||
int FindGetItem(int idx, WORD ci, int iseed);
|
||||
|
|
@ -58,7 +52,6 @@ void RemoveScroll(int pnum);
|
|||
BOOL UseScroll();
|
||||
void UseStaffCharge(int pnum);
|
||||
BOOL UseStaff();
|
||||
void StartGoldDrop();
|
||||
BOOL UseInvItem(int pnum, int cii);
|
||||
void DoTelekinesis();
|
||||
int CalculateGold(int pnum);
|
||||
|
|
|
|||
205
Source/items.cpp
205
Source/items.cpp
|
|
@ -494,31 +494,6 @@ int items_get_currlevel()
|
|||
|
||||
return lvl;
|
||||
}
|
||||
|
||||
void items_42390F()
|
||||
{
|
||||
int x, y, id;
|
||||
|
||||
x = random_(12, 80) + 16;
|
||||
y = random_(12, 80) + 16;
|
||||
while (!ItemPlace(x, y)) {
|
||||
x = random_(12, 80) + 16;
|
||||
y = random_(12, 80) + 16;
|
||||
}
|
||||
switch (currlevel) {
|
||||
case 22:
|
||||
id = IDI_NOTE2;
|
||||
break;
|
||||
case 23:
|
||||
id = IDI_NOTE3;
|
||||
break;
|
||||
default:
|
||||
id = IDI_NOTE1;
|
||||
break;
|
||||
}
|
||||
SpawnQuestItem(id, x, y, 0, 1);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void InitItemGFX()
|
||||
|
|
@ -600,6 +575,32 @@ void AddInitItems()
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HELLFIRE
|
||||
static void items_42390F()
|
||||
{
|
||||
int x, y, id;
|
||||
|
||||
x = random_(12, 80) + 16;
|
||||
y = random_(12, 80) + 16;
|
||||
while (!ItemPlace(x, y)) {
|
||||
x = random_(12, 80) + 16;
|
||||
y = random_(12, 80) + 16;
|
||||
}
|
||||
switch (currlevel) {
|
||||
case 22:
|
||||
id = IDI_NOTE2;
|
||||
break;
|
||||
case 23:
|
||||
id = IDI_NOTE3;
|
||||
break;
|
||||
default:
|
||||
id = IDI_NOTE1;
|
||||
break;
|
||||
}
|
||||
SpawnQuestItem(id, x, y, 0, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
void InitItems()
|
||||
{
|
||||
int i;
|
||||
|
|
@ -1210,6 +1211,20 @@ void CalcSelfItems(int pnum)
|
|||
} while (changeflag);
|
||||
}
|
||||
|
||||
static BOOL ItemMinStats(PlayerStruct *p, ItemStruct *x)
|
||||
{
|
||||
if (p->_pMagic < x->_iMinMag)
|
||||
return FALSE;
|
||||
|
||||
if (p->_pStrength < x->_iMinStr)
|
||||
return FALSE;
|
||||
|
||||
if (p->_pDexterity < x->_iMinDex)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CalcPlrItemMin(int pnum)
|
||||
{
|
||||
PlayerStruct *p;
|
||||
|
|
@ -1234,20 +1249,6 @@ void CalcPlrItemMin(int pnum)
|
|||
}
|
||||
}
|
||||
|
||||
BOOL ItemMinStats(PlayerStruct *p, ItemStruct *x)
|
||||
{
|
||||
if (p->_pMagic < x->_iMinMag)
|
||||
return FALSE;
|
||||
|
||||
if (p->_pStrength < x->_iMinStr)
|
||||
return FALSE;
|
||||
|
||||
if (p->_pDexterity < x->_iMinDex)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CalcPlrBookVals(int p)
|
||||
{
|
||||
int i, slvl;
|
||||
|
|
@ -3517,28 +3518,7 @@ void CheckIdentify(int pnum, int cii)
|
|||
SetCursor_(CURSOR_HAND);
|
||||
}
|
||||
|
||||
void DoRepair(int pnum, int cii)
|
||||
{
|
||||
PlayerStruct *p;
|
||||
ItemStruct *pi;
|
||||
|
||||
p = &plr[pnum];
|
||||
PlaySfxLoc(IS_REPAIR, p->_px, p->_py);
|
||||
|
||||
if (cii >= NUM_INVLOC) {
|
||||
pi = &p->InvList[cii - NUM_INVLOC];
|
||||
} else {
|
||||
pi = &p->InvBody[cii];
|
||||
}
|
||||
|
||||
RepairItem(pi, p->_pLevel);
|
||||
CalcPlrInv(pnum, TRUE);
|
||||
|
||||
if (pnum == myplr)
|
||||
SetCursor_(CURSOR_HAND);
|
||||
}
|
||||
|
||||
void RepairItem(ItemStruct *i, int lvl)
|
||||
static void RepairItem(ItemStruct *i, int lvl)
|
||||
{
|
||||
int rep, d;
|
||||
|
||||
|
|
@ -3569,6 +3549,42 @@ void RepairItem(ItemStruct *i, int lvl)
|
|||
i->_iDurability = i->_iMaxDur;
|
||||
}
|
||||
|
||||
void DoRepair(int pnum, int cii)
|
||||
{
|
||||
PlayerStruct *p;
|
||||
ItemStruct *pi;
|
||||
|
||||
p = &plr[pnum];
|
||||
PlaySfxLoc(IS_REPAIR, p->_px, p->_py);
|
||||
|
||||
if (cii >= NUM_INVLOC) {
|
||||
pi = &p->InvList[cii - NUM_INVLOC];
|
||||
} else {
|
||||
pi = &p->InvBody[cii];
|
||||
}
|
||||
|
||||
RepairItem(pi, p->_pLevel);
|
||||
CalcPlrInv(pnum, TRUE);
|
||||
|
||||
if (pnum == myplr)
|
||||
SetCursor_(CURSOR_HAND);
|
||||
}
|
||||
|
||||
static void RechargeItem(ItemStruct *i, int r)
|
||||
{
|
||||
if (i->_iCharges != i->_iMaxCharges) {
|
||||
do {
|
||||
i->_iMaxCharges--;
|
||||
if (i->_iMaxCharges == 0) {
|
||||
return;
|
||||
}
|
||||
i->_iCharges += r;
|
||||
} while (i->_iCharges < i->_iMaxCharges);
|
||||
if (i->_iCharges > i->_iMaxCharges)
|
||||
i->_iCharges = i->_iMaxCharges;
|
||||
}
|
||||
}
|
||||
|
||||
void DoRecharge(int pnum, int cii)
|
||||
{
|
||||
PlayerStruct *p;
|
||||
|
|
@ -3593,21 +3609,7 @@ void DoRecharge(int pnum, int cii)
|
|||
}
|
||||
|
||||
#ifdef HELLFIRE
|
||||
void DoOil(int pnum, int cii)
|
||||
{
|
||||
PlayerStruct *p = &plr[pnum];
|
||||
|
||||
if (cii >= NUM_INVLOC || cii == INVLOC_HEAD || (cii > INVLOC_AMULET && cii <= INVLOC_CHEST)) {
|
||||
if (OilItem(&p->InvBody[cii], p)) {
|
||||
CalcPlrInv(pnum, TRUE);
|
||||
if (pnum == myplr) {
|
||||
SetCursor_(CURSOR_HAND);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOL OilItem(ItemStruct *x, PlayerStruct *p)
|
||||
static BOOL OilItem(ItemStruct *x, PlayerStruct *p)
|
||||
{
|
||||
int dur, r;
|
||||
|
||||
|
|
@ -3727,21 +3729,20 @@ BOOL OilItem(ItemStruct *x, PlayerStruct *p)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
void RechargeItem(ItemStruct *i, int r)
|
||||
void DoOil(int pnum, int cii)
|
||||
{
|
||||
if (i->_iCharges != i->_iMaxCharges) {
|
||||
do {
|
||||
i->_iMaxCharges--;
|
||||
if (i->_iMaxCharges == 0) {
|
||||
return;
|
||||
PlayerStruct *p = &plr[pnum];
|
||||
|
||||
if (cii >= NUM_INVLOC || cii == INVLOC_HEAD || (cii > INVLOC_AMULET && cii <= INVLOC_CHEST)) {
|
||||
if (OilItem(&p->InvBody[cii], p)) {
|
||||
CalcPlrInv(pnum, TRUE);
|
||||
if (pnum == myplr) {
|
||||
SetCursor_(CURSOR_HAND);
|
||||
}
|
||||
i->_iCharges += r;
|
||||
} while (i->_iCharges < i->_iMaxCharges);
|
||||
if (i->_iCharges > i->_iMaxCharges)
|
||||
i->_iCharges = i->_iMaxCharges;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void PrintItemOil(char IDidx)
|
||||
{
|
||||
|
|
@ -4902,7 +4903,7 @@ int RndPremiumItem(int minlvl, int maxlvl)
|
|||
return ril[random_(50, ri)] + 1;
|
||||
}
|
||||
|
||||
void SpawnOnePremium(int i, int plvl)
|
||||
static void SpawnOnePremium(int i, int plvl)
|
||||
{
|
||||
int itype;
|
||||
ItemStruct holditem;
|
||||
|
|
@ -5635,6 +5636,20 @@ void CreateMagicWeapon(int x, int y, int imisc, int icurs, BOOL sendmsg, BOOL de
|
|||
}
|
||||
}
|
||||
|
||||
static void NextItemRecord(int i)
|
||||
{
|
||||
gnNumGetRecords--;
|
||||
|
||||
if (gnNumGetRecords == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
itemrecord[i].dwTimestamp = itemrecord[gnNumGetRecords].dwTimestamp;
|
||||
itemrecord[i].nSeed = itemrecord[gnNumGetRecords].nSeed;
|
||||
itemrecord[i].wCI = itemrecord[gnNumGetRecords].wCI;
|
||||
itemrecord[i].nIndex = itemrecord[gnNumGetRecords].nIndex;
|
||||
}
|
||||
|
||||
BOOL GetItemRecord(int nSeed, WORD wCI, int nIndex)
|
||||
{
|
||||
int i;
|
||||
|
|
@ -5654,20 +5669,6 @@ BOOL GetItemRecord(int nSeed, WORD wCI, int nIndex)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void NextItemRecord(int i)
|
||||
{
|
||||
gnNumGetRecords--;
|
||||
|
||||
if (gnNumGetRecords == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
itemrecord[i].dwTimestamp = itemrecord[gnNumGetRecords].dwTimestamp;
|
||||
itemrecord[i].nSeed = itemrecord[gnNumGetRecords].nSeed;
|
||||
itemrecord[i].wCI = itemrecord[gnNumGetRecords].wCI;
|
||||
itemrecord[i].nIndex = itemrecord[gnNumGetRecords].nIndex;
|
||||
}
|
||||
|
||||
void SetItemRecord(int nSeed, WORD wCI, int nIndex)
|
||||
{
|
||||
DWORD dwTicks;
|
||||
|
|
|
|||
|
|
@ -15,20 +15,16 @@ extern "C" {
|
|||
extern int itemactive[MAXITEMS];
|
||||
extern BOOL uitemflag;
|
||||
extern int itemavail[MAXITEMS];
|
||||
extern ItemStruct curruitem;
|
||||
extern ItemGetRecordStruct itemrecord[MAXITEMS];
|
||||
extern ItemStruct item[MAXITEMS + 1];
|
||||
extern BOOL itemhold[3][3];
|
||||
#ifdef HELLFIRE
|
||||
extern CornerStoneStruct CornerStone;
|
||||
#endif
|
||||
extern BYTE *itemanims[ITEMTYPES];
|
||||
extern BOOL UniqueItemFlag[128];
|
||||
#ifdef HELLFIRE
|
||||
extern int auricGold;
|
||||
#endif
|
||||
extern int numitems;
|
||||
extern int gnNumGetRecords;
|
||||
|
||||
#ifdef HELLFIRE
|
||||
int items_4231CA(int i);
|
||||
|
|
@ -41,63 +37,29 @@ int items_42342E(int i);
|
|||
int items_4234B2(int i);
|
||||
int items_423518(int i);
|
||||
int items_42357E(int i);
|
||||
void items_42390F();
|
||||
int items_get_currlevel();
|
||||
#endif
|
||||
void InitItemGFX();
|
||||
BOOL ItemPlace(int xp, int yp);
|
||||
void AddInitItems();
|
||||
void InitItems();
|
||||
void CalcPlrItemVals(int p, BOOL Loadgfx);
|
||||
void CalcPlrScrolls(int p);
|
||||
void CalcPlrStaff(int p);
|
||||
void CalcSelfItems(int pnum);
|
||||
void CalcPlrItemMin(int pnum);
|
||||
BOOL ItemMinStats(PlayerStruct *p, ItemStruct *x);
|
||||
void CalcPlrBookVals(int p);
|
||||
void CalcPlrInv(int p, BOOL Loadgfx);
|
||||
void SetPlrHandItem(ItemStruct *h, int idata);
|
||||
void GetPlrHandSeed(ItemStruct *h);
|
||||
void GetGoldSeed(int pnum, ItemStruct *h);
|
||||
void SetPlrHandSeed(ItemStruct *h, int iseed);
|
||||
void SetPlrHandGoldCurs(ItemStruct *h);
|
||||
void CreatePlrItems(int p);
|
||||
BOOL ItemSpaceOk(int i, int j);
|
||||
BOOL GetItemSpace(int x, int y, char inum);
|
||||
void GetSuperItemSpace(int x, int y, char inum);
|
||||
void GetSuperItemLoc(int x, int y, int *xx, int *yy);
|
||||
void CalcItemValue(int i);
|
||||
void GetBookSpell(int i, int lvl);
|
||||
void GetStaffPower(int i, int lvl, int bs, BOOL onlygood);
|
||||
void GetStaffSpell(int i, int lvl, BOOL onlygood);
|
||||
void GetItemAttrs(int i, int idata, int lvl);
|
||||
int RndPL(int param1, int param2);
|
||||
int PLVal(int pv, int p1, int p2, int minv, int maxv);
|
||||
void SaveItemPower(int i, int power, int param1, int param2, int minval, int maxval, int multval);
|
||||
void GetItemPower(int i, int minlvl, int maxlvl, int flgs, BOOL onlygood);
|
||||
#ifdef HELLFIRE
|
||||
void GetItemBonus(int i, int idata, int minlvl, int maxlvl, BOOL onlygood, BOOLEAN allowspells);
|
||||
#else
|
||||
void GetItemBonus(int i, int idata, int minlvl, int maxlvl, BOOL onlygood);
|
||||
#endif
|
||||
void SetupItem(int i);
|
||||
int RndItem(int m);
|
||||
int RndUItem(int m);
|
||||
int RndAllItems();
|
||||
#ifdef HELLFIRE
|
||||
int RndTypeItems(int itype, int imid, int lvl);
|
||||
#else
|
||||
int RndTypeItems(int itype, int imid);
|
||||
#endif
|
||||
int CheckUnique(int i, int lvl, int uper, BOOL recreate);
|
||||
void GetUniqueItem(int i, int uid);
|
||||
void SpawnUnique(int uid, int x, int y);
|
||||
void ItemRndDur(int ii);
|
||||
void SetupAllItems(int ii, int idx, int iseed, int lvl, int uper, BOOL onlygood, BOOL recreate, BOOL pregen);
|
||||
void SpawnItem(int m, int x, int y, BOOL sendmsg);
|
||||
void CreateItem(int uid, int x, int y);
|
||||
void CreateRndItem(int x, int y, BOOL onlygood, BOOL sendmsg, BOOL delta);
|
||||
void SetupAllUseful(int ii, int iseed, int lvl);
|
||||
void CreateRndUseful(int pnum, int x, int y, BOOL sendmsg);
|
||||
void CreateTypeItem(int x, int y, BOOL onlygood, int itype, int imisc, BOOL sendmsg, BOOL delta);
|
||||
void RecreateItem(int ii, int idx, WORD icreateinfo, int iseed, int ivalue);
|
||||
|
|
@ -116,7 +78,6 @@ void SpawnTheodore(int xx, int yy);
|
|||
#endif
|
||||
void RespawnItem(int i, BOOL FlipFlag);
|
||||
void DeleteItem(int ii, int i);
|
||||
void ItemDoppel();
|
||||
void ProcessItems();
|
||||
void FreeItemGFX();
|
||||
void GetItemFrm(int i);
|
||||
|
|
@ -127,50 +88,25 @@ void RepairItem(ItemStruct *i, int lvl);
|
|||
void DoRecharge(int pnum, int cii);
|
||||
#ifdef HELLFIRE
|
||||
void DoOil(int pnum, int cii);
|
||||
BOOL OilItem(ItemStruct *x, PlayerStruct *p);
|
||||
#endif
|
||||
void RechargeItem(ItemStruct *i, int r);
|
||||
void PrintItemOil(char IDidx);
|
||||
void PrintItemPower(char plidx, ItemStruct *x);
|
||||
void DrawUTextBack();
|
||||
void PrintUString(int x, int y, BOOL cjustflag, const char *str, int col);
|
||||
void DrawULine(int y);
|
||||
void DrawUniqueInfo();
|
||||
void PrintItemMisc(ItemStruct *x);
|
||||
void PrintItemDetails(ItemStruct *x);
|
||||
void PrintItemDur(ItemStruct *x);
|
||||
void UseItem(int p, int Mid, int spl);
|
||||
BOOL StoreStatOk(ItemStruct *h);
|
||||
BOOL SmithItemOk(int i);
|
||||
int RndSmithItem(int lvl);
|
||||
void BubbleSwapItem(ItemStruct *a, ItemStruct *b);
|
||||
void SortSmith();
|
||||
void SpawnSmith(int lvl);
|
||||
BOOL PremiumItemOk(int i);
|
||||
int RndPremiumItem(int minlvl, int maxlvl);
|
||||
void SpawnOnePremium(int i, int plvl);
|
||||
#ifdef HELLFIRE
|
||||
void SpawnPremium(int pnum);
|
||||
#else
|
||||
void SpawnPremium(int lvl);
|
||||
#endif
|
||||
BOOL WitchItemOk(int i);
|
||||
int RndWitchItem(int lvl);
|
||||
void SortWitch();
|
||||
void WitchBookLevel(int ii);
|
||||
void SpawnWitch(int lvl);
|
||||
int RndBoyItem(int lvl);
|
||||
void SpawnBoy(int lvl);
|
||||
BOOL HealerItemOk(int i);
|
||||
int RndHealerItem(int lvl);
|
||||
void SortHealer();
|
||||
void SpawnHealer(int lvl);
|
||||
void SpawnStoreGold();
|
||||
void RecreateSmithItem(int ii, int idx, int lvl, int iseed);
|
||||
void RecreatePremiumItem(int ii, int idx, int plvl, int iseed);
|
||||
void RecreateBoyItem(int ii, int idx, int lvl, int iseed);
|
||||
void RecreateWitchItem(int ii, int idx, int lvl, int iseed);
|
||||
void RecreateHealerItem(int ii, int idx, int lvl, int iseed);
|
||||
void RecreateTownItem(int ii, int idx, WORD icreateinfo, int iseed, int ivalue);
|
||||
void RecalcStoreStats();
|
||||
int ItemNoFlippy();
|
||||
|
|
@ -181,27 +117,17 @@ void CreateAmulet(int x, int y, int curlv, BOOL sendmsg, BOOL delta);
|
|||
#endif
|
||||
void CreateMagicWeapon(int x, int y, int imisc, int icurs, BOOL sendmsg, BOOL delta);
|
||||
BOOL GetItemRecord(int nSeed, WORD wCI, int nIndex);
|
||||
void NextItemRecord(int i);
|
||||
void SetItemRecord(int nSeed, WORD wCI, int nIndex);
|
||||
void PutItemRecord(int nSeed, WORD wCI, int nIndex);
|
||||
|
||||
/* data */
|
||||
|
||||
#ifdef HELLFIRE
|
||||
extern int OilLevels[10];
|
||||
extern int OilValues[10];
|
||||
extern int OilMagic[10];
|
||||
extern char OilNames[10][25];
|
||||
extern int MaxGold;
|
||||
#endif
|
||||
|
||||
extern BYTE ItemCAnimTbl[];
|
||||
extern const char *const ItemDropNames[];
|
||||
extern BYTE ItemAnimLs[];
|
||||
extern int ItemDropSnds[];
|
||||
extern int ItemInvSnds[];
|
||||
extern int idoppely;
|
||||
extern int premiumlvladd[6];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,14 +21,11 @@ extern BOOL dovision;
|
|||
extern int numvision;
|
||||
extern char lightmax;
|
||||
extern BOOL dolighting;
|
||||
extern BYTE lightblock[64][16][16];
|
||||
extern int visionid;
|
||||
extern BYTE *pLightTbl;
|
||||
extern BOOL lightflag;
|
||||
|
||||
void RotateRadius(int *x, int *y, int *dx, int *dy, int *lx, int *ly, int *bx, int *by);
|
||||
void DoLighting(int nXPos, int nYPos, int nRadius, int Lnum);
|
||||
void DoUnLight(int nXPos, int nYPos, int nRadius);
|
||||
void DoUnVision(int nXPos, int nYPos, int nRadius);
|
||||
void DoVision(int nXPos, int nYPos, int nRadius, BOOL doautomap, BOOL visible);
|
||||
void FreeLightTable();
|
||||
|
|
@ -57,10 +54,7 @@ void lighting_color_cycling();
|
|||
/* rdata */
|
||||
|
||||
extern char CrawlTable[2749];
|
||||
extern char *pCrawlTable[19];
|
||||
extern BYTE vCrawlTable[23][30];
|
||||
extern BYTE byte_49463C[18][18];
|
||||
extern BYTE RadiusAdj[23];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -12,42 +12,8 @@ DEVILUTION_BEGIN_NAMESPACE
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern BYTE *tbuff;
|
||||
|
||||
void LoadGame(BOOL firstflag);
|
||||
char BLoad();
|
||||
int WLoad();
|
||||
int ILoad();
|
||||
BOOL OLoad();
|
||||
void LoadItems(const int n, ItemStruct *pItem);
|
||||
void LoadItemData(ItemStruct *pItem);
|
||||
void SaveItem(ItemStruct *pItem);
|
||||
void SaveItems(ItemStruct *pItem, const int n);
|
||||
|
||||
void LoadPlayer(int i);
|
||||
void LoadMonster(int i);
|
||||
void LoadMissile(int i);
|
||||
void LoadObject(int i);
|
||||
void LoadItem(int i);
|
||||
void LoadPremium(int i);
|
||||
void LoadQuest(int i);
|
||||
void LoadLighting(int i);
|
||||
void LoadVision(int i);
|
||||
void LoadPortal(int i);
|
||||
void SaveGame();
|
||||
void BSave(char v);
|
||||
void WSave(int v);
|
||||
void ISave(int v);
|
||||
void OSave(BOOL v);
|
||||
void SavePlayer(int i);
|
||||
void SaveMonster(int i);
|
||||
void SaveMissile(int i);
|
||||
void SaveObject(int i);
|
||||
void SavePremium(int i);
|
||||
void SaveQuest(int i);
|
||||
void SaveLighting(int i);
|
||||
void SaveVision(int i);
|
||||
void SavePortal(int i);
|
||||
void SaveLevel();
|
||||
void LoadLevel();
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,54 @@ void mainmenu_refresh_music()
|
|||
} while (menu_music_track_id == TMUSIC_TOWN || menu_music_track_id == TMUSIC_L1);
|
||||
}
|
||||
|
||||
static BOOL mainmenu_init_menu(int type)
|
||||
{
|
||||
BOOL success;
|
||||
|
||||
if (type == SELHERO_PREVIOUS)
|
||||
return TRUE;
|
||||
|
||||
music_stop();
|
||||
|
||||
success = StartGame(type != SELHERO_CONTINUE, type != SELHERO_CONNECT);
|
||||
if (success)
|
||||
mainmenu_refresh_music();
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
static BOOL mainmenu_single_player()
|
||||
{
|
||||
#ifdef HELLFIRE
|
||||
if (!SRegLoadValue(APP_NAME, jogging_title, 0, &jogging_opt)) {
|
||||
jogging_opt = TRUE;
|
||||
}
|
||||
#endif
|
||||
gbMaxPlayers = 1;
|
||||
|
||||
if (!SRegLoadValue("devilutionx", "game speed", 0, &ticks_per_sec)) {
|
||||
SRegSaveValue("devilutionx", "game speed", 0, ticks_per_sec);
|
||||
}
|
||||
|
||||
return mainmenu_init_menu(SELHERO_NEW_DUNGEON);
|
||||
}
|
||||
|
||||
static BOOL mainmenu_multi_player()
|
||||
{
|
||||
gbMaxPlayers = MAX_PLRS;
|
||||
return mainmenu_init_menu(SELHERO_CONNECT);
|
||||
}
|
||||
|
||||
static void mainmenu_play_intro()
|
||||
{
|
||||
music_stop();
|
||||
#ifdef HELLFIRE
|
||||
play_movie("gendata\\Hellfire.smk", TRUE);
|
||||
#else
|
||||
play_movie("gendata\\diablo1.smk", TRUE);
|
||||
#endif
|
||||
mainmenu_refresh_music();
|
||||
}
|
||||
void mainmenu_change_name(int arg1, int arg2, int arg3, int arg4, char *name_1, char *name_2)
|
||||
{
|
||||
if (UiValidPlayerName(name_2))
|
||||
|
|
@ -142,53 +190,4 @@ void mainmenu_loop()
|
|||
music_stop();
|
||||
}
|
||||
|
||||
BOOL mainmenu_single_player()
|
||||
{
|
||||
#ifdef HELLFIRE
|
||||
if (!SRegLoadValue(APP_NAME, jogging_title, 0, &jogging_opt)) {
|
||||
jogging_opt = TRUE;
|
||||
}
|
||||
#endif
|
||||
gbMaxPlayers = 1;
|
||||
|
||||
if (!SRegLoadValue("devilutionx", "game speed", 0, &ticks_per_sec)) {
|
||||
SRegSaveValue("devilutionx", "game speed", 0, ticks_per_sec);
|
||||
}
|
||||
|
||||
return mainmenu_init_menu(SELHERO_NEW_DUNGEON);
|
||||
}
|
||||
|
||||
BOOL mainmenu_init_menu(int type)
|
||||
{
|
||||
BOOL success;
|
||||
|
||||
if (type == SELHERO_PREVIOUS)
|
||||
return TRUE;
|
||||
|
||||
music_stop();
|
||||
|
||||
success = StartGame(type != SELHERO_CONTINUE, type != SELHERO_CONNECT);
|
||||
if (success)
|
||||
mainmenu_refresh_music();
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
BOOL mainmenu_multi_player()
|
||||
{
|
||||
gbMaxPlayers = MAX_PLRS;
|
||||
return mainmenu_init_menu(SELHERO_CONNECT);
|
||||
}
|
||||
|
||||
void mainmenu_play_intro()
|
||||
{
|
||||
music_stop();
|
||||
#ifdef HELLFIRE
|
||||
play_movie("gendata\\Hellfire.smk", TRUE);
|
||||
#else
|
||||
play_movie("gendata\\diablo1.smk", TRUE);
|
||||
#endif
|
||||
mainmenu_refresh_music();
|
||||
}
|
||||
|
||||
DEVILUTION_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ extern "C" {
|
|||
|
||||
extern char gszHero[16];
|
||||
|
||||
void mainmenu_refresh_music();
|
||||
void mainmenu_change_name(int arg1, int arg2, int arg3, int arg4, char *name_1, char *name_2);
|
||||
BOOL mainmenu_select_hero_dialog(
|
||||
const _SNETPROGRAMDATA *client_info,
|
||||
|
|
@ -26,16 +25,6 @@ BOOL mainmenu_select_hero_dialog(
|
|||
char *cdesc, DWORD cdlen, // character "description" will be copied here (used to advertise games)
|
||||
BOOL *multi); // new character? - unsure about this
|
||||
void mainmenu_loop();
|
||||
BOOL mainmenu_single_player();
|
||||
BOOL mainmenu_init_menu(int type);
|
||||
BOOL mainmenu_multi_player();
|
||||
void mainmenu_play_intro();
|
||||
|
||||
/* rdata */
|
||||
|
||||
/* data */
|
||||
|
||||
extern int menu_music_track_id;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,28 +12,14 @@ DEVILUTION_BEGIN_NAMESPACE
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int qtexty;
|
||||
extern const char *qtextptr;
|
||||
extern BOOLEAN qtextflag;
|
||||
extern BYTE *pMedTextCels;
|
||||
extern BYTE *pTextBoxCels;
|
||||
|
||||
void FreeQuestText();
|
||||
void InitQuestText();
|
||||
void InitQTextMsg(int m);
|
||||
void DrawQTextBack();
|
||||
void PrintQTextChr(int sx, int sy, BYTE *pCelBuff, int nCel);
|
||||
void DrawQText();
|
||||
|
||||
/* rdata */
|
||||
|
||||
extern const BYTE mfontframe[128];
|
||||
extern const BYTE mfontkern[56];
|
||||
|
||||
/* data */
|
||||
|
||||
extern int qscroll_spd_tbl[9];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1314,24 +1314,7 @@ void missiles_hive_explosion(int mi, int sx, int sy, int dx, int dy, int midir,
|
|||
missile[mi]._miDelFlag = TRUE;
|
||||
}
|
||||
|
||||
void missiles_fire_rune(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam)
|
||||
{
|
||||
if (LineClear(sx, sy, dx, dy)) {
|
||||
if (id >= 0)
|
||||
UseMana(id, SPL_RUNEFIRE);
|
||||
if (missiles_found_target(mi, &dx, &dy, 10)) {
|
||||
missile[mi]._miVar1 = MIS_HIVEEXP;
|
||||
missile[mi]._miDelFlag = FALSE;
|
||||
missile[mi]._mlid = AddLight(dx, dy, 8);
|
||||
} else {
|
||||
missile[mi]._miDelFlag = TRUE;
|
||||
}
|
||||
} else {
|
||||
missile[mi]._miDelFlag = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
BOOLEAN missiles_found_target(int mi, int *x, int *y, int rad)
|
||||
static BOOLEAN missiles_found_target(int mi, int *x, int *y, int rad)
|
||||
{
|
||||
BOOLEAN found;
|
||||
int i, j, k, tx, ty, dp;
|
||||
|
|
@ -1365,6 +1348,23 @@ BOOLEAN missiles_found_target(int mi, int *x, int *y, int rad)
|
|||
return found;
|
||||
}
|
||||
|
||||
void missiles_fire_rune(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam)
|
||||
{
|
||||
if (LineClear(sx, sy, dx, dy)) {
|
||||
if (id >= 0)
|
||||
UseMana(id, SPL_RUNEFIRE);
|
||||
if (missiles_found_target(mi, &dx, &dy, 10)) {
|
||||
missile[mi]._miVar1 = MIS_HIVEEXP;
|
||||
missile[mi]._miDelFlag = FALSE;
|
||||
missile[mi]._mlid = AddLight(dx, dy, 8);
|
||||
} else {
|
||||
missile[mi]._miDelFlag = TRUE;
|
||||
}
|
||||
} else {
|
||||
missile[mi]._miDelFlag = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void missiles_light_rune(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam)
|
||||
{
|
||||
if (LineClear(sx, sy, dx, dy)) {
|
||||
|
|
|
|||
|
|
@ -16,39 +16,23 @@ extern int missileactive[MAXMISSILES];
|
|||
extern int missileavail[MAXMISSILES];
|
||||
extern MissileStruct missile[MAXMISSILES];
|
||||
extern int nummissiles;
|
||||
extern BOOL ManashieldFlag;
|
||||
extern ChainStruct chain[MAXMISSILES];
|
||||
extern BOOL MissilePreFlag;
|
||||
extern int numchains;
|
||||
|
||||
void GetDamageAmt(int i, int *mind, int *maxd);
|
||||
BOOL CheckBlock(int fx, int fy, int tx, int ty);
|
||||
int FindClosest(int sx, int sy, int rad);
|
||||
int GetSpellLevel(int id, int sn);
|
||||
int GetDirection8(int x1, int y1, int x2, int y2);
|
||||
int GetDirection16(int x1, int y1, int x2, int y2);
|
||||
void DeleteMissile(int mi, int i);
|
||||
void GetMissileVel(int i, int sx, int sy, int dx, int dy, int v);
|
||||
void PutMissile(int i);
|
||||
void GetMissilePos(int i);
|
||||
void MoveMissilePos(int i);
|
||||
BOOL MonsterTrapHit(int m, int mindam, int maxdam, int dist, int t, BOOLEAN shift);
|
||||
BOOL MonsterMHit(int pnum, int m, int mindam, int maxdam, int dist, int t, BOOLEAN shift);
|
||||
BOOL PlayerMHit(int pnum, int m, int dist, int mind, int maxd, int mtype, BOOLEAN shift, int earflag);
|
||||
BOOL Plr2PlrMHit(int pnum, int p, int mindam, int maxdam, int dist, int mtype, BOOLEAN shift);
|
||||
void CheckMissileCol(int i, int mindam, int maxdam, BOOL shift, int mx, int my, BOOLEAN nodel);
|
||||
void SetMissAnim(int mi, int animtype);
|
||||
void SetMissDir(int mi, int dir);
|
||||
void LoadMissileGFX(BYTE mi);
|
||||
void InitMissileGFX();
|
||||
void FreeMissileGFX(int mi);
|
||||
void FreeMissiles();
|
||||
void FreeMissiles2();
|
||||
void InitMissiles();
|
||||
#ifdef HELLFIRE
|
||||
void missiles_hive_explosion(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam);
|
||||
void missiles_fire_rune(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam);
|
||||
BOOLEAN missiles_found_target(int mi, int *x, int *y, int rad);
|
||||
void missiles_light_rune(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam);
|
||||
void missiles_great_light_rune(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam);
|
||||
void missiles_immolation_rune(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam);
|
||||
|
|
@ -78,7 +62,6 @@ void AddBlodboil(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy
|
|||
#endif
|
||||
void AddLArrow(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam);
|
||||
void AddArrow(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam);
|
||||
void GetVileMissPos(int mi, int dx, int dy);
|
||||
void AddRndTeleport(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam);
|
||||
void AddFirebolt(int mi, int sx, int sy, int dx, int dy, int midir, char micaster, int id, int dam);
|
||||
void AddMagmaball(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam);
|
||||
|
|
@ -91,7 +74,6 @@ void AddLightctrl(int mi, int sx, int sy, int dx, int dy, int midir, char mienem
|
|||
void AddLightning(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam);
|
||||
void AddMisexp(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam);
|
||||
void AddWeapexp(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam);
|
||||
BOOL CheckIfTrig(int x, int y);
|
||||
void AddTown(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam);
|
||||
void AddFlash(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam);
|
||||
void AddFlash2(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam);
|
||||
|
|
@ -138,7 +120,6 @@ void AddBoneSpirit(int mi, int sx, int sy, int dx, int dy, int midir, char miene
|
|||
void AddRportal(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam);
|
||||
void AddDiabApoca(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, int id, int dam);
|
||||
int AddMissile(int sx, int sy, int dx, int dy, int midir, int mitype, char micaster, int id, int midam, int spllvl);
|
||||
int Sentfire(int i, int sx, int sy);
|
||||
void MI_Dummy(int i);
|
||||
void MI_Golem(int i);
|
||||
void MI_SetManashield(int i);
|
||||
|
|
@ -172,7 +153,6 @@ void MI_Lightning(int i);
|
|||
void MI_Town(int i);
|
||||
void MI_Flash(int i);
|
||||
void MI_Flash2(int i);
|
||||
void MI_Manashield(int i);
|
||||
void MI_Etherealize(int i);
|
||||
void MI_Firemove(int i);
|
||||
void MI_Guardian(int i);
|
||||
|
|
@ -204,11 +184,6 @@ void ProcessMissiles();
|
|||
void missiles_process_charge();
|
||||
void ClearMissileSpot(int mi);
|
||||
|
||||
/* rdata */
|
||||
|
||||
extern int XDirAdd[8];
|
||||
extern int YDirAdd[8];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -936,6 +936,36 @@ void PlaceUniqueMonst(int uniqindex, int miniontype, int unpackfilesize)
|
|||
}
|
||||
}
|
||||
|
||||
static void PlaceUniques()
|
||||
{
|
||||
int u, mt;
|
||||
BOOL done;
|
||||
|
||||
for (u = 0; UniqMonst[u].mtype != -1; u++) {
|
||||
if (UniqMonst[u].mlevel != currlevel)
|
||||
continue;
|
||||
done = FALSE;
|
||||
for (mt = 0; mt < nummtypes; mt++) {
|
||||
if (done)
|
||||
break;
|
||||
done = (Monsters[mt].mtype == UniqMonst[u].mtype);
|
||||
}
|
||||
mt--;
|
||||
if (u == UMT_GARBUD && quests[Q_GARBUD]._qactive == QUEST_NOTAVAIL)
|
||||
done = FALSE;
|
||||
if (u == UMT_ZHAR && quests[Q_ZHAR]._qactive == QUEST_NOTAVAIL)
|
||||
done = FALSE;
|
||||
if (u == UMT_SNOTSPIL && quests[Q_LTBANNER]._qactive == QUEST_NOTAVAIL)
|
||||
done = FALSE;
|
||||
if (u == UMT_LACHDAN && quests[Q_VEIL]._qactive == QUEST_NOTAVAIL)
|
||||
done = FALSE;
|
||||
if (u == UMT_WARLORD && quests[Q_WARLORD]._qactive == QUEST_NOTAVAIL)
|
||||
done = FALSE;
|
||||
if (done)
|
||||
PlaceUniqueMonst(u, mt, 8);
|
||||
}
|
||||
}
|
||||
|
||||
void PlaceQuestMonsters()
|
||||
{
|
||||
int skeltype;
|
||||
|
|
@ -1194,36 +1224,6 @@ void InitMonsters()
|
|||
}
|
||||
}
|
||||
|
||||
void PlaceUniques()
|
||||
{
|
||||
int u, mt;
|
||||
BOOL done;
|
||||
|
||||
for (u = 0; UniqMonst[u].mtype != -1; u++) {
|
||||
if (UniqMonst[u].mlevel != currlevel)
|
||||
continue;
|
||||
done = FALSE;
|
||||
for (mt = 0; mt < nummtypes; mt++) {
|
||||
if (done)
|
||||
break;
|
||||
done = (Monsters[mt].mtype == UniqMonst[u].mtype);
|
||||
}
|
||||
mt--;
|
||||
if (u == UMT_GARBUD && quests[Q_GARBUD]._qactive == QUEST_NOTAVAIL)
|
||||
done = FALSE;
|
||||
if (u == UMT_ZHAR && quests[Q_ZHAR]._qactive == QUEST_NOTAVAIL)
|
||||
done = FALSE;
|
||||
if (u == UMT_SNOTSPIL && quests[Q_LTBANNER]._qactive == QUEST_NOTAVAIL)
|
||||
done = FALSE;
|
||||
if (u == UMT_LACHDAN && quests[Q_VEIL]._qactive == QUEST_NOTAVAIL)
|
||||
done = FALSE;
|
||||
if (u == UMT_WARLORD && quests[Q_WARLORD]._qactive == QUEST_NOTAVAIL)
|
||||
done = FALSE;
|
||||
if (done)
|
||||
PlaceUniqueMonst(u, mt, 8);
|
||||
}
|
||||
}
|
||||
|
||||
void SetMapMonsters(BYTE *pMap, int startx, int starty)
|
||||
{
|
||||
WORD rw, rh;
|
||||
|
|
|
|||
|
|
@ -12,112 +12,48 @@ DEVILUTION_BEGIN_NAMESPACE
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int MissileFileFlag;
|
||||
extern int monstkills[MAXMONSTERS];
|
||||
extern int monstactive[MAXMONSTERS];
|
||||
extern int nummonsters;
|
||||
extern BOOLEAN sgbSaveSoundOn;
|
||||
extern MonsterStruct monster[MAXMONSTERS];
|
||||
extern int totalmonsters;
|
||||
extern CMonster Monsters[MAX_LVLMTYPES];
|
||||
#ifdef HELLFIRE
|
||||
extern int GraphicTable[NUMLEVELS][MAX_LVLMTYPES];
|
||||
#else
|
||||
extern BYTE GraphicTable[NUMLEVELS][MAX_LVLMTYPES];
|
||||
#endif
|
||||
extern int monstimgtot;
|
||||
extern int uniquetrans;
|
||||
extern int nummtypes;
|
||||
|
||||
void InitMonsterTRN(int monst, BOOL special);
|
||||
void InitLevelMonsters();
|
||||
int AddMonsterType(int type, int placeflag);
|
||||
void GetLevelMTypes();
|
||||
void InitMonsterGFX(int monst);
|
||||
void ClearMVars(int i);
|
||||
void InitMonster(int i, int rd, int mtype, int x, int y);
|
||||
void ClrAllMonsters();
|
||||
BOOL MonstPlace(int xp, int yp);
|
||||
void monster_some_crypt();
|
||||
void PlaceMonster(int i, int mtype, int x, int y);
|
||||
void PlaceUniqueMonst(int uniqindex, int miniontype, int unpackfilesize);
|
||||
void PlaceQuestMonsters();
|
||||
void PlaceGroup(int mtype, int num, int leaderf, int leader);
|
||||
void LoadDiabMonsts();
|
||||
void InitMonsters();
|
||||
void PlaceUniques();
|
||||
void SetMapMonsters(BYTE *pMap, int startx, int starty);
|
||||
void DeleteMonster(int i);
|
||||
int AddMonster(int x, int y, int dir, int mtype, BOOL InMap);
|
||||
#ifdef HELLFIRE
|
||||
void monster_43C785(int i);
|
||||
#endif
|
||||
void NewMonsterAnim(int i, AnimStruct *anim, int md);
|
||||
BOOL M_Ranged(int i);
|
||||
BOOL M_Talker(int i);
|
||||
void M_Enemy(int i);
|
||||
int M_GetDir(int i);
|
||||
void M_CheckEFlag(int i);
|
||||
void M_StartStand(int i, int md);
|
||||
void M_StartDelay(int i, int len);
|
||||
void M_StartSpStand(int i, int md);
|
||||
void M_StartWalk(int i, int xvel, int yvel, int xadd, int yadd, int EndDir);
|
||||
void M_StartWalk2(int i, int xvel, int yvel, int xoff, int yoff, int xadd, int yadd, int EndDir);
|
||||
void M_StartWalk3(int i, int xvel, int yvel, int xoff, int yoff, int xadd, int yadd, int mapx, int mapy, int EndDir);
|
||||
void M_StartAttack(int i);
|
||||
void M_StartRAttack(int i, int missile_type, int dam);
|
||||
void M_StartRSpAttack(int i, int missile_type, int dam);
|
||||
void M_StartSpAttack(int i);
|
||||
void M_StartEat(int i);
|
||||
void M_ClearSquares(int i);
|
||||
void M_GetKnockback(int i);
|
||||
void M_StartHit(int i, int pnum, int dam);
|
||||
void M_DiabloDeath(int i, BOOL sendmsg);
|
||||
#ifdef HELLFIRE
|
||||
void SpawnLoot(int i, BOOL sendmsg);
|
||||
#endif
|
||||
void M2MStartHit(int mid, int i, int dam);
|
||||
void MonstStartKill(int i, int pnum, BOOL sendmsg);
|
||||
void M2MStartKill(int i, int mid);
|
||||
void M_StartKill(int i, int pnum);
|
||||
void M_SyncStartKill(int i, int x, int y, int pnum);
|
||||
void M_StartFadein(int i, int md, BOOL backwards);
|
||||
void M_StartFadeout(int i, int md, BOOL backwards);
|
||||
void M_StartHeal(int i);
|
||||
void M_ChangeLightOffset(int monst);
|
||||
BOOL M_DoStand(int i);
|
||||
BOOL M_DoWalk(int i);
|
||||
BOOL M_DoWalk2(int i);
|
||||
BOOL M_DoWalk3(int i);
|
||||
void M_TryM2MHit(int i, int mid, int hper, int mind, int maxd);
|
||||
void M_TryH2HHit(int i, int pnum, int Hit, int MinDam, int MaxDam);
|
||||
BOOL M_DoAttack(int i);
|
||||
BOOL M_DoRAttack(int i);
|
||||
int M_DoRSpAttack(int i);
|
||||
BOOL M_DoSAttack(int i);
|
||||
BOOL M_DoFadein(int i);
|
||||
BOOL M_DoFadeout(int i);
|
||||
int M_DoHeal(int i);
|
||||
int M_DoTalk(int i);
|
||||
void M_Teleport(int i);
|
||||
BOOL M_DoGotHit(int i);
|
||||
void M_UpdateLeader(int i);
|
||||
void DoEnding();
|
||||
void PrepDoEnding();
|
||||
BOOL M_DoDeath(int i);
|
||||
BOOL M_DoSpStand(int i);
|
||||
BOOL M_DoDelay(int i);
|
||||
BOOL M_DoStone(int i);
|
||||
void M_WalkDir(int i, int md);
|
||||
void GroupUnity(int i);
|
||||
BOOL M_CallWalk(int i, int md);
|
||||
BOOL M_PathWalk(int i);
|
||||
BOOL M_CallWalk2(int i, int md);
|
||||
BOOL M_DumbWalk(int i, int md);
|
||||
BOOL M_RoundWalk(int i, int md, int *dir);
|
||||
void MAI_Zombie(int i);
|
||||
void MAI_SkelSd(int i);
|
||||
BOOL MAI_Path(int i);
|
||||
void MAI_Snake(int i);
|
||||
void MAI_Bat(int i);
|
||||
void MAI_SkelBow(int i);
|
||||
|
|
@ -152,7 +88,6 @@ void mai_roundranged_441EA0(int i);
|
|||
#endif
|
||||
void MAI_Acid(int i);
|
||||
void MAI_Diablo(int i);
|
||||
void MAI_RR2(int i, int mistype, int dam);
|
||||
void MAI_Mega(int i);
|
||||
void MAI_Golum(int i);
|
||||
void MAI_SkelKing(int i);
|
||||
|
|
@ -191,7 +126,6 @@ BOOL PosOkMonst3(int i, int x, int y);
|
|||
BOOL IsSkel(int mt);
|
||||
BOOL IsGoat(int mt);
|
||||
int M_SpawnSkel(int x, int y, int dir);
|
||||
void ActivateSpawn(int i, int x, int y, int dir);
|
||||
BOOL SpawnSkeleton(int ii, int x, int y);
|
||||
int PreSpawnSkeleton();
|
||||
void TalktoMonster(int i);
|
||||
|
|
@ -201,30 +135,12 @@ BOOL CheckMonsterHit(int m, BOOL *ret);
|
|||
int encode_enemy(int m);
|
||||
void decode_enemy(int m, int enemy);
|
||||
|
||||
/* rdata */
|
||||
|
||||
extern const char plr2monst[9];
|
||||
extern const BYTE counsmiss[4];
|
||||
|
||||
/* data */
|
||||
|
||||
extern int MWVel[24][3];
|
||||
extern char animletter[7];
|
||||
extern int left[8];
|
||||
extern int right[8];
|
||||
extern int opposite[8];
|
||||
extern int offset_x[8];
|
||||
extern int offset_y[8];
|
||||
|
||||
/** unused */
|
||||
extern int rnd5[4];
|
||||
extern int rnd10[4];
|
||||
extern int rnd20[4];
|
||||
extern int rnd60[4];
|
||||
//
|
||||
|
||||
extern void (*AiProc[])(int i);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@ extern BOOL loop_movie;
|
|||
void play_movie(const char *pszMovie, BOOL user_can_close);
|
||||
void MovieWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
/* rdata */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -347,23 +347,26 @@ bool ReadMPQHeader(Archive *archive, _FILEHEADER *hdr)
|
|||
|
||||
} // namespace
|
||||
|
||||
void mpqapi_remove_hash_entry(const char *pszName)
|
||||
static _BLOCKENTRY *mpqapi_new_block(int *block_index)
|
||||
{
|
||||
_HASHENTRY *pHashTbl;
|
||||
_BLOCKENTRY *blockEntry;
|
||||
int hIdx, block_offset, block_size;
|
||||
DWORD i;
|
||||
|
||||
hIdx = FetchHandle(pszName);
|
||||
if (hIdx != -1) {
|
||||
pHashTbl = &cur_archive.sgpHashTbl[hIdx];
|
||||
blockEntry = &cur_archive.sgpBlockTbl[pHashTbl->block];
|
||||
pHashTbl->block = -2;
|
||||
block_offset = blockEntry->offset;
|
||||
block_size = blockEntry->sizealloc;
|
||||
memset(blockEntry, 0, sizeof(*blockEntry));
|
||||
mpqapi_alloc_block(block_offset, block_size);
|
||||
cur_archive.modified = true;
|
||||
blockEntry = cur_archive.sgpBlockTbl;
|
||||
|
||||
i = 0;
|
||||
while (blockEntry->offset || blockEntry->sizealloc || blockEntry->flags || blockEntry->sizefile) {
|
||||
i++;
|
||||
blockEntry++;
|
||||
if (i >= 2048) {
|
||||
app_fatal("Out of free block entries");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (block_index)
|
||||
*block_index = i;
|
||||
|
||||
return blockEntry;
|
||||
}
|
||||
|
||||
void mpqapi_alloc_block(uint32_t block_offset, uint32_t block_size)
|
||||
|
|
@ -405,34 +408,38 @@ void mpqapi_alloc_block(uint32_t block_offset, uint32_t block_size)
|
|||
}
|
||||
}
|
||||
|
||||
_BLOCKENTRY *mpqapi_new_block(int *block_index)
|
||||
int mpqapi_find_free_block(uint32_t size, uint32_t *block_size)
|
||||
{
|
||||
_BLOCKENTRY *blockEntry;
|
||||
DWORD i;
|
||||
_BLOCKENTRY *pBlockTbl;
|
||||
int i, result;
|
||||
|
||||
blockEntry = cur_archive.sgpBlockTbl;
|
||||
|
||||
i = 0;
|
||||
while (blockEntry->offset || blockEntry->sizealloc || blockEntry->flags || blockEntry->sizefile) {
|
||||
i++;
|
||||
blockEntry++;
|
||||
if (i >= 2048) {
|
||||
app_fatal("Out of free block entries");
|
||||
return NULL;
|
||||
pBlockTbl = cur_archive.sgpBlockTbl;
|
||||
i = 2048;
|
||||
while (1) {
|
||||
i--;
|
||||
if (pBlockTbl->offset && !pBlockTbl->flags && !pBlockTbl->sizefile && (DWORD)pBlockTbl->sizealloc >= size)
|
||||
break;
|
||||
pBlockTbl++;
|
||||
if (!i) {
|
||||
*block_size = size;
|
||||
result = cur_archive.size;
|
||||
cur_archive.size += size;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
if (block_index)
|
||||
*block_index = i;
|
||||
|
||||
return blockEntry;
|
||||
result = pBlockTbl->offset;
|
||||
*block_size = size;
|
||||
pBlockTbl->offset += size;
|
||||
pBlockTbl->sizealloc -= size;
|
||||
|
||||
if (!pBlockTbl->sizealloc)
|
||||
memset(pBlockTbl, 0, sizeof(*pBlockTbl));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int FetchHandle(const char *pszName)
|
||||
{
|
||||
return mpqapi_get_hash_index(Hash(pszName, 0), Hash(pszName, 1), Hash(pszName, 2), 0);
|
||||
}
|
||||
|
||||
int mpqapi_get_hash_index(short index, int hash_a, int hash_b, int locale)
|
||||
static int mpqapi_get_hash_index(short index, int hash_a, int hash_b, int locale)
|
||||
{
|
||||
int idx, i;
|
||||
|
||||
|
|
@ -449,6 +456,30 @@ int mpqapi_get_hash_index(short index, int hash_a, int hash_b, int locale)
|
|||
return -1;
|
||||
}
|
||||
|
||||
static int FetchHandle(const char *pszName)
|
||||
{
|
||||
return mpqapi_get_hash_index(Hash(pszName, 0), Hash(pszName, 1), Hash(pszName, 2), 0);
|
||||
}
|
||||
|
||||
void mpqapi_remove_hash_entry(const char *pszName)
|
||||
{
|
||||
_HASHENTRY *pHashTbl;
|
||||
_BLOCKENTRY *blockEntry;
|
||||
int hIdx, block_offset, block_size;
|
||||
|
||||
hIdx = FetchHandle(pszName);
|
||||
if (hIdx != -1) {
|
||||
pHashTbl = &cur_archive.sgpHashTbl[hIdx];
|
||||
blockEntry = &cur_archive.sgpBlockTbl[pHashTbl->block];
|
||||
pHashTbl->block = -2;
|
||||
block_offset = blockEntry->offset;
|
||||
block_size = blockEntry->sizealloc;
|
||||
memset(blockEntry, 0, sizeof(*blockEntry));
|
||||
mpqapi_alloc_block(block_offset, block_size);
|
||||
cur_archive.modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
void mpqapi_remove_hash_entries(BOOL (*fnGetName)(DWORD, char *))
|
||||
{
|
||||
DWORD dwIndex, i;
|
||||
|
|
@ -460,21 +491,7 @@ void mpqapi_remove_hash_entries(BOOL (*fnGetName)(DWORD, char *))
|
|||
}
|
||||
}
|
||||
|
||||
BOOL mpqapi_write_file(const char *pszName, const BYTE *pbData, DWORD dwLen)
|
||||
{
|
||||
_BLOCKENTRY *blockEntry;
|
||||
|
||||
cur_archive.modified = true;
|
||||
mpqapi_remove_hash_entry(pszName);
|
||||
blockEntry = mpqapi_add_file(pszName, 0, 0);
|
||||
if (!mpqapi_write_file_contents(pszName, pbData, dwLen, blockEntry)) {
|
||||
mpqapi_remove_hash_entry(pszName);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
_BLOCKENTRY *mpqapi_add_file(const char *pszName, _BLOCKENTRY *pBlk, int block_index)
|
||||
static _BLOCKENTRY *mpqapi_add_file(const char *pszName, _BLOCKENTRY *pBlk, int block_index)
|
||||
{
|
||||
DWORD h1, h2, h3;
|
||||
int i, hIdx;
|
||||
|
|
@ -504,7 +521,7 @@ _BLOCKENTRY *mpqapi_add_file(const char *pszName, _BLOCKENTRY *pBlk, int block_i
|
|||
return pBlk;
|
||||
}
|
||||
|
||||
BOOL mpqapi_write_file_contents(const char *pszName, const BYTE *pbData, DWORD dwLen, _BLOCKENTRY *pBlk)
|
||||
static BOOL mpqapi_write_file_contents(const char *pszName, const BYTE *pbData, DWORD dwLen, _BLOCKENTRY *pBlk)
|
||||
{
|
||||
const char *str_ptr = pszName;
|
||||
const char *tmp;
|
||||
|
|
@ -586,35 +603,18 @@ BOOL mpqapi_write_file_contents(const char *pszName, const BYTE *pbData, DWORD d
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
int mpqapi_find_free_block(uint32_t size, uint32_t *block_size)
|
||||
BOOL mpqapi_write_file(const char *pszName, const BYTE *pbData, DWORD dwLen)
|
||||
{
|
||||
_BLOCKENTRY *pBlockTbl;
|
||||
int i, result;
|
||||
_BLOCKENTRY *blockEntry;
|
||||
|
||||
pBlockTbl = cur_archive.sgpBlockTbl;
|
||||
i = 2048;
|
||||
while (1) {
|
||||
i--;
|
||||
if (pBlockTbl->offset && !pBlockTbl->flags && !pBlockTbl->sizefile && (DWORD)pBlockTbl->sizealloc >= size)
|
||||
break;
|
||||
pBlockTbl++;
|
||||
if (!i) {
|
||||
*block_size = size;
|
||||
result = cur_archive.size;
|
||||
cur_archive.size += size;
|
||||
return result;
|
||||
}
|
||||
cur_archive.modified = true;
|
||||
mpqapi_remove_hash_entry(pszName);
|
||||
blockEntry = mpqapi_add_file(pszName, 0, 0);
|
||||
if (!mpqapi_write_file_contents(pszName, pbData, dwLen, blockEntry)) {
|
||||
mpqapi_remove_hash_entry(pszName);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
result = pBlockTbl->offset;
|
||||
*block_size = size;
|
||||
pBlockTbl->offset += size;
|
||||
pBlockTbl->sizealloc -= size;
|
||||
|
||||
if (!pBlockTbl->sizealloc)
|
||||
memset(pBlockTbl, 0, sizeof(*pBlockTbl));
|
||||
|
||||
return result;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void mpqapi_rename(char *pszOld, char *pszNew)
|
||||
|
|
|
|||
|
|
@ -15,22 +15,13 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
void mpqapi_remove_hash_entry(const char *pszName);
|
||||
void mpqapi_alloc_block(uint32_t block_offset, uint32_t block_size);
|
||||
_BLOCKENTRY *mpqapi_new_block(int *block_index);
|
||||
int FetchHandle(const char *pszName);
|
||||
int mpqapi_get_hash_index(short index, int hash_a, int hash_b, int locale);
|
||||
void mpqapi_remove_hash_entries(BOOL (*fnGetName)(DWORD, char *));
|
||||
BOOL mpqapi_write_file(const char *pszName, const BYTE *pbData, DWORD dwLen);
|
||||
_BLOCKENTRY *mpqapi_add_file(const char *pszName, _BLOCKENTRY *pBlk, int block_index);
|
||||
BOOL mpqapi_write_file_contents(const char *pszName, const BYTE *pbData, DWORD dwLen, _BLOCKENTRY *pBlk);
|
||||
int mpqapi_find_free_block(uint32_t size, uint32_t *block_size);
|
||||
void mpqapi_rename(char *pszOld, char *pszNew);
|
||||
BOOL mpqapi_has_file(const char *pszName);
|
||||
BOOL OpenMPQ(const char *pszArchive, DWORD dwChar);
|
||||
BOOL mpqapi_flush_and_close(const char *pszArchive, BOOL bFree, DWORD dwChar);
|
||||
/* rdata */
|
||||
|
||||
/* data */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue