This commit is contained in:
wolfcheese 2021-06-15 19:48:53 -04:00
commit 12c19e01c3
7 changed files with 141 additions and 31 deletions

View file

@ -927,9 +927,26 @@ typedef struct CarriedWeaponInfo
bool HasSilencer; bool HasSilencer;
}; };
#define MaxDiaryPages 64
#define MaxStringsPerPage 8
typedef struct DiaryString
{
int x, y;
short stringID;
};
typedef struct DiaryPage
{
DiaryString Strings[MaxStringsPerPage];
};
typedef struct DiaryInfo typedef struct DiaryInfo
{ {
bool Present; bool Present;
short numPages;
short currentPage;
DiaryPage Pages[MaxDiaryPages];
}; };
typedef struct LARA_ARM typedef struct LARA_ARM

View file

@ -1,4 +1,5 @@
#include "framework.h" #include "framework.h"
#ifdef NEW_INV
#include "newinv2.h" #include "newinv2.h"
#include "draw.h" #include "draw.h"
#include "control.h" #include "control.h"
@ -107,10 +108,11 @@ short optmessages[] =
// STRING_COMBINE_WITH, // STRING_COMBINE_WITH,
STRING_LOAD_GAME, STRING_LOAD_GAME,
STRING_SAVE_GAME, STRING_SAVE_GAME,
1,1,1//remove later 1,1,1,1//remove later
// STRING_EXAMINE, // STRING_EXAMINE,
// STRING_STATISTICS, // STRING_STATISTICS,
// STRING_CHOOSE_WEAPON, // STRING_CHOOSE_WEAPON,
// STRING_READ_DIARY
}; };
#define phd_winxmax g_Configuration.Width #define phd_winxmax g_Configuration.Width
@ -236,7 +238,7 @@ INVOBJ inventry_objects_list[INVENTORY_TABLE_SIZE] =
{ID_PC_LOAD_SAVE_ITEM, 52, 0.3f, ANGLE(180), 0, 0, OPT_SAVE, STRING_SAVE_GAME, -1, INV_ROT_Y}, {ID_PC_LOAD_SAVE_ITEM, 52, 0.3f, ANGLE(180), 0, 0, OPT_SAVE, STRING_SAVE_GAME, -1, INV_ROT_Y},
{ID_BURNING_TORCH_ITEM, 14, 0.5f, 0, ANGLE(90), 0, OPT_USE, STRING_LOAD_GAME, -1, INV_ROT_Y}, {ID_BURNING_TORCH_ITEM, 14, 0.5f, 0, ANGLE(90), 0, OPT_USE, STRING_LOAD_GAME, -1, INV_ROT_Y},
{ID_CROWBAR_ITEM, 4, 0.5f, 0, ANGLE(90), 0, OPT_USE, STRING_CROWBAR, -1, INV_ROT_Y}, {ID_CROWBAR_ITEM, 4, 0.5f, 0, ANGLE(90), 0, OPT_USE, STRING_CROWBAR, -1, INV_ROT_Y},
{ID_DIARY_ITEM, 0, 0.5f, 0, 0, 0, OPT_USE, STRING_DIARY, -1, INV_ROT_Y}, {ID_DIARY_ITEM, 0, 0.3f, ANGLE(180), 0, 0, OPT_DIARY, STRING_DIARY, -1, INV_ROT_Y},
{ID_COMPASS_ITEM, 0x0FFF2, 0.5f, 0, 0, 0, 0, STRING_LOAD_GAME, -1, INV_ROT_Y}, {ID_COMPASS_ITEM, 0x0FFF2, 0.5f, 0, 0, 0, 0, STRING_LOAD_GAME, -1, INV_ROT_Y},
{ID_CLOCKWORK_BEETLE, 14, 0.5f, 0, 0, 0, OPT_USE, STRING_LOAD_GAME, -1, INV_ROT_Y}, {ID_CLOCKWORK_BEETLE, 14, 0.5f, 0, 0, 0, OPT_USE, STRING_LOAD_GAME, -1, INV_ROT_Y},
{ID_CLOCKWORK_BEETLE_COMBO1, 18, 0.5f, 0, 0, 0, OPT_COMBINABLE, STRING_LOAD_GAME, -1, INV_ROT_Y}, {ID_CLOCKWORK_BEETLE_COMBO1, 18, 0.5f, 0, 0, 0, OPT_COMBINABLE, STRING_LOAD_GAME, -1, INV_ROT_Y},
@ -251,6 +253,7 @@ INVOBJ inventry_objects_list[INVENTORY_TABLE_SIZE] =
{ID_WATERSKIN2_3, 2, 0.5f, 0, ANGLE(285), 0, OPT_USE | OPT_COMBINABLE, STRING_LOAD_GAME, -1, INV_ROT_Y}, {ID_WATERSKIN2_3, 2, 0.5f, 0, ANGLE(285), 0, OPT_USE | OPT_COMBINABLE, STRING_LOAD_GAME, -1, INV_ROT_Y},
{ID_WATERSKIN2_4, 2, 0.5f, 0, ANGLE(285), 0, OPT_USE | OPT_COMBINABLE, STRING_LOAD_GAME, -1, INV_ROT_Y}, {ID_WATERSKIN2_4, 2, 0.5f, 0, ANGLE(285), 0, OPT_USE | OPT_COMBINABLE, STRING_LOAD_GAME, -1, INV_ROT_Y},
{ID_WATERSKIN2_5, 2, 0.5f, 0, ANGLE(285), 0, OPT_USE | OPT_COMBINABLE, STRING_LOAD_GAME, -1, INV_ROT_Y}, {ID_WATERSKIN2_5, 2, 0.5f, 0, ANGLE(285), 0, OPT_USE | OPT_COMBINABLE, STRING_LOAD_GAME, -1, INV_ROT_Y},
{ID_OPEN_DIARY_ITEM, 0, 0.9f, ANGLE(90), 0, 0, 0, 0, 0, 0},
//puzzles //puzzles
@ -2802,49 +2805,49 @@ void handle_inventry_menu()
if ((opts & OPT_LOAD)) if ((opts & OPT_LOAD))
{ {
current_options[0].type = 9; current_options[0].type = MENU_TYPE_LOAD;
current_options[0].text = g_GameFlow->GetString(optmessages[6]); current_options[0].text = g_GameFlow->GetString(optmessages[6]);
n = 1; n = 1;
} }
if ((opts & OPT_SAVE)) if ((opts & OPT_SAVE))
{ {
current_options[n].type = 10; current_options[n].type = MENU_TYPE_SAVE;
current_options[n].text = g_GameFlow->GetString(optmessages[7]); current_options[n].text = g_GameFlow->GetString(optmessages[7]);
n++; n++;
} }
if ((opts & OPT_EXAMINABLE)) if ((opts & OPT_EXAMINABLE))
{ {
current_options[n].type = 11; current_options[n].type = MENU_TYPE_EXAMINE;
current_options[n].text = g_GameFlow->GetString(optmessages[8]); current_options[n].text = g_GameFlow->GetString(optmessages[8]);
n++; n++;
} }
if ((opts & OPT_STATS)) if ((opts & OPT_STATS))
{ {
current_options[n].type = 12; current_options[n].type = MENU_TYPE_STATS;
current_options[n].text = g_GameFlow->GetString(optmessages[9]); current_options[n].text = g_GameFlow->GetString(optmessages[9]);
n++; n++;
} }
if ((opts & OPT_USE)) if ((opts & OPT_USE))
{ {
current_options[n].type = 1; current_options[n].type = MENU_TYPE_USE;
current_options[n].text = g_GameFlow->GetString(optmessages[0]); current_options[n].text = g_GameFlow->GetString(optmessages[0]);
n++; n++;
} }
if ((opts & OPT_EQUIP)) if ((opts & OPT_EQUIP))
{ {
current_options[n].type = 5; current_options[n].type = MENU_TYPE_EQUIP;
current_options[n].text = g_GameFlow->GetString(optmessages[4]); current_options[n].text = g_GameFlow->GetString(optmessages[4]);
n++; n++;
} }
if ((opts & (OPT_CHOOSEAMMO_SHOTGUN | OPT_CHOOSEAMMO_CROSSBOW | OPT_CHOOSEAMMO_GRENADEGUN))) if ((opts & (OPT_CHOOSEAMMO_SHOTGUN | OPT_CHOOSEAMMO_CROSSBOW | OPT_CHOOSEAMMO_GRENADEGUN)))
{ {
current_options[n].type = 2; current_options[n].type = MENU_TYPE_CHOOSEAMMO;
current_options[n].text = g_GameFlow->GetString(optmessages[1]); current_options[n].text = g_GameFlow->GetString(optmessages[1]);
n++; n++;
} }
@ -2853,7 +2856,7 @@ void handle_inventry_menu()
{ {
if (is_item_currently_combinable(num)) if (is_item_currently_combinable(num))
{ {
current_options[n].type = 3; current_options[n].type = MENU_TYPE_COMBINE;
current_options[n].text = g_GameFlow->GetString(optmessages[2]); current_options[n].text = g_GameFlow->GetString(optmessages[2]);
n++; n++;
} }
@ -2861,23 +2864,30 @@ void handle_inventry_menu()
if ((opts & OPT_ALWAYSCOMBINE)) if ((opts & OPT_ALWAYSCOMBINE))
{ {
current_options[n].type = 3; current_options[n].type = MENU_TYPE_COMBINE;
current_options[n].text = g_GameFlow->GetString(optmessages[2]); current_options[n].text = g_GameFlow->GetString(optmessages[2]);
n++; n++;
} }
if ((opts & OPT_SEPERATABLE)) if ((opts & OPT_SEPERATABLE))
{ {
current_options[n].type = 4; current_options[n].type = MENU_TYPE_SEPERATE;
current_options[n].text = g_GameFlow->GetString(optmessages[3]); current_options[n].text = g_GameFlow->GetString(optmessages[3]);
n++; n++;
} }
if (opts & OPT_DIARY)
{
current_options[n].type = MENU_TYPE_DIARY;
current_options[n].text = g_GameFlow->GetString(optmessages[11]);
n++;
}
} }
else else
{ {
current_options[0].type = 6; current_options[0].type = MENU_TYPE_AMMO1;
current_options[0].text = g_GameFlow->GetString(inventry_objects_list[ammo_object_list[0].invitem].objname); current_options[0].text = g_GameFlow->GetString(inventry_objects_list[ammo_object_list[0].invitem].objname);
current_options[1].type = 7; current_options[1].type = MENU_TYPE_AMMO2;
current_options[1].text = g_GameFlow->GetString(inventry_objects_list[ammo_object_list[1].invitem].objname); current_options[1].text = g_GameFlow->GetString(inventry_objects_list[ammo_object_list[1].invitem].objname);
n = 2; n = 2;
@ -2886,7 +2896,7 @@ void handle_inventry_menu()
if (opts & (OPT_CHOOSEAMMO_CROSSBOW | OPT_CHOOSEAMMO_GRENADEGUN)) if (opts & (OPT_CHOOSEAMMO_CROSSBOW | OPT_CHOOSEAMMO_GRENADEGUN))
{ {
n = 3; n = 3;
current_options[2].type = 8; current_options[2].type = MENU_TYPE_AMMO3;
current_options[2].text = g_GameFlow->GetString(inventry_objects_list[ammo_object_list[2].invitem].objname); current_options[2].text = g_GameFlow->GetString(inventry_objects_list[ammo_object_list[2].invitem].objname);
} }
@ -2956,7 +2966,7 @@ void handle_inventry_menu()
switch (current_options[current_selected_option].type) switch (current_options[current_selected_option].type)
{ {
case 2: case MENU_TYPE_CHOOSEAMMO:
rings[RING_INVENTORY]->ringactive = 0; rings[RING_INVENTORY]->ringactive = 0;
ammo_active = 1; ammo_active = 1;
Stashedcurrent_selected_option = current_selected_option; Stashedcurrent_selected_option = current_selected_option;
@ -2971,31 +2981,31 @@ void handle_inventry_menu()
StashedCurrentRocketAmmoType = CurrentRocketAmmoType; StashedCurrentRocketAmmoType = CurrentRocketAmmoType;
break; break;
case 9: case MENU_TYPE_LOAD:
loading_or_saving = 1; loading_or_saving = 1;
break; break;
case 10: case MENU_TYPE_SAVE:
loading_or_saving = 2; loading_or_saving = 2;
break; break;
case 11: case MENU_TYPE_EXAMINE:
GLOBAL_invMode = IM_EXAMINE; GLOBAL_invMode = IM_EXAMINE;
break; break;
case 12: case MENU_TYPE_STATS:
GLOBAL_invMode = IM_STATS; GLOBAL_invMode = IM_STATS;
break; break;
case 6: case MENU_TYPE_AMMO1:
case 7: case MENU_TYPE_AMMO2:
case 8: case MENU_TYPE_AMMO3:
ammo_active = 0; ammo_active = 0;
rings[RING_INVENTORY]->ringactive = 1; rings[RING_INVENTORY]->ringactive = 1;
current_selected_option = 0; current_selected_option = 0;
break; break;
case 3: case MENU_TYPE_COMBINE:
construct_combine_object_list(); construct_combine_object_list();
rings[RING_INVENTORY]->ringactive = 0; rings[RING_INVENTORY]->ringactive = 0;
rings[RING_AMMO]->ringactive = 1; rings[RING_AMMO]->ringactive = 1;
@ -3004,16 +3014,21 @@ void handle_inventry_menu()
combine_ring_fade_dir = 1; combine_ring_fade_dir = 1;
break; break;
case 4: case MENU_TYPE_SEPERATE:
seperate_type_flag = 1; seperate_type_flag = 1;
normal_ring_fade_dir = 2; normal_ring_fade_dir = 2;
break; break;
case 5: case MENU_TYPE_EQUIP:
case 1: case MENU_TYPE_USE:
menu_active = 0; menu_active = 0;
useItem = 1; useItem = 1;
break; break;
case MENU_TYPE_DIARY:
GLOBAL_invMode = IM_DIARY;
Lara.Diary.currentPage = 1;
break;
} }
} }
@ -3657,8 +3672,11 @@ int S_CallInventory2()
if (GLOBAL_invMode == IM_EXAMINE) if (GLOBAL_invMode == IM_EXAMINE)
do_examine_mode(); do_examine_mode();
DrawInv(); if (GLOBAL_invMode == IM_DIARY)
draw_compass(); do_diary();
DrawInv();
draw_compass();
if (useItem & !TrInput) if (useItem & !TrInput)
val = 1; val = 1;
@ -3747,6 +3765,30 @@ void draw_compass()
Matrix::CreateRotationY(compass_angle); Matrix::CreateRotationY(compass_angle);
} }
void do_diary()
{
GLOBAL_invMode = IM_DIARY;
if (goRight && Lara.Diary.currentPage < Lara.Diary.numPages)
{
Lara.Diary.currentPage++;
SoundEffect(SFX_TR4_MENU_CHOOSE, 0, SFX_ALWAYS);
}
if (goLeft && Lara.Diary.currentPage > 1)
{
Lara.Diary.currentPage--;
SoundEffect(SFX_TR4_MENU_CHOOSE, 0, SFX_ALWAYS);
}
if (goDeselect)
{
SoundEffect(SFX_TR4_MENU_SELECT, 0, SFX_ALWAYS);
goDeselect = 0;
GLOBAL_invMode = IM_NONE;
}
}
void combine_revolver_lasersight(int flag) void combine_revolver_lasersight(int flag)
{ {
if (flag) if (flag)
@ -4264,3 +4306,4 @@ int do_special_waterskin_combine_bullshit(int flag)
return 0; return 0;
} }
#endif

