Reconcile with reference edition

This commit is contained in:
Alexander Batalov 2022-06-05 01:01:49 +03:00
parent 2991877b13
commit a3390819d1
7 changed files with 71 additions and 25 deletions

View File

@ -40,8 +40,8 @@ int _action_in_explode = 0;
const int gNormalDeathAnimations[DAMAGE_TYPE_COUNT] = { const int gNormalDeathAnimations[DAMAGE_TYPE_COUNT] = {
ANIM_DANCING_AUTOFIRE, ANIM_DANCING_AUTOFIRE,
ANIM_SLICED_IN_HALF, ANIM_SLICED_IN_HALF,
ANIM_CHUNKS_OF_FLESH, ANIM_CHARRED_BODY,
ANIM_CHUNKS_OF_FLESH, ANIM_CHARRED_BODY,
ANIM_ELECTRIFY, ANIM_ELECTRIFY,
ANIM_FALL_BACK, ANIM_FALL_BACK,
ANIM_BIG_HOLE, ANIM_BIG_HOLE,

View File

@ -1726,7 +1726,7 @@ int _make_straight_path_func(Object* a1, int from, int to, STRUCT_530014_28* a4,
int tileY = fromY; int tileY = fromY;
int pathNodeIndex = 0; int pathNodeIndex = 0;
int v50 = from; int prevTile = from;
int v22 = 0; int v22 = 0;
int tile; int tile;
@ -1770,7 +1770,7 @@ int _make_straight_path_func(Object* a1, int from, int to, STRUCT_530014_28* a4,
tileY += stepY; tileY += stepY;
middle += v48; middle += v48;
if (tile != v50) { if (tile != prevTile) {
if (a5 != NULL) { if (a5 != NULL) {
Object* obj = a7(a1, tile, a1->elevation); Object* obj = a7(a1, tile, a1->elevation);
if (obj != NULL) { if (obj != NULL) {
@ -1780,7 +1780,7 @@ int _make_straight_path_func(Object* a1, int from, int to, STRUCT_530014_28* a4,
} }
} }
} }
v50 = tile; prevTile = tile;
} }
} }
} else { } else {
@ -1823,7 +1823,7 @@ int _make_straight_path_func(Object* a1, int from, int to, STRUCT_530014_28* a4,
tileX += stepX; tileX += stepX;
middle += v47; middle += v47;
if (tile != v50) { if (tile != prevTile) {
if (a5 != NULL) { if (a5 != NULL) {
Object* obj = a7(a1, tile, a1->elevation); Object* obj = a7(a1, tile, a1->elevation);
if (obj != NULL) { if (obj != NULL) {
@ -1833,6 +1833,7 @@ int _make_straight_path_func(Object* a1, int from, int to, STRUCT_530014_28* a4,
} }
} }
} }
prevTile = tile;
} }
} }
} }

View File

@ -5,7 +5,7 @@
#include "sound.h" #include "sound.h"
#include <limits.h> #include <limits.h>
#include <stdlib.h> // qsort #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>

View File

@ -493,7 +493,12 @@ int endgameEndingSlideshowWindowInit()
int windowEndgameEndingX = (screenGetWidth() - ENDGAME_ENDING_WINDOW_WIDTH) / 2; int windowEndgameEndingX = (screenGetWidth() - ENDGAME_ENDING_WINDOW_WIDTH) / 2;
int windowEndgameEndingY = (screenGetHeight() - ENDGAME_ENDING_WINDOW_HEIGHT) / 2; int windowEndgameEndingY = (screenGetHeight() - ENDGAME_ENDING_WINDOW_HEIGHT) / 2;
gEndgameEndingSlideshowWindow = windowCreate(windowEndgameEndingX, windowEndgameEndingY, ENDGAME_ENDING_WINDOW_WIDTH, ENDGAME_ENDING_WINDOW_HEIGHT, _colorTable[0], 4); gEndgameEndingSlideshowWindow = windowCreate(windowEndgameEndingX,
windowEndgameEndingY,
ENDGAME_ENDING_WINDOW_WIDTH,
ENDGAME_ENDING_WINDOW_HEIGHT,
_colorTable[0],
WINDOW_FLAG_0x04);
if (gEndgameEndingSlideshowWindow == -1) { if (gEndgameEndingSlideshowWindow == -1) {
return -1; return -1;
} }

