Giter Club home page Giter Club logo

ikarus's Introduction

Ikarus

A daedalus library for the game Gothic. Exploits the interpreter to allow arbitrary memory access and defines a lot of useful functions for interfacing with the engine.

Authors

Code and documentation were originally written by Sektenspinner. To incorporate changes by the community, it was hosted on GitHub.

ikarus's People

Contributors

lehona avatar szapp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ikarus's Issues

Fix hex conversions

The function MEMINT_HexCharToInt does not take capital characters into account and the function MEMINT_ByteToKeyHex fails for digits larger than 0x9.

The first can be fixed by a simple lower case conversion (it's time we finally complement the STR_Upper function with a STR_Lower function) and the latter by the following lines of code (taken from byte2hex in ScriptBin/convert.d).

 func string MEMINT_ByteToKeyHex(var int byte) {
     const int ASCII_0 = 48;
+    const int ASCII_A = 65;
     byte = byte & 255;
+ 
+    // Fix ASCII characters (A to F)
+    var int c1; c1 = (byte >> 4);
+    if (c1 >= 10) {
+        c1 += ASCII_A-ASCII_0-10;
+    };
+    var int c2; c2 = (byte & 15);
+    if (c2 >= 10) {
+        c2 += ASCII_A-ASCII_0-10;
+    };
 
     const int mem = 0;
     if (!mem) { mem = MEM_Alloc(3); };
 
-    MEM_WriteByte(mem    , (byte >>  4) + ASCII_0);
-    MEM_WriteByte(mem + 1, (byte &  15) + ASCII_0);
+    MEM_WriteByte(mem    , c1 + ASCII_0);
+    MEM_WriteByte(mem + 1, c2 + ASCII_0);
     return STR_FromChar(mem);
 };

Do not archive MEM_Helper

On the rare occasion that a mod removes Ikarus in an update, players may be experience an error on loading a game save prior to this change, because the MEM_Helper NPC is inside the archive but its NPC instance is no longer present in the scripts.

This scenario might be very unlikely, but the fix would be very minor, so it cannot hurt:

Just set the flag zCVob_bitfield4_dontWriteIntoArchive in MEM_Helper after inserting it in Ikarus.d just after line 316.

Ikarus/Ikarus.d

Lines 306 to 317 in 704dad8

func void MEMINT_GetMemHelper() {
MEM_Helper = Hlp_GetNpc (MEM_HELPER_INST);
if (!Hlp_IsValidNpc (MEM_Helper)) {
//self zwischenspeichern
var C_NPC selfBak;
selfBak = Hlp_GetNpc (self);
Wld_InsertNpc (MEM_HELPER_INST, MEM_FARFARAWAY);
MEM_Helper = Hlp_GetNpc (self);
self = Hlp_GetNpc (selfBak);
};
};
.

Ikarus_Const_G1 incorrect vtbl values

zCRoute_vtbl = 8252184; //8252184 is actually 0x007DEB18 zCWaypoint_vtbl, correct value is 8252208 007DEB30
zCZoneMusic_vtbl = 8252476; //8252476 is actually 0x007DEC3C oCZoneMusic_vtbl, correct value is 8242628 007DC5C4
zCCSManager_vtbl = 8194068; //8194068 is actually 0x007D0814 oCCSManager_vtbl, correct value is 8195652 007D0E44
zCDecal_vtbl = 8241804;	//8241804 is actually 0x007DC28C zCZoneZFogDefault_vtbl, correct value is 8207876 007D3E04

Here is list of all vtbl constants, maybe can be useful:
G2A all vtbl values - Copy.xlsx
G1 all vtbl values - Copy.xlsx

Add classes also to Gothic 1

Some classes provided for Gothic 2 are not available for Gothic 1. Most of them can probably just be copied from the Gothic 2 to the Gothic 1 scripts.

Add more safety checks in MEM_InitGlobalInst

If Ikarus is initialization from InitPerceptions (in order to use Ikarus before the main menu is reached), it raises null pointer warnings for MEM_InfoMan and MEM_SpawnManager in Gothic 1.

Like the "recent" change to wrap MEM_Camera and MEM_SkyController into null pointer checks (see 33157f2), this should be done here too.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.