View file

@ -1,3 +1,4 @@
#ifdef NEW_INV
#pragma once #pragma once
#include "configuration.h" #include "configuration.h"
#include <Scripting/LanguageScript.h> #include <Scripting/LanguageScript.h>
@ -42,6 +43,7 @@ int S_CallInventory2();
void do_stats_mode(); void do_stats_mode();
void do_examine_mode(); void do_examine_mode();
void draw_compass(); void draw_compass();
void do_diary();
void combine_revolver_lasersight(int flag); void combine_revolver_lasersight(int flag);
void combine_crossbow_lasersight(int flag); void combine_crossbow_lasersight(int flag);
void combine_HK_SILENCER(int flag); void combine_HK_SILENCER(int flag);
@ -114,6 +116,24 @@ int do_special_waterskin_combine_bullshit(int flag);
#define INV_RESULT_EXIT_TO_TILE 6 #define INV_RESULT_EXIT_TO_TILE 6
#define INV_RESULT_NEW_GAME_SELECTED_LEVEL 7 #define INV_RESULT_NEW_GAME_SELECTED_LEVEL 7
enum menu_types
{
nothing,
MENU_TYPE_USE,
MENU_TYPE_CHOOSEAMMO,
MENU_TYPE_COMBINE,
MENU_TYPE_SEPERATE,
MENU_TYPE_EQUIP,
MENU_TYPE_AMMO1,
MENU_TYPE_AMMO2,
MENU_TYPE_AMMO3,
MENU_TYPE_LOAD,
MENU_TYPE_SAVE,
MENU_TYPE_EXAMINE,
MENU_TYPE_STATS,
MENU_TYPE_DIARY
};
enum item_options enum item_options
{ {
OPT_ALWAYSCOMBINE = 1 << 0, OPT_ALWAYSCOMBINE = 1 << 0,
@ -133,7 +153,8 @@ enum item_options
OPT_CHOOSEAMMO_HK = 1 << 14, OPT_CHOOSEAMMO_HK = 1 << 14,
OPT_STATS = 1 << 15, OPT_STATS = 1 << 15,
OPT_CHOOSEAMMO_HARPOON = 1 << 16, OPT_CHOOSEAMMO_HARPOON = 1 << 16,
OPT_CHOOSEAMMO_ROCKET = 1 << 17 OPT_CHOOSEAMMO_ROCKET = 1 << 17,
OPT_DIARY = 1 << 18
}; };
enum rotflags enum rotflags
@ -215,6 +236,7 @@ enum inv_objects
INV_OBJECT_BIG_WATERSKIN3L, INV_OBJECT_BIG_WATERSKIN3L,
INV_OBJECT_BIG_WATERSKIN4L, INV_OBJECT_BIG_WATERSKIN4L,
INV_OBJECT_BIG_WATERSKIN5L, INV_OBJECT_BIG_WATERSKIN5L,
INV_OBJECT_OPEN_DIARY,
// Puzzle, keys, pickups, examines // Puzzle, keys, pickups, examines
INV_OBJECT_PUZZLE1, INV_OBJECT_PUZZLE1,
@ -409,7 +431,8 @@ enum inv_modes
IM_INGAME, IM_INGAME,
IM_PAUSE, IM_PAUSE,
IM_STATS, IM_STATS,
IM_EXAMINE IM_EXAMINE,
IM_DIARY
}; };
typedef struct titleSettings typedef struct titleSettings
@ -492,3 +515,4 @@ extern int GLOBAL_lastinvitem;
extern int GLOBAL_enterinventory; extern int GLOBAL_enterinventory;
extern RINGME* rings[2]; extern RINGME* rings[2];
extern INVOBJ inventry_objects_list[]; extern INVOBJ inventry_objects_list[];
#endif

