Portal-Zone Gothic-Zone Gothic II-Zone Gothic 3-Zone Gothic 4-Zone Modifikationen-Zone Download-Zone Foren-Zone RPG-Zone Almanach-Zone Spirit of Gothic

 

Ergebnis 1 bis 4 von 4
  1. Beiträge anzeigen #1 Zitieren
    Local Hero
    Registriert seit
    Feb 2017
    Beiträge
    270
     
    F a w k e s ist offline

    G1 - get date function

    Hello folks,
    Is there a function in Daedealus/Ikarus, which would return current date (e.g. today 29.10.2020). I tried to look for such function, but couldn't find anything
    I had a silly idea of adding 'easter eggs' (even literally) on certain dates to game, like on Halloween some pumpkins, on Christmas there would be a Christmas tree, or on Easter some colored eggs just a silly small easter egg

  2. Beiträge anzeigen #2 Zitieren
    Ehrengarde Avatar von mud-freak
    Registriert seit
    Dec 2005
    Beiträge
    2.199
     
    mud-freak ist offline
    Zitat Zitat von F a w k e s Beitrag anzeigen
    Hello folks,
    Is there a function in Daedealus/Ikarus, which would return current date (e.g. today 29.10.2020). I tried to look for such function, but couldn't find anything
    I had a silly idea of adding 'easter eggs' (even literally) on certain dates to game, like on Halloween some pumpkins, on Christmas there would be a Christmas tree, or on Easter some colored eggs just a silly small easter egg
    Check out the code in the end of this post (part about SystemTime). The address is from Gothic 2, but content-wise it should be the same in Gothic 1. Mind that this is the local system time, and users may fiddle with it by changing the date and time of their computer.

  3. Beiträge anzeigen #3 Zitieren
    Local Hero
    Registriert seit
    Feb 2017
    Beiträge
    270
     
    F a w k e s ist offline
    As always mud-freak you have a solution Thank you! This is exactly what I had in mind
    [Bild: gm-getdatetime.png]
    [Bild: 8CCSfGC8IIHi8AAAAASUVORK5CYII=]
    Code:
    //Credits: mud-freak
    //YYYY-MM-DD HH:MM:SS
    FUNC STRING GetLocalDateTimeStamp ()
    {
        //0075AE08  .text     Debug data           _GetLocalTime@4
        const int _GetLocalTime_G1 = 7712264;
        //0x007B4750 _GetLocalTime@4
        const int _GetLocalTime_G2 = 8079184; //0x7B4750
    
        var int SystemTimePtr; SystemTimePtr = MEM_Alloc(16); // SystemTime* 0x10
        CALL_PtrParam (SystemTimePtr);
        CALL__stdcall (MEMINT_SwitchG1G2 (_GetLocalTime_G1, _GetLocalTime_G2));
    
        var string timeStr; timeStr = IntToString(MEM_ReadInt(SystemTimePtr) & 2047);
        timeStr = ConcatStrings(timeStr, "-");
    
        var int mm; mm = MEM_ReadInt (SystemTimePtr+2) & 2047;
        if (mm < 10) { timeStr = ConcatStrings(timeStr, "0"); };
        timeStr = ConcatStrings(timeStr, IntToString(mm));
        timeStr = ConcatStrings(timeStr, "-");
    
        var int dd; dd = MEM_ReadInt(SystemTimePtr+6) & 2047;
        if (dd < 10) { timeStr = ConcatStrings(timeStr, "0"); };
        timeStr = ConcatStrings(timeStr, IntToString(dd));
        timeStr = ConcatStrings(timeStr, " ");
    
        var int hh; hh = MEM_ReadInt(SystemTimePtr+8) & 2047;
        if (hh < 10) { timeStr = ConcatStrings(timeStr, "0"); };
        timeStr = ConcatStrings(timeStr, IntToString(hh));
        timeStr = ConcatStrings(timeStr, ":");
    
        var int mi; mi = MEM_ReadInt(SystemTimePtr+10) & 2047;
        if (mi < 10) { timeStr = ConcatStrings(timeStr, "0"); };
        timeStr = ConcatStrings(timeStr, IntToString(mi));
        timeStr = ConcatStrings(timeStr, ":");
    
        var int ss; ss = MEM_ReadInt(SystemTimePtr+12) & 2047;
        if (ss < 10) { timeStr = ConcatStrings(timeStr, "0"); };
        timeStr = ConcatStrings(timeStr, IntToString(ss));
    
        MEM_Free(SystemTimePtr);
        
        return timeStr;
    };

  4. Beiträge anzeigen #4 Zitieren
    banned
    Registriert seit
    Jan 2009
    Ort
    Oberösterreich
    Beiträge
    2.393
     
    Moe ist offline
    Very cool! Thank you mud-freak and F a w k e s!

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
Impressum | Link Us | intern
World of Gothic © by World of Gothic Team
Gothic, Gothic 2 & Gothic 3 are © by Piranha Bytes & Egmont Interactive & JoWooD Productions AG, all rights reserved worldwide