Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package devilutionx for openSUSE:Factory:NonFree checked in at 2021-04-15 16:55:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory:NonFree/devilutionx (Old) and /work/SRC/openSUSE:Factory:NonFree/.devilutionx.new.12324 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "devilutionx" Thu Apr 15 16:55:50 2021 rev:4 rq:885062 version:1.2.1 Changes: -------- --- /work/SRC/openSUSE:Factory:NonFree/devilutionx/devilutionx.changes 2021-04-08 21:00:22.157784233 +0200 +++ /work/SRC/openSUSE:Factory:NonFree/.devilutionx.new.12324/devilutionx.changes 2021-04-15 16:55:50.426524593 +0200 @@ -1,0 +2,21 @@ +Tue Apr 13 12:48:17 UTC 2021 - Martin Hauke <mar...@gmx.de> + +- Update to version 1.2.1 + Gameplay + * Gharbad not having to go out of vision before progressing his + quest + * Diablo: Items with negative AC morphing in multiplayer + * Diablo: Griswold and Wirt selling unusually expensive items + * Diablo: Gold not going directly to inventory + * Hellfire: Some monsters having lower than intended HP + * Hellfire: Auric Amulet not taking effect in most scenarios + Stability / Performance / System + * Quest panel crashing the game for some quests + Bugfixes for original Hellfire bugs + Gameplay + * Rage/Search/Lightningwall not factoring in the hero level for + the first player + * Sparkling Shrine dealing an incorrect amount of damage + * Items with negative AC morphing in multiplayer + +------------------------------------------------------------------- Old: ---- devilutionx-1.2.0.tar.gz New: ---- devilutionx-1.2.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ devilutionx.spec ++++++ --- /var/tmp/diff_new_pack.rL3mQl/_old 2021-04-15 16:55:51.086525638 +0200 +++ /var/tmp/diff_new_pack.rL3mQl/_new 2021-04-15 16:55:51.090525644 +0200 @@ -18,7 +18,7 @@ Name: devilutionx -Version: 1.2.0 +Version: 1.2.1 Release: 0 Summary: An open source implementation of the Diablo 1 game engine # 3rdParty/asio/* is licensed under BSL-1.0 ++++++ devilutionx-1.2.0.tar.gz -> devilutionx-1.2.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/devilutionX-1.2.0/CMakeLists.txt new/devilutionX-1.2.1/CMakeLists.txt --- old/devilutionX-1.2.0/CMakeLists.txt 2021-04-06 07:51:05.000000000 +0200 +++ new/devilutionX-1.2.1/CMakeLists.txt 2021-04-12 23:07:44.000000000 +0200 @@ -354,6 +354,11 @@ SourceX/platform/switch/docking.cpp) set(BIN_TARGET devilutionx.elf) endif() + +if(VITA) + list(APPEND devilutionx_SRCS + SourceX/platform/vita/keyboard.cpp) +endif() if(N3DS) list(APPEND devilutionx_SRCS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/devilutionX-1.2.0/Packaging/OpenDingux/build.sh new/devilutionX-1.2.1/Packaging/OpenDingux/build.sh --- old/devilutionX-1.2.0/Packaging/OpenDingux/build.sh 2021-04-06 07:51:05.000000000 +0200 +++ new/devilutionX-1.2.1/Packaging/OpenDingux/build.sh 2021-04-12 23:07:44.000000000 +0200 @@ -72,6 +72,7 @@ cmake .. -DBINARY_RELEASE=ON "-DTARGET_PLATFORM=$TARGET" \ -DCMAKE_TOOLCHAIN_FILE="$BUILDROOT/output/host/usr/share/buildroot/toolchainfile.cmake" make -j $(getconf _NPROCESSORS_ONLN) + "${TOOLCHAIN}/bin/"*-linux-strip devilutionx cd - } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/devilutionX-1.2.0/Source/diablo.cpp new/devilutionX-1.2.1/Source/diablo.cpp --- old/devilutionX-1.2.0/Source/diablo.cpp 2021-04-06 07:51:05.000000000 +0200 +++ new/devilutionX-1.2.1/Source/diablo.cpp 2021-04-12 23:07:44.000000000 +0200 @@ -568,6 +568,8 @@ if (forceDiablo) gbIsHellfire = false; + gbIsHellfireSaveGame = gbIsHellfire; + UiInitialize(); UiSetSpawned(gbIsSpawn); was_ui_init = true; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/devilutionX-1.2.0/Source/inv.cpp new/devilutionX-1.2.1/Source/inv.cpp --- old/devilutionX-1.2.0/Source/inv.cpp 2021-04-06 07:51:05.000000000 +0200 +++ new/devilutionX-1.2.1/Source/inv.cpp 2021-04-12 23:07:44.000000000 +0200 @@ -1409,15 +1409,15 @@ il--; gt = plr[pnum].InvList[il]._ivalue; ig = plr[pnum].HoldItem._ivalue + gt; - if (ig <= GOLD_MAX_LIMIT) { + if (ig <= MaxGold) { plr[pnum].InvList[il]._ivalue = ig; plr[pnum]._pGold += plr[pnum].HoldItem._ivalue; SetPlrHandGoldCurs(&plr[pnum].InvList[il]); } else { - ig = GOLD_MAX_LIMIT - gt; + ig = MaxGold - gt; plr[pnum]._pGold += ig; plr[pnum].HoldItem._ivalue -= ig; - plr[pnum].InvList[il]._ivalue = GOLD_MAX_LIMIT; + plr[pnum].InvList[il]._ivalue = MaxGold; plr[pnum].InvList[il]._iCurs = ICURS_GOLD_LARGE; // BUGFIX: incorrect values here are leftover from beta (fixed) cn = GetGoldCursor(plr[pnum].HoldItem._ivalue); @@ -1475,15 +1475,15 @@ if (!plr[pnum].SpdList[ii].isEmpty()) { if (plr[pnum].SpdList[ii]._itype == ITYPE_GOLD) { i = plr[pnum].HoldItem._ivalue + plr[pnum].SpdList[ii]._ivalue; - if (i <= GOLD_MAX_LIMIT) { + if (i <= MaxGold) { plr[pnum].SpdList[ii]._ivalue = i; plr[pnum]._pGold += plr[pnum].HoldItem._ivalue; SetPlrHandGoldCurs(&plr[pnum].SpdList[ii]); } else { - i = GOLD_MAX_LIMIT - plr[pnum].SpdList[ii]._ivalue; + i = MaxGold - plr[pnum].SpdList[ii]._ivalue; plr[pnum]._pGold += i; plr[pnum].HoldItem._ivalue -= i; - plr[pnum].SpdList[ii]._ivalue = GOLD_MAX_LIMIT; + plr[pnum].SpdList[ii]._ivalue = MaxGold; plr[pnum].SpdList[ii]._iCurs = ICURS_GOLD_LARGE; // BUGFIX: incorrect values here are leftover from beta (fixed) @@ -2140,7 +2140,7 @@ CheckBookLevel(pnum); CheckItemStats(pnum); bool cursor_updated = false; - if (gbIsHellfire && plr[pnum].HoldItem._itype == ITYPE_GOLD && GoldAutoPlace(pnum)) + if (plr[pnum].HoldItem._itype == ITYPE_GOLD && GoldAutoPlace(pnum)) cursor_updated = true; CleanupItems(ii); pcursitem = -1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/devilutionX-1.2.0/Source/items.cpp new/devilutionX-1.2.1/Source/items.cpp --- old/devilutionX-1.2.0/Source/items.cpp 2021-04-06 07:51:05.000000000 +0200 +++ new/devilutionX-1.2.1/Source/items.cpp 2021-04-12 23:07:44.000000000 +0200 @@ -4616,6 +4616,7 @@ static void SpawnOnePremium(int i, int plvl, int myplr) { int ivalue; + bool keepgoing = false; ItemStruct holditem = item[0]; int strength = get_max_strength(plr[myplr]._pClass); @@ -4644,6 +4645,7 @@ int count = 0; do { + keepgoing = false; memset(&item[0], 0, sizeof(*item)); item[0]._iSeed = AdvanceRndSeed(); SetRndSeed(item[0]._iSeed); @@ -4652,8 +4654,10 @@ GetItemBonus(0, itype, plvl >> 1, plvl, TRUE, !gbIsHellfire); if (!gbIsHellfire) { - if (item[0]._iIvalue > 140000) + if (item[0]._iIvalue > 140000) { + keepgoing = true; // prevent breaking the do/while loop too early by failing hellfire's condition in while continue; + } break; } @@ -4697,12 +4701,12 @@ ivalue *= 0.8; count++; - } while ((item[0]._iIvalue > 200000 + } while (keepgoing || ((item[0]._iIvalue > 200000 || item[0]._iMinStr > strength || item[0]._iMinMag > magic || item[0]._iMinDex > dexterity || item[0]._iIvalue < ivalue) - && count < 150); + && count < 150)); premiumitem[i] = item[0]; premiumitem[i]._iCreateInfo = plvl | CF_SMITHPREMIUM; premiumitem[i]._iIdentified = TRUE; @@ -4950,6 +4954,7 @@ int itype; int ivalue; + bool keepgoing = false; int count = 0; int strength = get_max_strength(plr[myplr]._pClass); @@ -4974,6 +4979,7 @@ if (boylevel < (lvl >> 1) || boyitem.isEmpty()) { do { + keepgoing = false; memset(&item[0], 0, sizeof(*item)); item[0]._iSeed = AdvanceRndSeed(); SetRndSeed(item[0]._iSeed); @@ -4982,8 +4988,10 @@ GetItemBonus(0, itype, lvl, 2 * lvl, TRUE, TRUE); if (!gbIsHellfire) { - if (item[0]._iIvalue > 140000) + if (item[0]._iIvalue > 90000) { + keepgoing = true; // prevent breaking the do/while loop too early by failing hellfire's condition in while continue; + } break; } @@ -5059,12 +5067,12 @@ break; } } - } while ((item[0]._iIvalue > 200000 + } while (keepgoing || ((item[0]._iIvalue > 200000 || item[0]._iMinStr > strength || item[0]._iMinMag > magic || item[0]._iMinDex > dexterity || item[0]._iIvalue < ivalue) - && count < 250); + && count < 250)); boyitem = item[0]; boyitem._iCreateInfo = lvl | CF_BOY; boyitem._iIdentified = TRUE; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/devilutionX-1.2.0/Source/lighting.cpp new/devilutionX-1.2.1/Source/lighting.cpp --- old/devilutionX-1.2.0/Source/lighting.cpp 2021-04-06 07:51:05.000000000 +0200 +++ new/devilutionX-1.2.1/Source/lighting.cpp 2021-04-12 23:07:44.000000000 +0200 @@ -643,6 +643,7 @@ int i, j, x1, y1, x2, y2; nRadius++; + nRadius++; // increasing the radius even further here prevents leaving stray vision tiles behind and doesn't seem to affect monster AI - applying new vision happens in the same tick y1 = nYPos - nRadius; y2 = nYPos + nRadius; x1 = nXPos - nRadius; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/devilutionX-1.2.0/Source/loadsave.cpp new/devilutionX-1.2.1/Source/loadsave.cpp --- old/devilutionX-1.2.0/Source/loadsave.cpp 2021-04-06 07:51:05.000000000 +0200 +++ new/devilutionX-1.2.1/Source/loadsave.cpp 2021-04-12 23:07:44.000000000 +0200 @@ -739,7 +739,7 @@ file->skip(2); // Alignment pQuest->_qmsg = file->nextLE<Sint32>(); } else { - pQuest->_qmsg = file->nextLE<Sint8>(); + pQuest->_qmsg = file->nextLE<Uint8>(); } pQuest->_qvar1 = file->nextLE<Uint8>(); pQuest->_qvar2 = file->nextLE<Uint8>(); @@ -965,7 +965,7 @@ void RemoveEmptyLevelItems() { - for (int i = numitems; i >= 0; i--) { + for (int i = numitems; i > 0; i--) { int ii = itemactive[i]; if (item[ii].isEmpty()) { dItem[item[ii]._ix][item[ii]._iy] = 0; @@ -1690,7 +1690,7 @@ file->skip(2); // Alignment file->writeLE<Sint32>(pQuest->_qmsg); } else { - file->writeLE<Sint8>(pQuest->_qmsg); + file->writeLE<Uint8>(pQuest->_qmsg); } file->writeLE<Uint8>(pQuest->_qvar1); file->writeLE<Uint8>(pQuest->_qvar2); @@ -1741,7 +1741,7 @@ void SaveHeroItems(PlayerStruct *pPlayer) { size_t items = NUM_INVLOC + NUM_INV_GRID_ELEM + MAXBELTITEMS; - SaveHelper file("heroitems", items * (gbIsHellfire ? HellfireItemSaveSize : DiabloItemSaveSize)); + SaveHelper file("heroitems", items * (gbIsHellfire ? HellfireItemSaveSize : DiabloItemSaveSize) + sizeof(Uint8)); file.writeLE<Uint8>(gbIsHellfire); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/devilutionX-1.2.0/Source/missiles.cpp new/devilutionX-1.2.1/Source/missiles.cpp --- old/devilutionX-1.2.0/Source/missiles.cpp 2021-04-06 07:51:05.000000000 +0200 +++ new/devilutionX-1.2.1/Source/missiles.cpp 2021-04-12 23:07:44.000000000 +0200 @@ -1904,7 +1904,7 @@ if (mienemy == TARGET_MONSTERS && id != -1) { missile[mi]._midam = 0; int lvl = 2; - if (id > 0) + if (id > -1) lvl = plr[id]._pLevel * 2; missile[mi]._mirange = lvl + 10 * missile[mi]._mispllvl + 245; } @@ -1978,7 +1978,7 @@ missile[mi]._miVar8 = 0; AutoMapShowItems = TRUE; int lvl = 2; - if (id > 0) + if (id > -1) lvl = plr[id]._pLevel * 2; missile[mi]._mirange = lvl + 10 * missile[mi]._mispllvl + 245; if (mienemy == TARGET_MONSTERS) @@ -2506,8 +2506,8 @@ { int i; - if (mienemy == TARGET_MONSTERS) { - if (id != -1) { + if (id != -1) { + if (mienemy == TARGET_MONSTERS) { missile[mi]._midam = 0; for (i = 0; i <= plr[id]._pLevel; i++) { missile[mi]._midam += random_(55, 20) + 1; @@ -2518,10 +2518,10 @@ missile[mi]._midam += missile[mi]._midam >> 1; UseMana(id, SPL_FLASH); } else { - missile[mi]._midam = currlevel >> 1; + missile[mi]._midam = monster[id].mLevel << 1; } } else { - missile[mi]._midam = monster[id].mLevel << 1; + missile[mi]._midam = currlevel >> 1; } missile[mi]._mirange = 19; } @@ -3105,7 +3105,7 @@ plr[id]._pSpellFlags |= 2u; missile[mi]._miVar2 = tmp; int lvl = 2; - if (id > 0) + if (id > -1) lvl = plr[id]._pLevel * 2; missile[mi]._mirange = lvl + 10 * missile[mi]._mispllvl + 245; CalcPlrItemVals(id, TRUE); @@ -4301,7 +4301,7 @@ missile[i]._mirange--; int id = missile[i]._misource; int lvl = 0; - if (id > 0) + if (id > -1) lvl = plr[id]._pLevel; int dmg = 16 * (random_(53, 10) + random_(53, 10) + lvl + 2); if (missile[i]._mirange == 0) { @@ -5261,7 +5261,7 @@ plr[id]._pSpellFlags &= ~0x2; plr[id]._pSpellFlags |= 4; int lvl = 2; - if (id > 0) + if (id > -1) lvl = plr[id]._pLevel * 2; missile[i]._mirange = lvl + 10 * missile[i]._mispllvl + 245; hpdif = plr[id]._pMaxHP - plr[id]._pHitPoints; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/devilutionX-1.2.0/Source/monster.h new/devilutionX-1.2.1/Source/monster.h --- old/devilutionX-1.2.0/Source/monster.h 2021-04-06 07:51:05.000000000 +0200 +++ new/devilutionX-1.2.1/Source/monster.h 2021-04-12 23:07:44.000000000 +0200 @@ -44,8 +44,8 @@ TSnd *Snds[4][2]; Sint32 width; Sint32 width2; - Uint8 mMinHP; - Uint8 mMaxHP; + uint16_t mMinHP; + uint16_t mMaxHP; bool has_special; Uint8 mAFNum; Sint8 mdeadval; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/devilutionX-1.2.0/Source/msg.h new/devilutionX-1.2.1/Source/msg.h --- old/devilutionX-1.2.0/Source/msg.h 2021-04-06 07:51:05.000000000 +0200 +++ new/devilutionX-1.2.1/Source/msg.h 2021-04-12 23:07:44.000000000 +0200 @@ -107,7 +107,7 @@ Uint8 bMinStr; Uint8 bMinMag; Uint8 bMinDex; - Uint8 bAC; + Sint16 bAC; } TCmdGItem; typedef struct TCmdPItem { @@ -129,7 +129,7 @@ Uint8 bMinStr; Uint8 bMinMag; Uint8 bMinDex; - Uint8 bAC; + Sint16 bAC; } TCmdPItem; typedef struct TCmdChItem { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/devilutionX-1.2.0/Source/pfile.cpp new/devilutionX-1.2.1/Source/pfile.cpp --- old/devilutionX-1.2.0/Source/pfile.cpp 2021-04-06 07:51:05.000000000 +0200 +++ new/devilutionX-1.2.1/Source/pfile.cpp 2021-04-12 23:07:44.000000000 +0200 @@ -170,9 +170,13 @@ return NULL; } -static void pfile_SFileCloseArchive(HANDLE hsArchive) +static void pfile_SFileCloseArchive(HANDLE *hsArchive) { - SFileCloseArchive(hsArchive); + if (*hsArchive == NULL) + return; + + SFileCloseArchive(*hsArchive); + *hsArchive = NULL; } void pfile_write_hero() @@ -283,6 +287,7 @@ UnPackPlayer(&pkplr, 0, FALSE); + pfile_SFileCloseArchive(&archive); LoadHeroItems(&plr[0]); RemoveEmptyInventory(0); CalcPlrInv(0, FALSE); @@ -290,7 +295,7 @@ game_2_ui_player(plr, &uihero, hasSaveGame); ui_add_hero_info(&uihero); } - pfile_SFileCloseArchive(archive); + pfile_SFileCloseArchive(&archive); } } @@ -408,13 +413,13 @@ if (gbValidSaveFile) pkplr.bIsHellfire = gbIsHellfireSaveGame; + pfile_SFileCloseArchive(&archive); + UnPackPlayer(&pkplr, myplr, FALSE); LoadHeroItems(&plr[myplr]); RemoveEmptyInventory(myplr); CalcPlrInv(myplr, FALSE); - - pfile_SFileCloseArchive(archive); } bool LevelFileExists() @@ -569,7 +574,7 @@ return NULL; buf = pfile_read_archive(archive, pszName, pdwLen); - pfile_SFileCloseArchive(archive); + pfile_SFileCloseArchive(&archive); if (buf == NULL) return NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/devilutionX-1.2.0/Source/player.cpp new/devilutionX-1.2.1/Source/player.cpp --- old/devilutionX-1.2.0/Source/player.cpp 2021-04-06 07:51:05.000000000 +0200 +++ new/devilutionX-1.2.1/Source/player.cpp 2021-04-12 23:07:44.000000000 +0200 @@ -2198,8 +2198,6 @@ switch (variant) { case PM_WALK: dPlayer[plr[pnum]._px][plr[pnum]._py] = 0; - if (leveltype != DTYPE_TOWN && pnum == myplr) - DoUnVision(plr[pnum]._px, plr[pnum]._py, plr[pnum]._pLightRad); // fix for incorrect vision updating plr[pnum]._px += plr[pnum]._pVar1; plr[pnum]._py += plr[pnum]._pVar2; dPlayer[plr[pnum]._px][plr[pnum]._py] = pnum + 1; @@ -2209,8 +2207,6 @@ break; case PM_WALK3: dPlayer[plr[pnum]._px][plr[pnum]._py] = 0; - if (leveltype != DTYPE_TOWN && pnum == myplr) - DoUnVision(plr[pnum]._px, plr[pnum]._py, plr[pnum]._pLightRad); // fix for incorrect vision updating dFlags[plr[pnum]._pVar4][plr[pnum]._pVar5] &= ~BFLAG_PLAYERLR; plr[pnum]._px = plr[pnum]._pVar1; plr[pnum]._py = plr[pnum]._pVar2; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/devilutionX-1.2.0/Source/stores.cpp new/devilutionX-1.2.1/Source/stores.cpp --- old/devilutionX-1.2.0/Source/stores.cpp 2021-04-06 07:51:05.000000000 +0200 +++ new/devilutionX-1.2.1/Source/stores.cpp 2021-04-12 23:07:44.000000000 +0200 @@ -1454,8 +1454,8 @@ int i, sz, cost, numsqrs; cost = storehold[idx]._iIvalue; - sz = cost / GOLD_MAX_LIMIT; - if (cost % GOLD_MAX_LIMIT != 0) + sz = cost / MaxGold; + if (cost % MaxGold != 0) sz++; SetCursor_(storehold[idx]._iCurs + CURSOR_FIRSTITEM); @@ -1471,16 +1471,16 @@ } for (i = 0; i < plr[myplr]._pNumInv; i++) { - if (plr[myplr].InvList[i]._itype == ITYPE_GOLD && plr[myplr].InvList[i]._ivalue != GOLD_MAX_LIMIT) { - if (cost + plr[myplr].InvList[i]._ivalue <= GOLD_MAX_LIMIT) + if (plr[myplr].InvList[i]._itype == ITYPE_GOLD && plr[myplr].InvList[i]._ivalue != MaxGold) { + if (cost + plr[myplr].InvList[i]._ivalue <= MaxGold) cost = 0; else - cost -= GOLD_MAX_LIMIT - plr[myplr].InvList[i]._ivalue; + cost -= MaxGold - plr[myplr].InvList[i]._ivalue; } } - sz = cost / GOLD_MAX_LIMIT; - if (cost % GOLD_MAX_LIMIT) + sz = cost / MaxGold; + if (cost % MaxGold) sz++; return numsqrs >= sz; @@ -1536,22 +1536,22 @@ } plr[myplr]._pGold += cost; for (i = 0; i < plr[myplr]._pNumInv && cost > 0; i++) { - if (plr[myplr].InvList[i]._itype == ITYPE_GOLD && plr[myplr].InvList[i]._ivalue != GOLD_MAX_LIMIT) { - if (cost + plr[myplr].InvList[i]._ivalue <= GOLD_MAX_LIMIT) { + if (plr[myplr].InvList[i]._itype == ITYPE_GOLD && plr[myplr].InvList[i]._ivalue != MaxGold) { + if (cost + plr[myplr].InvList[i]._ivalue <= MaxGold) { plr[myplr].InvList[i]._ivalue += cost; SetGoldCurs(myplr, i); cost = 0; } else { - cost -= GOLD_MAX_LIMIT - plr[myplr].InvList[i]._ivalue; - plr[myplr].InvList[i]._ivalue = GOLD_MAX_LIMIT; + cost -= MaxGold - plr[myplr].InvList[i]._ivalue; + plr[myplr].InvList[i]._ivalue = MaxGold; SetGoldCurs(myplr, i); } } } if (cost > 0) { - while (cost > GOLD_MAX_LIMIT) { - PlaceStoreGold(GOLD_MAX_LIMIT); - cost -= GOLD_MAX_LIMIT; + while (cost > MaxGold) { + PlaceStoreGold(MaxGold); + cost -= MaxGold; } PlaceStoreGold(cost); } @@ -2706,7 +2706,7 @@ plr[myplr]._pGold = CalculateGold(myplr) - cost; for (i = 0; i < MAXBELTITEMS && cost > 0; i++) { - if (plr[myplr].SpdList[i]._itype == ITYPE_GOLD && plr[myplr].SpdList[i]._ivalue != GOLD_MAX_LIMIT) { + if (plr[myplr].SpdList[i]._itype == ITYPE_GOLD && plr[myplr].SpdList[i]._ivalue != MaxGold) { if (cost < plr[myplr].SpdList[i]._ivalue) { plr[myplr].SpdList[i]._ivalue -= cost; SetSpdbarGoldCurs(myplr, i); @@ -2736,7 +2736,7 @@ force_redraw = 255; if (cost > 0) { for (i = 0; i < plr[myplr]._pNumInv && cost > 0; i++) { - if (plr[myplr].InvList[i]._itype == ITYPE_GOLD && plr[myplr].InvList[i]._ivalue != GOLD_MAX_LIMIT) { + if (plr[myplr].InvList[i]._itype == ITYPE_GOLD && plr[myplr].InvList[i]._ivalue != MaxGold) { if (cost < plr[myplr].InvList[i]._ivalue) { plr[myplr].InvList[i]._ivalue -= cost; SetGoldCurs(myplr, i); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/devilutionX-1.2.0/SourceX/DiabloUI/diabloui.cpp new/devilutionX-1.2.1/SourceX/DiabloUI/diabloui.cpp --- old/devilutionX-1.2.0/SourceX/DiabloUI/diabloui.cpp 2021-04-06 07:51:05.000000000 +0200 +++ new/devilutionX-1.2.1/SourceX/DiabloUI/diabloui.cpp 2021-04-12 23:07:44.000000000 +0200 @@ -23,6 +23,10 @@ // for virtual keyboard on Switch #include "platform/switch/keyboard.h" #endif +#ifdef __vita__ +// for virtual keyboard on Vita +#include "platform/vita/keyboard.h" +#endif namespace dvl { @@ -102,6 +106,8 @@ textInputActive = true; #ifdef __SWITCH__ switch_start_text_input("", pItemUIEdit->m_value, pItemUIEdit->m_max_length, /*multiline=*/0); +#elif defined(__vita__) + vita_start_text_input("", pItemUIEdit->m_value, pItemUIEdit->m_max_length); #else SDL_StartTextInput(); #endif @@ -218,6 +224,12 @@ strncat(out_buf, output.c_str(), cnt - strlen(out_buf)); } +void selhero_SetName(char *in_buf, char *out_buf, int cnt) +{ + std::string output = utf8_to_latin1(in_buf); + strncpy(out_buf, output.c_str(), cnt); +} + bool HandleMenuAction(MenuAction menu_action) { switch (menu_action) { @@ -333,7 +345,11 @@ #ifndef USE_SDL1 case SDL_TEXTINPUT: if (textInputActive) { +#ifdef __vita__ + selhero_SetName(event->text.text, UiTextInput, UiTextInputLen); +#else selhero_CatToName(event->text.text, UiTextInput, UiTextInputLen); +#endif } return; #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/devilutionX-1.2.0/SourceX/display.cpp new/devilutionX-1.2.1/SourceX/display.cpp --- old/devilutionX-1.2.0/SourceX/display.cpp 2021-04-06 07:51:05.000000000 +0200 +++ new/devilutionX-1.2.1/SourceX/display.cpp 2021-04-12 23:07:44.000000000 +0200 @@ -125,9 +125,15 @@ SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0"); #endif - int initFlags = SDL_INIT_EVERYTHING & ~SDL_INIT_HAPTIC; -#ifdef __3DS__ - initFlags = SDL_INIT_TIMER | SDL_INIT_VIDEO | SDL_INIT_JOYSTICK; +#ifdef _WIN32 + // The default WASAPI backend causes distortions + // https://github.com/diasurgical/devilutionX/issues/1434 + SDL_setenv("SDL_AUDIODRIVER", "winmm", /*overwrite=*/false); +#endif + + int initFlags = SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_JOYSTICK; +#ifndef USE_SDL1 + initFlags |= SDL_INIT_GAMECONTROLLER; #endif if (SDL_Init(initFlags) <= -1) { ErrSdl(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/devilutionX-1.2.0/SourceX/platform/vita/keyboard.cpp new/devilutionX-1.2.1/SourceX/platform/vita/keyboard.cpp --- old/devilutionX-1.2.0/SourceX/platform/vita/keyboard.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/devilutionX-1.2.1/SourceX/platform/vita/keyboard.cpp 2021-04-12 23:07:44.000000000 +0200 @@ -0,0 +1,120 @@ +#include <string.h> +#include <stdbool.h> + +#include <SDL.h> +#include <psp2/types.h> +#include <psp2/ime_dialog.h> +#include "platform/vita/keyboard.h" + +static void utf16_to_utf8(const uint16_t *src, uint8_t *dst) +{ + int i; + for (i = 0; src[i]; i++) { + if ((src[i] & 0xFF80) == 0) { + *(dst++) = src[i] & 0xFF; + } else if((src[i] & 0xF800) == 0) { + *(dst++) = ((src[i] >> 6) & 0xFF) | 0xC0; + *(dst++) = (src[i] & 0x3F) | 0x80; + } else if((src[i] & 0xFC00) == 0xD800 && (src[i + 1] & 0xFC00) == 0xDC00) { + *(dst++) = (((src[i] + 64) >> 8) & 0x3) | 0xF0; + *(dst++) = (((src[i] >> 2) + 16) & 0x3F) | 0x80; + *(dst++) = ((src[i] >> 4) & 0x30) | 0x80 | ((src[i + 1] << 2) & 0xF); + *(dst++) = (src[i + 1] & 0x3F) | 0x80; + i += 1; + } else { + *(dst++) = ((src[i] >> 12) & 0xF) | 0xE0; + *(dst++) = ((src[i] >> 6) & 0x3F) | 0x80; + *(dst++) = (src[i] & 0x3F) | 0x80; + } + } + + *dst = '\0'; +} + +static void utf8_to_utf16(const uint8_t *src, uint16_t *dst) +{ + int i; + for (i = 0; src[i];) { + if ((src[i] & 0xE0) == 0xE0) { + *(dst++) = ((src[i] & 0x0F) << 12) | ((src[i + 1] & 0x3F) << 6) | (src[i + 2] & 0x3F); + i += 3; + } else if ((src[i] & 0xC0) == 0xC0) { + *(dst++) = ((src[i] & 0x1F) << 6) | (src[i + 1] & 0x3F); + i += 2; + } else { + *(dst++) = src[i]; + i += 1; + } + } + + *dst = '\0'; +} + +static int vita_input_thread(void *ime_buffer) +{ + while(1) { + // update IME status. Terminate, if finished + SceCommonDialogStatus dialogStatus = sceImeDialogGetStatus(); + if (dialogStatus == SCE_COMMON_DIALOG_STATUS_FINISHED) { + uint8_t utf8_buffer[SCE_IME_DIALOG_MAX_TEXT_LENGTH]; + SceImeDialogResult result; + + SDL_memset(&result, 0, sizeof(SceImeDialogResult)); + sceImeDialogGetResult(&result); + + // Convert UTF16 to UTF8 + utf16_to_utf8((SceWChar16*)ime_buffer, utf8_buffer); + + // send sdl event + SDL_Event event; + event.text.type = SDL_TEXTINPUT; + SDL_utf8strlcpy(event.text.text, (const char*)utf8_buffer, SDL_arraysize(event.text.text)); + SDL_PushEvent(&event); + + sceImeDialogTerm(); + break; + } + } + return 0; +} + +static int vita_keyboard_get(const char *guide_text, const char *initial_text, int max_len, SceWChar16 *buf) +{ + SceWChar16 title[SCE_IME_DIALOG_MAX_TITLE_LENGTH]; + SceWChar16 text[SCE_IME_DIALOG_MAX_TEXT_LENGTH]; + SceInt32 res; + + SDL_memset(&title, 0, sizeof(title)); + SDL_memset(&text, 0, sizeof(text)); + utf8_to_utf16((const uint8_t*)guide_text, title); + utf8_to_utf16((const uint8_t*)initial_text, text); + + SceImeDialogParam param; + sceImeDialogParamInit(¶m); + + param.supportedLanguages = SCE_IME_LANGUAGE_ENGLISH; + param.languagesForced = SCE_FALSE; + param.type = SCE_IME_TYPE_DEFAULT; + param.option = 0; + param.textBoxMode = SCE_IME_DIALOG_TEXTBOX_MODE_WITH_CLEAR; + param.maxTextLength = max_len; + + param.title = title; + param.initialText = text; + param.inputTextBuffer = buf; + + res = sceImeDialogInit(¶m); + if (res < 0) { + return 0; + } + + return 1; +} + +void vita_start_text_input(const char *guide_text, const char *initial_text, int max_length) +{ + SceWChar16 ime_buffer[SCE_IME_DIALOG_MAX_TEXT_LENGTH]; + if (vita_keyboard_get(guide_text, initial_text, max_length, ime_buffer)) { + SDL_CreateThread(vita_input_thread, "vita_input_thread", (void *)ime_buffer); + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/devilutionX-1.2.0/SourceX/platform/vita/keyboard.h new/devilutionX-1.2.1/SourceX/platform/vita/keyboard.h --- old/devilutionX-1.2.0/SourceX/platform/vita/keyboard.h 1970-01-01 01:00:00.000000000 +0100 +++ new/devilutionX-1.2.1/SourceX/platform/vita/keyboard.h 2021-04-12 23:07:44.000000000 +0200 @@ -0,0 +1,3 @@ +#pragma once + +void vita_start_text_input(const char *guide_text, const char *initial_text, int max_length);