Changeset 984 for Daodan/src


Ignore:
Timestamp:
Mar 17, 2014, 12:35:10 AM (11 years ago)
Author:
alloc
Message:

Daodan: TV code

Location:
Daodan/src
Files:
40 added
2 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • Daodan/src/Daodan_Config.c

    r983 r984  
    4040bool patch_safeprintf = true;
    4141bool patch_showalllasersights = false;
     42bool patch_showtriggervolumes = true;
    4243bool patch_throwtest = false;
    4344bool patch_usedaodangl = true;
     
    161162                        else if (!_stricmp(name, "showalllasersights"))
    162163                                patch_showalllasersights = !_stricmp(inifile_cleanstr(value), "true");
     164                        else if (!_stricmp(name, "showtriggervolumes"))
     165                                patch_showtriggervolumes = !_stricmp(inifile_cleanstr(value), "true");
    163166                        else if (!_stricmp(name, "throwtest"))
    164167                                patch_throwtest = !_stricmp(inifile_cleanstr(value), "true");
  • Daodan/src/Daodan_Config.h

    r983 r984  
    3535extern bool patch_safeprintf;
    3636extern bool patch_showalllasersights;
     37extern bool patch_showtriggervolumes;
    3738extern bool patch_throwtest;
    3839extern bool patch_usedaodangl;
  • Daodan/src/Oni.h

    r983 r984  
    2323} UUtRect;
    2424
     25typedef struct OBJtMethods
     26{
     27        void*     rNew;
     28        void*   rSetDefaults;
     29        void*    rDelete;
     30        void*   rIsInvalid;
     31        void*   rLevelBegin;
     32        void*    rLevelEnd;
     33
     34        void*     rDraw;
     35        void*   rEnumerate;
     36        void* rGetBoundingSphere;
     37        void*   rOSDGetName;
     38        void*   rOSDSetName;
     39        void*  rIntersectsLine;
     40        void*  rUpdatePosition;
     41
     42        void* rGetOSD;
     43        void* rGetOSDWriteSize;
     44        void* rSetOSD;
     45
     46        void* rWrite;
     47        void* rRead;
     48
     49        void* rSearch;
     50
     51        void* rGetClassVisible;
     52        void* rSetClassVisible;
     53
     54        void* rGetUniqueOSD;
     55} OBJtMethods;
     56
    2557void ONICALL TMrInstance_GetDataPtr_List(
    2658        char Tag[4],            //as in 'ONWC'
  • Daodan/src/Oni_Symbols.h

    r983 r984  
    88#include "BFW_ScriptLang.h"
    99
     10#include "patches/objt.h"
    1011
    1112//Define variables of Oni: #define VARNAME (*((TYPE*)ADDRESS))
     
    165166DefFunc(uint8_t, ONrCheater, ONICALL, (uint32_t cheat), 0x004f5c30);
    166167
     168DefFunc(int16_t, ONrMechanics_Register, ONICALL, (uint32_t inObjectType, uint32_t inObjectTypeIndex, char* inGroupName,
     169        uint32_t inSizeInMemory, OBJtMethods* inObjectMethods, uint32_t inFlags, void* inMechanicsMethods), 0x00507450);
     170DefFunc(int16_t, OBJrTriggerVolume_IntersectsCharacter, ONICALL, (const OBJtObject* inObject, uint32_t inMask, const void* inCharacter), 0x004cc680);
     171
     172
    167173// ?
    168174DefFunc(int, AUrMessageBox, __cdecl, (int Buttons, char *Message, ...), 0x004378c0);
     
    227233DefFunc(void, M3rDraw_BigBitmap, ONICALL, (M3tTextureMap_Big* inBigBitmap, const M3tPointScreen *inDestPoint, UUtUns16 inWidth, UUtUns16 inHeight, UUtUns32 inShade, UUtUns16 inAlpha), 0x0041f6e0);
    228234DefFunc(void, M3rDraw_Bitmap, ONICALL, (void* inBitmap, const M3tPointScreen* inDestPoint, UUtUns16 inWidth, UUtUns16 inHeight, UUtUns32 inShade, UUtUns16 inAlpha), 0x0041f4a0);
     235
     236DefFunc(void, M3rGeom_Line_Light, ONICALL, (const M3tPoint3D *point1, const M3tPoint3D *point2, uint32_t shade), 0x0041f440);
    229237/*
    230238DefFunc(void, M3rGeom_Line_Light, ONICALL, (), 0x0041f440);
  • Daodan/src/patches/Patches.c

    r983 r984  
    1313#include "../flatline/Flatline_Hooks.h"
    1414#include "../Oni.h"
    15 //#include "Objt.h"
     15#include "objt.h"
    1616
    1717typedef int (__cdecl *CHINESEPROC)(DWORD ThreadId);
     
    128128}
    129129
     130#define IMcShade_Red (0xFFFF0000)
     131#define IMcShade_Green (0xFF00FF00)
     132#define IMcShade_Blue (0xFF0000FF)
     133void ONICALL DD_OBJiTriggerVolume_Draw(OBJtObject* inObject, uint32_t inDrawFlags)
     134{
     135        UUtUns32                                itr;
     136        OBJtOSD_All                             *inOSD = (OBJtOSD_All *) inObject->object_data;
     137        OBJtOSD_TriggerVolume   *trigger_osd = &inOSD->osd.trigger_volume_osd;
     138        M3tPoint3D                              *points = trigger_osd->volume.worldPoints;
     139        M3tPoint3D                              trigger_center = {0, 0, 0};
     140        UUtUns32                                shade = 0xFFFFFF;
     141
     142        if (!OBJgTriggerVolume_Visible) {
     143                return;
     144        }
     145
     146        if (OBJrTriggerVolume_IntersectsCharacter(inObject, trigger_osd->team_mask, ONgGameState->PlayerCharacter)) {
     147                shade = IMcShade_Red;
     148        }
     149        else
     150        {
     151                shade = IMcShade_Blue;
     152        }
     153
     154        M3rGeom_Line_Light(points + 0, points + 1, shade);
     155        M3rGeom_Line_Light(points + 1, points + 3, shade);
     156        M3rGeom_Line_Light(points + 3, points + 2, shade);
     157        M3rGeom_Line_Light(points + 2, points + 0, shade);
     158
     159        M3rGeom_Line_Light(points + 4, points + 5, shade);
     160        M3rGeom_Line_Light(points + 5, points + 7, shade);
     161        M3rGeom_Line_Light(points + 7, points + 6, shade);
     162        M3rGeom_Line_Light(points + 6, points + 4, shade);
     163
     164        M3rGeom_Line_Light(points + 0, points + 4, shade);
     165        M3rGeom_Line_Light(points + 1, points + 5, shade);
     166        M3rGeom_Line_Light(points + 3, points + 7, shade);
     167        M3rGeom_Line_Light(points + 2, points + 6, shade);
     168
     169        for(itr = 0; itr < M3cNumBoundingPoints; itr++)
     170        {
     171                MUmVector_Add(trigger_center, trigger_center, points[itr]);
     172        }
     173
     174        MUmVector_Scale(trigger_center, (1.0f / ((float) M3cNumBoundingPoints)));
     175}
     176
     177_ONrMechanics_Register Oni_ONrMechanics_Register = (_ONrMechanics_Register)0;
     178int16_t ONICALL DD_ONrMechanics_Register(uint32_t inObjectType, uint32_t inObjectTypeIndex, char* inGroupName,
     179        uint32_t inSizeInMemory, OBJtMethods* inObjectMethods, uint32_t inFlags, void* inMechanicsMethods)
     180{
     181        if (strcmp("Trigger Volume", inGroupName) == 0) {
     182                inObjectMethods->rDraw = DD_OBJiTriggerVolume_Draw;
     183        }
     184        return Oni_ONrMechanics_Register(inObjectType, inObjectTypeIndex, inGroupName, inSizeInMemory, inObjectMethods, inFlags, inMechanicsMethods);
     185}
     186
     187
     188
    130189int DD_Patch_DebugNameTextureInit(short width, short height, int type, int allocated, int flags, char* name, void** output)
    131190{
     
    441500}
    442501
     502void DD_Patch_ShowTriggerVolumes()
     503{
     504        Oni_ONrMechanics_Register = DDrPatch_MakeDetour((void*)ONrMechanics_Register, (void*)DD_ONrMechanics_Register);
     505}
     506
    443507// Experiment with allowing enemies to be thrown over railings
    444508void DD_Patch_Throwtest()
     
    643707        if (patch_showalllasersights)
    644708                DD_Patch_ShowAllLasersights();
     709
     710        if (patch_showtriggervolumes)
     711                DD_Patch_ShowTriggerVolumes();
    645712       
    646713        if (patch_throwtest)
Note: See TracChangeset for help on using the changeset viewer.