Skip to content

Commit

Permalink
Update metadata and improve compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
szapp committed May 11, 2024
1 parent c2bf2d3 commit 5cda052
Show file tree
Hide file tree
Showing 16 changed files with 42 additions and 25 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ on:
push:
paths:
- "Ninja/**/*.src"
- "Ninja/**/*.SRC"
- "Ninja/**/*.d"
- "Ninja/**/*.D"
workflow_dispatch:

# These permissions are necessary for creating the check runs
permissions:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ on:
push:
paths:
- "Ninja/**/*.src"
- "Ninja/**/*.SRC"
- "Ninja/**/*.d"
- "Ninja/**/*.D"
- "_work/Data/**/*"
workflow_dispatch:

# These permissions are necessary for creating the check runs
permissions:
Expand Down
3 changes: 3 additions & 0 deletions ItemMap.vm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ VDFName=.\ItemMap.vdf

[FILES]
; Modular resources
_work\Data\Anims\*.MDS
_work\Data\Anims\MDS_Mobsi\*.MDS
_work\Data\Anims\MDS_Overlay\*.MDS
_work\Data\Anims\_compiled\*.MAN
_work\Data\Anims\_compiled\*.MDH
_work\Data\Anims\_compiled\*.MDL
Expand Down
6 changes: 3 additions & 3 deletions Ninja/ItemMap/Content/Collect.d
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func int Patch_ItemMap_GetItems(var int classDef, var int arrPtr) {
CALL_PtrParam(_@(vobTreePtr));
CALL_PtrParam(_@(arrPtr));
CALL_PtrParam(_@(classDef));
CALL__thiscall(_@(worldPtr), zCWorld__SearchVobListByBaseClass[IDX_EXE]);
CALL__thiscall(_@(worldPtr), zCWorld__SearchVobListByBaseClass[ItemMap_EXE]);
call = CALL_End();
};