View file

@ -1278,6 +1278,7 @@ static void StartPickup(OBJECT_INFO *obj)
InitPickup(obj, ID_WATERSKIN1_EMPTY); InitPickup(obj, ID_WATERSKIN1_EMPTY);
InitPickup(obj, ID_WATERSKIN2_EMPTY); InitPickup(obj, ID_WATERSKIN2_EMPTY);
InitPickup(obj, ID_GOLDROSE_ITEM); InitPickup(obj, ID_GOLDROSE_ITEM);
InitPickup(obj, ID_DIARY_ITEM);
} }
static OBJECT_INFO *objToInit; static OBJECT_INFO *objToInit;

View file

@ -737,6 +737,7 @@ typedef enum GAME_OBJECT_ID
ID_MEMCARD_SAVE_INV_ITEM, ID_MEMCARD_SAVE_INV_ITEM,
ID_PC_LOAD_INV_ITEM, ID_PC_LOAD_INV_ITEM,
ID_PC_LOAD_SAVE_ITEM, ID_PC_LOAD_SAVE_ITEM,
ID_OPEN_DIARY_ITEM,
/* Inventory main objects */ /* Inventory main objects */
ID_INVENTORY_PASSPORT = 1000, ID_INVENTORY_PASSPORT = 1000,

View file