View File

@ -571,7 +571,7 @@ void gameDialogEnter(Object* a1, int a2)
return; return;
} }
if ((a1->pid >> 24) != OBJ_TYPE_ITEM && (a1->pid >> 24) != OBJ_TYPE_CRITTER) { if ((a1->pid >> 24) != OBJ_TYPE_ITEM && (a1->sid >> 24) != SCRIPT_TYPE_SPATIAL) {
MessageListItem messageListItem; MessageListItem messageListItem;
int rc = _action_can_talk_to(gDude, a1); int rc = _action_can_talk_to(gDude, a1);
@ -1142,7 +1142,12 @@ int gameDialogReviewWindowInit(int* win)
int reviewWindowX = (screenGetWidth() - GAME_DIALOG_REVIEW_WINDOW_WIDTH) / 2; int reviewWindowX = (screenGetWidth() - GAME_DIALOG_REVIEW_WINDOW_WIDTH) / 2;
int reviewWindowY = (screenGetHeight() - GAME_DIALOG_REVIEW_WINDOW_HEIGHT) / 2; int reviewWindowY = (screenGetHeight() - GAME_DIALOG_REVIEW_WINDOW_HEIGHT) / 2;
*win = windowCreate(reviewWindowX, reviewWindowY, GAME_DIALOG_REVIEW_WINDOW_WIDTH, GAME_DIALOG_REVIEW_WINDOW_HEIGHT, 256, WINDOW_FLAG_0x10 | WINDOW_FLAG_0x04); *win = windowCreate(reviewWindowX,
reviewWindowY,
GAME_DIALOG_REVIEW_WINDOW_WIDTH,
GAME_DIALOG_REVIEW_WINDOW_HEIGHT,
256,
WINDOW_FLAG_0x10 | WINDOW_FLAG_0x04);
if (*win == -1) { if (*win == -1) {
return -1; return -1;
} }
@ -1548,7 +1553,12 @@ int _gdProcessInit()
int replyWindowX = (screenGetWidth() - GAME_DIALOG_WINDOW_WIDTH) / 2 + GAME_DIALOG_REPLY_WINDOW_X; int replyWindowX = (screenGetWidth() - GAME_DIALOG_WINDOW_WIDTH) / 2 + GAME_DIALOG_REPLY_WINDOW_X;
int replyWindowY = (screenGetHeight() - GAME_DIALOG_WINDOW_HEIGHT) / 2 + GAME_DIALOG_REPLY_WINDOW_Y; int replyWindowY = (screenGetHeight() - GAME_DIALOG_WINDOW_HEIGHT) / 2 + GAME_DIALOG_REPLY_WINDOW_Y;
gGameDialogReplyWindow = windowCreate(replyWindowX, replyWindowY, GAME_DIALOG_REPLY_WINDOW_WIDTH, GAME_DIALOG_REPLY_WINDOW_HEIGHT, 256, WINDOW_FLAG_0x04); gGameDialogReplyWindow = windowCreate(replyWindowX,
replyWindowY,
GAME_DIALOG_REPLY_WINDOW_WIDTH,
GAME_DIALOG_REPLY_WINDOW_HEIGHT,
256,
WINDOW_FLAG_0x04);
if (gGameDialogReplyWindow == -1) { if (gGameDialogReplyWindow == -1) {
goto err; goto err;
} }
@ -2174,7 +2184,12 @@ int _gdCreateHeadWindow()
int backgroundWindowX = (screenGetWidth() - GAME_DIALOG_WINDOW_WIDTH) / 2; int backgroundWindowX = (screenGetWidth() - GAME_DIALOG_WINDOW_WIDTH) / 2;
int backgroundWindowY = (screenGetHeight() - GAME_DIALOG_WINDOW_HEIGHT) / 2; int backgroundWindowY = (screenGetHeight() - GAME_DIALOG_WINDOW_HEIGHT) / 2;
gGameDialogBackgroundWindow = windowCreate(backgroundWindowX, backgroundWindowY, windowWidth, GAME_DIALOG_WINDOW_HEIGHT, 256, WINDOW_FLAG_0x02); gGameDialogBackgroundWindow = windowCreate(backgroundWindowX,
backgroundWindowY,
windowWidth,
GAME_DIALOG_WINDOW_HEIGHT,
256,
WINDOW_FLAG_0x02);
gameDialogWindowRenderBackground(); gameDialogWindowRenderBackground();
unsigned char* buf = windowGetBuffer(gGameDialogBackgroundWindow); unsigned char* buf = windowGetBuffer(gGameDialogBackgroundWindow);
@ -2983,7 +2998,12 @@ int _gdialog_barter_create_win()
int barterWindowX = (screenGetWidth() - GAME_DIALOG_WINDOW_WIDTH) / 2; int barterWindowX = (screenGetWidth() - GAME_DIALOG_WINDOW_WIDTH) / 2;
int barterWindowY = (screenGetHeight() - GAME_DIALOG_WINDOW_HEIGHT) / 2 + GAME_DIALOG_WINDOW_HEIGHT - _dialogue_subwin_len; int barterWindowY = (screenGetHeight() - GAME_DIALOG_WINDOW_HEIGHT) / 2 + GAME_DIALOG_WINDOW_HEIGHT - _dialogue_subwin_len;
gGameDialogWindow = windowCreate(barterWindowX, barterWindowY, GAME_DIALOG_WINDOW_WIDTH, _dialogue_subwin_len, 256, WINDOW_FLAG_0x02); gGameDialogWindow = windowCreate(barterWindowX,
barterWindowY,
GAME_DIALOG_WINDOW_WIDTH,
_dialogue_subwin_len,
256,
WINDOW_FLAG_0x02);
if (gGameDialogWindow == -1) { if (gGameDialogWindow == -1) {
artUnlock(backgroundHandle); artUnlock(backgroundHandle);
return -1; return -1;
@ -3136,7 +3156,12 @@ int partyMemberControlWindowInit()
_dialogue_subwin_len = artGetHeight(backgroundFrm, 0, 0); _dialogue_subwin_len = artGetHeight(backgroundFrm, 0, 0);
int controlWindowX = (screenGetWidth() - GAME_DIALOG_WINDOW_WIDTH) / 2; int controlWindowX = (screenGetWidth() - GAME_DIALOG_WINDOW_WIDTH) / 2;
int controlWindowY = (screenGetHeight() - GAME_DIALOG_WINDOW_HEIGHT) / 2 + GAME_DIALOG_WINDOW_HEIGHT - _dialogue_subwin_len; int controlWindowY = (screenGetHeight() - GAME_DIALOG_WINDOW_HEIGHT) / 2 + GAME_DIALOG_WINDOW_HEIGHT - _dialogue_subwin_len;
gGameDialogWindow = windowCreate(controlWindowX, controlWindowY, GAME_DIALOG_WINDOW_WIDTH, _dialogue_subwin_len, 256, WINDOW_FLAG_0x02); gGameDialogWindow = windowCreate(controlWindowX,
controlWindowY,
GAME_DIALOG_WINDOW_WIDTH,
_dialogue_subwin_len,
256,
WINDOW_FLAG_0x02);
if (gGameDialogWindow == -1) { if (gGameDialogWindow == -1) {
partyMemberControlWindowFree(); partyMemberControlWindowFree();
return -1; return -1;
@ -3570,7 +3595,12 @@ int partyMemberCustomizationWindowInit()
int customizationWindowX = (screenGetWidth() - GAME_DIALOG_WINDOW_WIDTH) / 2; int customizationWindowX = (screenGetWidth() - GAME_DIALOG_WINDOW_WIDTH) / 2;
int customizationWindowY = (screenGetHeight() - GAME_DIALOG_WINDOW_HEIGHT) / 2 + GAME_DIALOG_WINDOW_HEIGHT - _dialogue_subwin_len; int customizationWindowY = (screenGetHeight() - GAME_DIALOG_WINDOW_HEIGHT) / 2 + GAME_DIALOG_WINDOW_HEIGHT - _dialogue_subwin_len;
gGameDialogWindow = windowCreate(customizationWindowX, customizationWindowY, GAME_DIALOG_WINDOW_WIDTH, _dialogue_subwin_len, 256, WINDOW_FLAG_0x02); gGameDialogWindow = windowCreate(customizationWindowX,
customizationWindowY,
GAME_DIALOG_WINDOW_WIDTH,
_dialogue_subwin_len,
256,
WINDOW_FLAG_0x02);
if (gGameDialogWindow == -1) { if (gGameDialogWindow == -1) {
partyMemberCustomizationWindowFree(); partyMemberCustomizationWindowFree();
return -1; return -1;
@ -4105,7 +4135,7 @@ int _gdialog_window_create()
int dialogSubwindowX = (screenGetWidth() - GAME_DIALOG_WINDOW_WIDTH) / 2; int dialogSubwindowX = (screenGetWidth() - GAME_DIALOG_WINDOW_WIDTH) / 2;
int dialogSubwindowY = (screenGetHeight() - GAME_DIALOG_WINDOW_HEIGHT) / 2 + GAME_DIALOG_WINDOW_HEIGHT - _dialogue_subwin_len; int dialogSubwindowY = (screenGetHeight() - GAME_DIALOG_WINDOW_HEIGHT) / 2 + GAME_DIALOG_WINDOW_HEIGHT - _dialogue_subwin_len;
gGameDialogWindow = windowCreate(dialogSubwindowX, dialogSubwindowY, screenWidth, _dialogue_subwin_len, 256, 2); gGameDialogWindow = windowCreate(dialogSubwindowX, dialogSubwindowY, screenWidth, _dialogue_subwin_len, 256, WINDOW_FLAG_0x02);
if (gGameDialogWindow != -1) { if (gGameDialogWindow != -1) {
unsigned char* v10 = windowGetBuffer(gGameDialogWindow); unsigned char* v10 = windowGetBuffer(gGameDialogWindow);

View File

@ -41,6 +41,14 @@
#include <algorithm> #include <algorithm>
#define INVENTORY_WINDOW_X 80
#define INVENTORY_WINDOW_Y 0
#define INVENTORY_TRADE_WINDOW_X 80
#define INVENTORY_TRADE_WINDOW_Y 290
#define INVENTORY_TRADE_WINDOW_WIDTH 480
#define INVENTORY_TRADE_WINDOW_HEIGHT 180
#define INVENTORY_LARGE_SLOT_WIDTH 90 #define INVENTORY_LARGE_SLOT_WIDTH 90
#define INVENTORY_LARGE_SLOT_HEIGHT 61 #define INVENTORY_LARGE_SLOT_HEIGHT 61
@ -550,10 +558,10 @@ bool _setup_inventory(int inventoryWindowType)
// Maintain original position in original resolution, otherwise center it. // Maintain original position in original resolution, otherwise center it.
int inventoryWindowX = screenGetWidth() != 640 int inventoryWindowX = screenGetWidth() != 640
? (screenGetWidth() - windowDescription->width) / 2 ? (screenGetWidth() - windowDescription->width) / 2
: 80; : INVENTORY_WINDOW_X;
int inventoryWindowY = screenGetHeight() != 480 int inventoryWindowY = screenGetHeight() != 480
? (screenGetHeight() - windowDescription->height) / 2 ? (screenGetHeight() - windowDescription->height) / 2
: 0; : INVENTORY_WINDOW_Y;
gInventoryWindow = windowCreate(inventoryWindowX, gInventoryWindow = windowCreate(inventoryWindowX,
inventoryWindowY, inventoryWindowY,
windowDescription->width, windowDescription->width,
@ -582,15 +590,15 @@ bool _setup_inventory(int inventoryWindowType)
gInventorySlotsCount = 3; gInventorySlotsCount = 3;
// Trade inventory window is a part of game dialog, which is 640x480. // Trade inventory window is a part of game dialog, which is 640x480.
int tradeWindowX = (screenGetWidth() - 640) / 2 + 80; int tradeWindowX = (screenGetWidth() - 640) / 2 + INVENTORY_TRADE_WINDOW_X;
int tradeWindowY = (screenGetHeight() - 480) / 2 + 290; int tradeWindowY = (screenGetHeight() - 480) / 2 + INVENTORY_TRADE_WINDOW_Y;
gInventoryWindow = windowCreate(tradeWindowX, tradeWindowY, 480, 180, 257, 0); gInventoryWindow = windowCreate(tradeWindowX, tradeWindowY, INVENTORY_TRADE_WINDOW_WIDTH, INVENTORY_TRADE_WINDOW_HEIGHT, 257, 0);
gInventoryWindowMaxX = tradeWindowX + 480; gInventoryWindowMaxX = tradeWindowX + INVENTORY_TRADE_WINDOW_WIDTH;
gInventoryWindowMaxY = tradeWindowY + 180; gInventoryWindowMaxY = tradeWindowY + INVENTORY_TRADE_WINDOW_HEIGHT;
unsigned char* dest = windowGetBuffer(gInventoryWindow); unsigned char* dest = windowGetBuffer(gInventoryWindow);
unsigned char* src = windowGetBuffer(_barter_back_win); unsigned char* src = windowGetBuffer(_barter_back_win);
blitBufferToBuffer(src + 80, 480, 180, 640, dest, 480); blitBufferToBuffer(src + INVENTORY_TRADE_WINDOW_X, INVENTORY_TRADE_WINDOW_WIDTH, INVENTORY_TRADE_WINDOW_HEIGHT, 640, dest, INVENTORY_TRADE_WINDOW_WIDTH);
gInventoryPrintItemDescriptionHandler = gameDialogRenderSupplementaryMessage; gInventoryPrintItemDescriptionHandler = gameDialogRenderSupplementaryMessage;
} }
@ -606,7 +614,7 @@ bool _setup_inventory(int inventoryWindowType)
} }
int eventCode = 2005; int eventCode = 2005;
int y = INVENTORY_SLOT_HEIGHT * 5 + INVENTORY_SLOT_HEIGHT; int y = INVENTORY_SLOT_HEIGHT * 5 + INVENTORY_LOOT_LEFT_SCROLLER_Y;
// Create invisible buttons representing container's inventory item // Create invisible buttons representing container's inventory item
// slots. For unknown reason it loops backwards and it's size is // slots. For unknown reason it loops backwards and it's size is
@ -4476,6 +4484,7 @@ void _container_enter(int keyCode, int inventoryWindowType)
_stack[_curr_stack] = item; _stack[_curr_stack] = item;
_stack_offset[_curr_stack] = 0; _stack_offset[_curr_stack] = 0;
_inven_dude = _stack[_curr_stack];
_pud = &(item->data.inventory); _pud = &(item->data.inventory);
_adjust_fid(); _adjust_fid();

View File

@ -323,6 +323,7 @@ int critterGetStat(Object* critter, int stat)
} }
break; break;
case STAT_DAMAGE_RESISTANCE: case STAT_DAMAGE_RESISTANCE:
case STAT_DAMAGE_RESISTANCE_EXPLOSION:
if (perkGetRank(critter, PERK_DERMAL_IMPACT_ARMOR)) { if (perkGetRank(critter, PERK_DERMAL_IMPACT_ARMOR)) {
value += 5; value += 5;
} else if (perkGetRank(critter, PERK_DERMAL_IMPACT_ASSAULT_ENHANCEMENT)) { } else if (perkGetRank(critter, PERK_DERMAL_IMPACT_ASSAULT_ENHANCEMENT)) {