102 Dalmatians: Puppies to the Rescue
Decompilation Source Reference |
GitLab repository
Toggle main menu visibility
Loading...
Searching...
No Matches
diagnostics.c
Go to the documentation of this file.
1
/* Recovered game implementation; original addresses identify provenance. */
2
#include "
pcdogs/actor/types.h
"
3
#include "
pcdogs/camera/globals.h
"
4
#include "
pcdogs/platform/globals.h
"
5
#include "
pcdogs/debug/functions.h
"
6
#include "
pcdogs/debug/globals.h
"
7
#include "
pcdogs/entity/types.h
"
8
#include "
pcdogs/image/globals.h
"
9
#include "
pcdogs/image/storage.h
"
10
#include "
pcdogs/level/types.h
"
11
#include "
pcdogs/package/globals.h
"
12
#include "
pcdogs/runtime/functions.h
"
13
#include "
pcdogs/ui/functions.h
"
14
15
// Original pcdogs.exe: 0x4176c0
16
// Writes each non-null message and category to the open debug log, flushing after each write. The formatted buffer is passed directly as the output format string.
17
void
Debug_Log
(
char
const
*category,
char
const
*message)
18
{
19
if
(!
g_debugLogFile
)
20
return
;
21
22
if
(message)
23
{
24
String_FormatCRTString
(
Debug_LogMessageBuffer
,
Debug_Log_LineFormat
, message);
25
CRT_fprintf
(
g_debugLogFile
,
Debug_LogMessageBuffer
);
26
CRT_fflush
(
g_debugLogFile
);
27
}
28
29
if
(!category)
30
return
;
31
32
String_FormatCRTString
(
Debug_LogMessageBuffer
,
Debug_Log_LineFormat
, category);
33
CRT_fprintf
(
g_debugLogFile
,
Debug_LogMessageBuffer
);
34
CRT_fflush
(
g_debugLogFile
);
35
}
36
37
// Original pcdogs.exe: 0x43cf20
38
// Renders the tracked actor's position and the current frame rate as debug text.
39
void
Debug_RenderOverlay
()
40
{
41
struct
Math_Vec3I32
position = {0};
42
struct
Level_Data
*level =
pkg_resource_current_level_data
;
43
if
(level)
44
{
45
const
struct
Actor
*actor = level->
entity_array
[(uint16_t)level->
current_entity_index
].
runtime_actor
;
46
if
(actor)
47
position
= actor->
position
;
48
}
49
50
char
text[256];
51
String_FormatCRTString
(text,
STR_DEBUG_POS_FORMAT
,
52
(
double
)
position
.
x
*
camera_debug_pos_scale
, (
double
)
position
.
y
*
camera_debug_pos_scale
,
53
(
double
)
position
.
z
*
camera_debug_pos_scale
);
54
UI_RenderText
(0x14000a, text, 0, NULL);
55
String_FormatCRTString
(text,
STR_DEBUG_FPS_FORMAT
, (
double
)
g_currentFPS
);
56
UI_RenderText
(0x46012c, text, 0, NULL);
57
}
types.h
globals.h
camera_debug_pos_scale
#define camera_debug_pos_scale
Definition
globals.h:21
functions.h
globals.h
g_debugLogFile
#define g_debugLogFile
Definition
globals.h:12
Debug_LogMessageBuffer
#define Debug_LogMessageBuffer
Definition
globals.h:18
Debug_Log_LineFormat
#define Debug_Log_LineFormat
Definition
globals.h:14
Debug_Log
void Debug_Log(char const *category, char const *message)
Definition
diagnostics.c:17
Debug_RenderOverlay
void Debug_RenderOverlay()
Definition
diagnostics.c:39
types.h
globals.h
types.h
globals.h
pkg_resource_current_level_data
#define pkg_resource_current_level_data
Definition
globals.h:117
globals.h
STR_DEBUG_POS_FORMAT
#define STR_DEBUG_POS_FORMAT
Definition
globals.h:102
STR_DEBUG_FPS_FORMAT
#define STR_DEBUG_FPS_FORMAT
Definition
globals.h:99
functions.h
CRT_fprintf
int32_t CRT_fprintf(struct File_Handle *stream, char const *format,...)
Definition
formatting.c:47
CRT_fflush
int32_t CRT_fflush(struct File_Handle *stream)
Definition
stdio.c:17
String_FormatCRTString
int32_t String_FormatCRTString(char *buffer, char const *format,...)
Definition
formatting.c:18
storage.h
Actor
Definition
types.h:118
Actor::position
struct Math_Vec3I32 position
Definition
types.h:132
Entity::runtime_actor
struct Actor * runtime_actor
Definition
types.h:107
Level_Data
Definition
types.h:40
Level_Data::current_entity_index
int16_t current_entity_index
Definition
types.h:43
Level_Data::entity_array
struct Entity * entity_array
Definition
types.h:45
Math_Vec3I32
Definition
types.h:469
Math_Vec3I32::y
int32_t y
Definition
types.h:471
Math_Vec3I32::x
int32_t x
Definition
types.h:470
Math_Vec3I32::z
int32_t z
Definition
types.h:472
functions.h
UI_RenderText
void UI_RenderText(uint32_t packed_xy, char const *text, uint32_t text_flags, void *font_context)
Definition
text.c:226
g_currentFPS
#define g_currentFPS
Definition
values.h:492
src
debug
diagnostics.c
Generated by
1.17.0