@ -527,6 +527,7 @@ namespace T5M::Renderer
void renderNewInventory(); void renderNewInventory();
void drawStatistics(); void drawStatistics();
void drawExamines(); void drawExamines();
void drawDiary();
void drawDebris(RenderView& view,bool transparent); void drawDebris(RenderView& view,bool transparent);
void drawFullScreenImage(ID3D11ShaderResourceView* texture, float fade, ID3D11RenderTargetView* target, ID3D11DepthStencilView* depthTarget); void drawFullScreenImage(ID3D11ShaderResourceView* texture, float fade, ID3D11RenderTargetView* target, ID3D11DepthStencilView* depthTarget);
void createBillboardMatrix(DirectX::SimpleMath::Matrix* out, DirectX::SimpleMath::Vector3* particlePos, DirectX::SimpleMath::Vector3* cameraPos, float rotation); void createBillboardMatrix(DirectX::SimpleMath::Matrix* out, DirectX::SimpleMath::Vector3* particlePos, DirectX::SimpleMath::Vector3* cameraPos, float rotation);

View file

@ -1094,6 +1094,23 @@ namespace T5M::Renderer
drawObjectOn2DPosition(400, 300, convert_invobj_to_obj(inv_item), xrot, yrot, zrot, obj->scale1); drawObjectOn2DPosition(400, 300, convert_invobj_to_obj(inv_item), xrot, yrot, zrot, obj->scale1);
obj->scale1 = saved_scale; obj->scale1 = saved_scale;
} }
void Renderer11::drawDiary()
{
INVOBJ* obj = &inventry_objects_list[INV_OBJECT_OPEN_DIARY];
short currentPage = Lara.Diary.currentPage;
drawObjectOn2DPosition(400, 300, convert_invobj_to_obj(INV_OBJECT_OPEN_DIARY), obj->xrot, obj->yrot, obj->zrot, obj->scale1);
for (int i = 0; i < MaxStringsPerPage; i++)
{
if (!Lara.Diary.Pages[Lara.Diary.currentPage].Strings[i].x && !Lara.Diary.Pages[Lara.Diary.currentPage].Strings[i].y && !Lara.Diary.Pages[Lara.Diary.currentPage].Strings[i].stringID)
break;
drawString(Lara.Diary.Pages[currentPage].Strings[i].x, Lara.Diary.Pages[currentPage].Strings[i].y, g_GameFlow->GetString(Lara.Diary.Pages[currentPage].Strings[i].stringID), PRINTSTRING_COLOR_WHITE, 0);
}
drawAllStrings();
}
#endif #endif
void Renderer11::renderInventoryScene(ID3D11RenderTargetView* target, ID3D11DepthStencilView* depthTarget, ID3D11ShaderResourceView* background) void Renderer11::renderInventoryScene(ID3D11RenderTargetView* target, ID3D11DepthStencilView* depthTarget, ID3D11ShaderResourceView* background)
{ {
@ -1237,6 +1254,12 @@ namespace T5M::Renderer
return; return;
} }
if (GLOBAL_invMode == IM_DIARY)
{
drawDiary();
return;
}
#else #else
for (int k = 0; k < NUM_INVENTORY_RINGS; k++) for (int k = 0; k < NUM_INVENTORY_RINGS; k++)
{ {