Expand Down Expand Up @@ -104,7 +104,7 @@ func void Patch_ItemMap_AddItems() {
herPos[1] = truncf(her._zCVob_trafoObjToWorld[11]) / 100;

// Obtain items
var int arrPtr; arrPtr = Patch_ItemMap_GetItems(oCItem__classDef[IDX_EXE], 0);
var int arrPtr; arrPtr = Patch_ItemMap_GetItems(oCItem__classDef[ItemMap_EXE], 0);

// Iterate over items and add them to the map
repeat(i, MEM_ArraySize(arrPtr)); var int i;
Expand Down Expand Up @@ -175,7 +175,7 @@ func void Patch_ItemMap_AddItems() {
if (Patch_ItemMap_Colors[COL_CHEST] != COL_INVALID) {
// Collect all containers in the world
MEM_ArrayClear(arrPtr);
arrPtr = Patch_ItemMap_GetItems(oCMobContainer__classDef[IDX_EXE], arrPtr);
arrPtr = Patch_ItemMap_GetItems(oCMobContainer__classDef[ItemMap_EXE], arrPtr);

// Iterate over containers and add them to the map
color = Patch_ItemMap_Colors[COL_CHEST];
Expand Down
20 changes: 10 additions & 10 deletions Ninja/ItemMap/Content/Draw.d
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func void Patch_ItemMap_DrawObject(var int parentPtr, var int x, var int y, var
CALL_IntParam(_@(sizeof_oCViewDocument));
CALL_PutRetValTo(_@(viewPtr));
CALL__cdecl(malloc_adr);
CALL__thiscall(_@(viewPtr), oCViewDocument__oCViewDocument[IDX_EXE]);
CALL__thiscall(_@(viewPtr), oCViewDocument__oCViewDocument[ItemMap_EXE]);

// Attach to parent view
CALL_PtrParam(_@(emptyStrPtr));
Expand All @@ -72,16 +72,16 @@ func void Patch_ItemMap_DrawObject(var int parentPtr, var int x, var int y, var
CALL_IntParam(_@(effect));
CALL_IntParam(_@(effect));
CALL_IntParam(_@(FALSE));
CALL__fastcall(_@(viewPtr), _@(parentPtr), zCViewFX__Init[IDX_EXE]);
CALL__fastcall(_@(viewPtr), _@(parentPtr), zCViewFX__Init[ItemMap_EXE]);

// Adjust size, position, texture, and color
CALL__fastcall(_@(viewPtr), _@(sizePtr), zCViewObject__SetPixelSize[IDX_EXE]);
CALL__fastcall(_@(viewPtr), _@(posPtr), zCViewObject__SetPixelPosition[IDX_EXE]);
CALL__fastcall(_@(viewPtr), _@(texStrPtr), zCViewDraw__SetTexture[IDX_EXE]);
CALL__fastcall(_@(viewPtr), _@(colorPtr), zCViewDraw__SetTextureColor[IDX_EXE]);
CALL__fastcall(_@(viewPtr), _@(sizePtr), zCViewObject__SetPixelSize[ItemMap_EXE]);
CALL__fastcall(_@(viewPtr), _@(posPtr), zCViewObject__SetPixelPosition[ItemMap_EXE]);
CALL__fastcall(_@(viewPtr), _@(texStrPtr), zCViewDraw__SetTexture[ItemMap_EXE]);
CALL__fastcall(_@(viewPtr), _@(colorPtr), zCViewDraw__SetTextureColor[ItemMap_EXE]);

// Open delayed
CALL__fastcall(_@(viewPtr), _@(FALSE), zCViewFX__OpenSafe[IDX_EXE]);
CALL__fastcall(_@(viewPtr), _@(FALSE), zCViewFX__OpenSafe[ItemMap_EXE]);

// Release; it's in its parent's hands now
ASM_2(50307); ASM_1(8); // add esp, 0x8 ; Pop stack (see above)
Expand Down Expand Up @@ -112,19 +112,19 @@ func int Patch_ItemMap_GetTexSize(var string texture) {
CALL_IntParam(1); // Loading flag
CALL_zStringPtrParam(texture);
CALL_PutRetValTo(_@(texPtr));
CALL__cdecl(zCTexture__Load[IDX_EXE]);
CALL__cdecl(zCTexture__Load[ItemMap_EXE]);

// Retrieve its dimensions
CALL_PtrParam(_@(ret));
CALL_PtrParam(_@(ret));
CALL__thiscall(texPtr, zCTexture__GetPixelSize[IDX_EXE]);
CALL__thiscall(texPtr, zCTexture__GetPixelSize[ItemMap_EXE]);

// Dereference (and possibly delete) the texture again
var zCObject obj; obj = _^(texPtr);
obj.refCtr -= 1;
if (obj.refCtr <= 0) {
CALL_IntParam(1);
CALL__thiscall(texPtr, zCTexture__scal_del_destr[IDX_EXE]);
CALL__thiscall(texPtr, zCTexture__scal_del_destr[ItemMap_EXE]);
};

var int ret;
Expand Down
1 change: 1 addition & 0 deletions Ninja/ItemMap/Content/Exe_G1.d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const int ItemMap_EXE = 0;
1 change: 1 addition & 0 deletions Ninja/ItemMap/Content/Exe_G112.d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const int ItemMap_EXE = 1;
1 change: 1 addition & 0 deletions Ninja/ItemMap/Content/Exe_G130.d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const int ItemMap_EXE = 2;
1 change: 1 addition & 0 deletions Ninja/ItemMap/Content/Exe_G2.d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const int ItemMap_EXE = 3;
4 changes: 2 additions & 2 deletions Ninja/ItemMap/Content/Init.d
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ func void Ninja_ItemMap_Menu() {
const int oCViewDocumentMap__UpdatePosition_drw[4] = {/*G1*/7495977, /*G1A*/7747210, /*G2*/7809140, /*G2A*/6871204};

// Place hook on updating the map
HookEngineF(oCViewDocumentMap__UpdatePosition_drw[IDX_EXE], 7, Patch_ItemMap_AddItems);
HookEngineF(oCViewDocumentMap__UpdatePosition_drw[ItemMap_EXE], 7, Patch_ItemMap_AddItems);

// Place hook on key events
HookEngineF(oCDocumentManager__HandleEvent_start[IDX_EXE], 6, Patch_ItemMap_HandleEvent);
HookEngineF(oCDocumentManager__HandleEvent_start[ItemMap_EXE], 6, Patch_ItemMap_HandleEvent);
};
14 changes: 7 additions & 7 deletions Ninja/ItemMap/Content/Toggle.d
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ func void Patch_ItemMap_Toggle(var int docPtr, var int turnOn) {
if (!call) {
// Assembly for performance (check scripts of previous versions to find analogous Daedalus code)
const int call = 0;
const int open = zCViewFX__OpenSafe[IDX_EXE]; // Shorthands
const int close = zCViewFX__CloseSafe[IDX_EXE];
const int ofast = zCViewFX__OpenImmediately[IDX_EXE];
const int cfast = zCViewFX__CloseImmediately[IDX_EXE];
const int open = zCViewFX__OpenSafe[ItemMap_EXE]; // Shorthands
const int close = zCViewFX__CloseSafe[ItemMap_EXE];
const int ofast = zCViewFX__OpenImmediately[ItemMap_EXE];
const int cfast = zCViewFX__CloseImmediately[ItemMap_EXE];
ASM_Open(80);
ASM_1(96); // pusha
ASM_2(15755); ASM_4(_@(list)); // mov edi, [list] ; zCListSort*
Expand Down Expand Up @@ -76,7 +76,7 @@ func void Patch_ItemMap_Toggle(var int docPtr, var int turnOn) {
// Update/place the document markers
if (CALL_Begin(call2)) {
const int call2 = 0;
CALL__fastcall(_@(docPtr), _@(FALSE), oCViewDocumentMap__UpdatePosition[IDX_EXE]);
CALL__fastcall(_@(docPtr), _@(FALSE), oCViewDocumentMap__UpdatePosition[ItemMap_EXE]);
call2 = CALL_End();
};
};
Expand Down Expand Up @@ -109,7 +109,7 @@ func int Patch_ItemMap_KeyBindingIsToggled(var int keyBinding, var int keyStroke
CALL_IntParam(_@(keyStroke));
CALL_IntParam(_@(keyBinding));
CALL_PutRetValTo(_@(ret));
CALL__thiscall(zCInput_zinput, zCInput__IsBindedToggled[IDX_EXE]);
CALL__thiscall(zCInput_zinput, zCInput__IsBindedToggled[ItemMap_EXE]);
};
call = CALL_End();
};
Expand All @@ -134,7 +134,7 @@ func void Patch_ItemMap_HandleEvent() {
while(docList);
l = _^(docList);
// Only for map documents
if (MEM_ReadInt(l.data) == oCViewDocumentMap__vtbl[IDX_EXE]) {
if (MEM_ReadInt(l.data) == oCViewDocumentMap__vtbl[ItemMap_EXE]) {
Patch_ItemMap_Toggle(l.data, !Patch_ItemMap_State);
};
docList = l.next;
Expand Down
1 change: 1 addition & 0 deletions Ninja/ItemMap/Content_G1.src
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Ikarus
LeGo

Content\Exe_G1.d
Content\Const.d
Content\Colors.d
Content\Toggle.d
Expand Down
1 change: 1 addition & 0 deletions Ninja/ItemMap/Content_G112.src
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Ikarus
LeGo

Content\Exe_G112.d
Content\Const.d
Content\Colors.d
Content\Toggle.d
Expand Down
1 change: 1 addition & 0 deletions Ninja/ItemMap/Content_G130.src
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Ikarus
LeGo

Content\Exe_G130.d
Content\Const.d
Content\Colors.d
Content\Toggle.d
Expand Down
1 change: 1 addition & 0 deletions Ninja/ItemMap/Content_G2.src
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Ikarus
LeGo

Content\Exe_G2.d
Content\Const.d
Content\Colors.d
Content\Toggle.d
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Mark all items (and non-empty chests) in the world on the map (Gothic, Gothic Se
This is a modular modification (a.k.a. patch or add-on) that can be installed and uninstalled at any time and is virtually compatible with any modification.
It supports <kbd>Gothic 1</kbd>, <kbd>Gothic Sequel</kbd>, <kbd>Gothic II (Classic)</kbd> and <kbd>Gothic II: NotR</kbd>.

###### Generated from [szapp/patch-template](https://github.com/szapp/patch-template).
<sup>Generated from [szapp/patch-template](https://github.com/szapp/patch-template).</sup>

## About

Expand Down Expand Up @@ -97,8 +97,8 @@ The patch is also available on
### Requirements

<table><thead><tr><th>Gothic</th><th>Gothic Sequel</th><th>Gothic II (Classic)</th><th>Gothic II: NotR</th></tr></thead>
<tbody><tr><td><a href="https://www.worldofgothic.de/dl/download_6.htm">Version 1.08k_mod</a></td><td>Version 1.12f</td><td><a href="https://www.worldofgothic.de/dl/download_278.htm">Report version 1.30.0.0</a></td><td><a href="https://www.worldofgothic.de/dl/download_278.htm">Report version 2.6.0.0</a></td></tr></tbody>
<tbody><tr><td colspan="4" align="center"><a href="https://github.com/szapp/Ninja">Ninja 2</a> (or higher)</td></tr></tbody></table>
<tbody><tr><td><a href="https://www.worldofgothic.de/dl/download_34.htm">Version 1.08k_mod</a></td><td>Version 1.12f</td><td><a href="https://www.worldofgothic.de/dl/download_278.htm">Report version 1.30.0.0</a></td><td><a href="https://www.worldofgothic.de/dl/download_278.htm">Report version 2.6.0.0</a></td></tr></tbody>
<tbody><tr><td colspan="4" align="center"><a href="https://github.com/szapp/Ninja">Ninja 2.8</a> or higher</td></tr></tbody></table>

<!--
Expand Down

0 comments on commit 5cda052

Please sign in to comment.