ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/Daodan/src/patches/Patches.c
(Generate patch)

Comparing Daodan/src/patches/Patches.c (file contents):
Revision 983 by alloc, Sun Mar 16 20:06:52 2014 UTC vs.
Revision 984 by alloc, Sun Mar 16 23:35:10 2014 UTC

# Line 12 | Line 12
12   #include "../flatline/Flatline_BSL.h"
13   #include "../flatline/Flatline_Hooks.h"
14   #include "../Oni.h"
15 < //#include "Objt.h"
15 > #include "objt.h"
16  
17   typedef int (__cdecl *CHINESEPROC)(DWORD ThreadId);
18  
# Line 127 | Line 127 | int16_t ONICALL DD_COrTextArea_Resize(vo
127          return Oni_COrTextArea_Resize(inTextArea, inBounds, inNumTextEntries);
128   }
129  
130 + #define IMcShade_Red (0xFFFF0000)
131 + #define IMcShade_Green (0xFF00FF00)
132 + #define IMcShade_Blue (0xFF0000FF)
133 + void 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;
178 + int16_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 +
189   int DD_Patch_DebugNameTextureInit(short width, short height, int type, int allocated, int flags, char* name, void** output)
190   {
191          //flags = (1 << 10);
# Line 440 | Line 499 | void DD_Patch_ShowAllLasersights()
499          DDrPatch_NOOP((char*)(OniExe + 0x000E1957), 6 );
500   }
501  
502 + void DD_Patch_ShowTriggerVolumes()
503 + {
504 +        Oni_ONrMechanics_Register = DDrPatch_MakeDetour((void*)ONrMechanics_Register, (void*)DD_ONrMechanics_Register);
505 + }
506 +
507   // Experiment with allowing enemies to be thrown over railings
508   void DD_Patch_Throwtest()
509   {
# Line 642 | Line 706 | bool DD_Patch_Init()
706  
707          if (patch_showalllasersights)
708                  DD_Patch_ShowAllLasersights();
709 +
710 +        if (patch_showtriggervolumes)
711 +                DD_Patch_ShowTriggerVolumes();
712          
713          if (patch_throwtest)
714                  DD_Patch_Throwtest();

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)