Changeset 984 for Daodan/src/patches


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

Daodan: TV code

Location:
Daodan/src/patches
Files:
1 added
2 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • 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.