mirror of
https://github.com/Cesarus85/ringfall-mjolnir-vr.git
synced 2026-10-18 15:00:26 +02:00
487 lines
8.9 KiB
C
487 lines
8.9 KiB
C
/*
|
|
PROGRESS_BAR.C
|
|
|
|
symbols in this file:
|
|
000D0D10 01b0:
|
|
_code_000d0d10 (0000)
|
|
000D0EC0 0050:
|
|
_code_000d0ec0 (0000)
|
|
000D0F10 0010:
|
|
_code_000d0f10 (0000)
|
|
000D0F20 0020:
|
|
_code_000d0f20 (0000)
|
|
000D0F40 0010:
|
|
_code_000d0f40 (0000)
|
|
000D0F50 00d0:
|
|
_tgaLoadHeader (0000)
|
|
000D1020 0010:
|
|
_code_000d1020 (0000)
|
|
000D1030 0020:
|
|
_code_000d1030 (0000)
|
|
000D1050 0090:
|
|
_tgaLoadImageData (0000)
|
|
000D10E0 0010:
|
|
_code_000d10e0 (0000)
|
|
000D10F0 0010:
|
|
_code_000d10f0 (0000)
|
|
000D1100 0050:
|
|
_tgaLoad (0000)
|
|
000D1150 0010:
|
|
_code_000d1150 (0000)
|
|
000D1160 0220:
|
|
_code_000d1160 (0000)
|
|
000D1380 0010:
|
|
_code_000d1380 (0000)
|
|
000D1390 0060:
|
|
_code_000d1390 (0000)
|
|
000D13F0 0090:
|
|
_progress_bar_initialize (0000)
|
|
000D1480 0010:
|
|
_progress_bar_dispose (0000)
|
|
000D1490 0030:
|
|
_progress_bar_begin (0000)
|
|
000D14C0 0010:
|
|
_code_000d14c0 (0000)
|
|
000D14D0 0020:
|
|
_progress_bar_end (0000)
|
|
000D14F0 0010:
|
|
_progress_bar_is_active (0000)
|
|
000D1500 0050:
|
|
_to_screen (0000)
|
|
000D1550 0110:
|
|
_generate_gravy_rect (0000)
|
|
000D1660 0010:
|
|
_code_000d1660 (0000)
|
|
000D1670 0010:
|
|
_code_000d1670 (0000)
|
|
000D1680 0020:
|
|
_code_000d1680 (0000)
|
|
000D16A0 0030:
|
|
_code_000d16a0 (0000)
|
|
000D16D0 0010:
|
|
_code_000d16d0 (0000)
|
|
000D16E0 0010:
|
|
_code_000d16e0 (0000)
|
|
000D16F0 0010:
|
|
_code_000d16f0 (0000)
|
|
000D1700 0030:
|
|
_gen_cloud_coord (0000)
|
|
000D1730 0040:
|
|
_gen_mask_coord (0000)
|
|
000D1770 0160:
|
|
_code_000d1770 (0000)
|
|
000D18D0 0060:
|
|
_code_000d18d0 (0000)
|
|
000D1930 0060:
|
|
_code_000d1930 (0000)
|
|
000D1990 0030:
|
|
_code_000d1990 (0000)
|
|
000D19C0 00a0:
|
|
_code_000d19c0 (0000)
|
|
000D1A60 0130:
|
|
_code_000d1a60 (0000)
|
|
000D1B90 0010:
|
|
_progress_bar_enable (0000)
|
|
000D1BA0 0010:
|
|
_code_000d1ba0 (0000)
|
|
000D1BB0 0010:
|
|
_code_000d1bb0 (0000)
|
|
000D1BC0 0010:
|
|
_code_000d1bc0 (0000)
|
|
000D1BD0 0020:
|
|
_code_000d1bd0 (0000)
|
|
000D1BF0 0010:
|
|
_code_000d1bf0 (0000)
|
|
000D1C00 0040:
|
|
_D3DXMatrixIdentity (0000)
|
|
000D1C40 0250:
|
|
_SetRenderStateSmart (0000)
|
|
000D1E90 0070:
|
|
_SetTextureStageStateSmart (0000)
|
|
000D1F00 04b0:
|
|
_code_000d1f00 (0000)
|
|
000D23B0 00b0:
|
|
_code_000d23b0 (0000)
|
|
000D2460 00d0:
|
|
_code_000d2460 (0000)
|
|
000D2530 00c0:
|
|
_progress_bar_eachframe (0000)
|
|
000D25F0 0490:
|
|
_code_000d25f0 (0000)
|
|
000D2A80 00a0:
|
|
_progress_bar_display (0000)
|
|
00271088 0148:
|
|
_D3DSIMPLERENDERSTATEENCODE (0000)
|
|
002711D0 0003:
|
|
??_C@_02JDPG@rb?$AA@ (0000)
|
|
002711D4 0004:
|
|
??_C@_03OAKNMOCF@z?$CFs?$AA@ (0000)
|
|
002711D8 000f:
|
|
??_C@_0P@HMFGDDOL@z?$CFsloading?4tga?$AA@ (0000)
|
|
002711E8 000f:
|
|
??_C@_0P@NFEHLENB@d?$CFsloading?4tga?$AA@ (0000)
|
|
002711F8 0014:
|
|
??_C@_0BE@GLEHOOPO@rect?9?$DOy0?5?$DM?5rect?9?$DOy1?$AA@ (0000)
|
|
0027120C 0014:
|
|
??_C@_0BE@PHIKGFLP@rect?9?$DOx0?5?$DM?5rect?9?$DOx1?$AA@ (0000)
|
|
00271220 0028:
|
|
??_C@_0CI@MFDDAKJL@c?3?2halo?2SOURCE?2interface?2progres@ (0000)
|
|
00271248 0004:
|
|
__real@42000000 (0000)
|
|
0027124C 0004:
|
|
__real@44400000 (0000)
|
|
00271250 0004:
|
|
__real@44200000 (0000)
|
|
00271258 0008:
|
|
__real@406e000000000000 (0000)
|
|
00271260 0008:
|
|
__real@4074000000000000 (0000)
|
|
00271268 0008:
|
|
__real@3fd3333340000000 (0000)
|
|
00271270 0008:
|
|
__real@400921cac083126f (0000)
|
|
00271278 0008:
|
|
__real@3fecccccc0000000 (0000)
|
|
00271280 0008:
|
|
__real@400921f9f01b866e (0000)
|
|
00271288 0008:
|
|
__real@3fc999999999999a (0000)
|
|
00271290 0008:
|
|
__real@3fa999999999999a (0000)
|
|
00271298 0004:
|
|
__real@3ca0a0a1 (0000)
|
|
0027129C 0004:
|
|
__real@3f7afafb (0000)
|
|
002712A0 0008:
|
|
__real@3fe8000000000000 (0000)
|
|
002712A8 0004:
|
|
__real@40490e56 (0000)
|
|
002712AC 0023:
|
|
??_C@_0CD@KJFNFKIK@?$CIprogress?$DO?$DN0?4f?$CJ?5?$CG?$CG?5?$CIprogress?$DM?$DN1?4@ (0000)
|
|
002FD5A8 47f1:
|
|
_data_002fd5a8 (0000)
|
|
_compressed_monk_tone (0008)
|
|
_delta_z (47e4)
|
|
_num_layers (47e8)
|
|
00454030 01f4:
|
|
_bss_00454030 (0000)
|
|
_progress_bar_mode (01d8)
|
|
_last_t (01ec)
|
|
*/
|
|
|
|
/* ---------- headers */
|
|
|
|
#include "interface/progress_bar.h"
|
|
#include "cache/cache_files.h"
|
|
|
|
/* ---------- constants */
|
|
|
|
/* ---------- macros */
|
|
|
|
/* ---------- structures */
|
|
|
|
struct d3dx_vector4
|
|
{
|
|
real x;
|
|
real y;
|
|
real z;
|
|
real w;
|
|
};
|
|
|
|
struct d3dx_matrix
|
|
{
|
|
real elements[4][4];
|
|
};
|
|
|
|
struct progress_bar_globals
|
|
{
|
|
long field0;
|
|
real initial_progress;
|
|
unsigned char reserved0[0xC0];
|
|
struct d3dx_matrix screen_transform;
|
|
unsigned char reserved1[0xD0];
|
|
};
|
|
|
|
struct progress_bar_data
|
|
{
|
|
boolean enabled;
|
|
unsigned char reserved[0x47F0];
|
|
};
|
|
|
|
struct progress_bar_mode
|
|
{
|
|
long state;
|
|
boolean capture_frame;
|
|
unsigned char padding0[3];
|
|
void *texture0;
|
|
void *texture1;
|
|
boolean active;
|
|
unsigned char padding1[3];
|
|
};
|
|
|
|
struct tga_image
|
|
{
|
|
unsigned char reserved[4];
|
|
unsigned char image_type;
|
|
unsigned char pixel_depth;
|
|
short width;
|
|
short height;
|
|
unsigned char padding[2];
|
|
unsigned long *pixels;
|
|
};
|
|
|
|
/* ---------- prototypes */
|
|
|
|
struct d3dx_vector4 *__stdcall D3DXVec4Transform(
|
|
struct d3dx_vector4 *output,
|
|
struct d3dx_vector4 const *input,
|
|
struct d3dx_matrix const *matrix);
|
|
|
|
int __stdcall SetThreadPriority(
|
|
void *thread,
|
|
int priority);
|
|
|
|
int __stdcall CreateDirectoryA(
|
|
const char *path,
|
|
void *security_attributes);
|
|
|
|
int __stdcall CopyFileA(
|
|
const char *existing_path,
|
|
const char *new_path,
|
|
int fail_if_exists);
|
|
|
|
void code_000d1f00(
|
|
real progress);
|
|
|
|
void code_000d25f0(
|
|
void);
|
|
|
|
void tgaLoadHeader(
|
|
FILE *file,
|
|
struct tga_image *image);
|
|
|
|
void tgaLoadImageData(
|
|
FILE *file,
|
|
struct tga_image *image);
|
|
|
|
void __stdcall D3DDevice_SetVertexData2f(
|
|
unsigned long register_index,
|
|
real x,
|
|
real y);
|
|
|
|
/* ---------- globals */
|
|
|
|
extern struct progress_bar_data data_002fd5a8;
|
|
struct progress_bar_globals bss_00454030;
|
|
struct progress_bar_mode progress_bar_mode;
|
|
|
|
/* ---------- public code */
|
|
|
|
void tgaLoadHeader(
|
|
FILE *file,
|
|
struct tga_image *image)
|
|
{
|
|
unsigned char ignored_byte;
|
|
short ignored_short;
|
|
|
|
fread(&ignored_byte, 1, 1, file);
|
|
fread(&ignored_byte, 1, 1, file);
|
|
fread(&image->image_type, 1, 1, file);
|
|
fread(&ignored_short, 2, 1, file);
|
|
fread(&ignored_short, 2, 1, file);
|
|
fread(&ignored_byte, 1, 1, file);
|
|
fread(&ignored_short, 2, 1, file);
|
|
fread(&ignored_short, 2, 1, file);
|
|
fread(&image->width, 2, 1, file);
|
|
fread(&image->height, 2, 1, file);
|
|
fread(&image->pixel_depth, 1, 1, file);
|
|
fread(&ignored_byte, 1, 1, file);
|
|
|
|
return;
|
|
}
|
|
|
|
void tgaLoadImageData(
|
|
FILE *file,
|
|
struct tga_image *image)
|
|
{
|
|
long y;
|
|
|
|
for (y= 0; y<image->height; y++)
|
|
{
|
|
long x;
|
|
unsigned long *pixel;
|
|
|
|
pixel= image->pixels + (image->height - y - 1)*image->width;
|
|
for (x= 0; x<image->width; x++)
|
|
{
|
|
unsigned char color[3];
|
|
unsigned long intensity;
|
|
|
|
fread(color, 1, 3, file);
|
|
intensity= color[0];
|
|
*pixel= ((intensity<<9) | (intensity & ~1))<<7 | intensity>>2;
|
|
pixel++;
|
|
}
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
void tgaLoad(
|
|
const char *path,
|
|
unsigned long *pixels)
|
|
{
|
|
struct tga_image image;
|
|
FILE *file;
|
|
|
|
file= fopen(path, "rb");
|
|
if (file)
|
|
{
|
|
tgaLoadHeader(file, &image);
|
|
image.pixels= pixels;
|
|
tgaLoadImageData(file, &image);
|
|
fclose(file);
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
void progress_bar_initialize(
|
|
void)
|
|
{
|
|
char destination_directory[40];
|
|
char map_directory[40];
|
|
char destination_path[40];
|
|
char source_path[40];
|
|
|
|
csstrcpy(map_directory, cache_files_map_directory());
|
|
sprintf(source_path, "d%sloading.tga", map_directory + 1);
|
|
sprintf(destination_path, "z%sloading.tga", map_directory + 1);
|
|
sprintf(destination_directory, "z%s", map_directory + 1);
|
|
destination_directory[csstrlen(destination_directory) - 1]= 0;
|
|
CreateDirectoryA(destination_directory, NULL);
|
|
CopyFileA(source_path, destination_path, TRUE);
|
|
|
|
return;
|
|
}
|
|
|
|
void progress_bar_dispose(
|
|
void)
|
|
{
|
|
return;
|
|
}
|
|
|
|
void progress_bar_begin(
|
|
boolean skip_frame_capture)
|
|
{
|
|
progress_bar_mode.capture_frame= !skip_frame_capture;
|
|
progress_bar_mode.active= TRUE;
|
|
SetThreadPriority((void *)-2, 2);
|
|
|
|
return;
|
|
}
|
|
|
|
void progress_bar_end(
|
|
void)
|
|
{
|
|
progress_bar_mode.active= FALSE;
|
|
SetThreadPriority((void *)-2, 0);
|
|
|
|
return;
|
|
}
|
|
|
|
boolean progress_bar_is_active(
|
|
void)
|
|
{
|
|
return progress_bar_mode.active;
|
|
}
|
|
|
|
void progress_bar_enable(
|
|
boolean enabled)
|
|
{
|
|
data_002fd5a8.enabled= enabled;
|
|
|
|
return;
|
|
}
|
|
|
|
void progress_bar_display(
|
|
real progress)
|
|
{
|
|
#line 827 "c:\\halo\\SOURCE\\interface\\progress_bar.c"
|
|
match_assert(__FILE__, __LINE__, (progress>=0.f) && (progress<=1.f));
|
|
|
|
if (progress_bar_mode.active && progress>0.f)
|
|
{
|
|
if (!progress_bar_mode.texture0)
|
|
{
|
|
code_000d25f0();
|
|
bss_00454030.initial_progress= progress;
|
|
}
|
|
|
|
if (data_002fd5a8.enabled)
|
|
{
|
|
code_000d1f00((progress - bss_00454030.initial_progress) / (1.f - bss_00454030.initial_progress));
|
|
}
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
/* ---------- private code */
|
|
|
|
void to_screen(
|
|
real x,
|
|
real y,
|
|
real z,
|
|
real *screen_x,
|
|
real *screen_y)
|
|
{
|
|
struct d3dx_vector4 input;
|
|
struct d3dx_vector4 output;
|
|
|
|
input.x = x;
|
|
input.y = y;
|
|
input.z = z;
|
|
input.w = 1.0f;
|
|
D3DXVec4Transform(&output, &input, &bss_00454030.screen_transform);
|
|
*screen_x = output.x / output.w;
|
|
*screen_y = output.y / output.w;
|
|
return;
|
|
}
|
|
|
|
boolean code_000d1150(
|
|
void)
|
|
{
|
|
boolean result;
|
|
|
|
result= progress_bar_mode.texture0 != NULL;
|
|
|
|
return result;
|
|
}
|
|
|
|
void gen_cloud_coord(
|
|
real x,
|
|
real y,
|
|
real offset)
|
|
{
|
|
D3DDevice_SetVertexData2f(10, x*32.f + offset, y*20.f);
|
|
|
|
return;
|
|
}
|
|
|
|
void gen_mask_coord(
|
|
real x,
|
|
real y,
|
|
real mask_position)
|
|
{
|
|
D3DDevice_SetVertexData2f(10, x - (mask_position*768.f - 64.f - 64.f), y*0.033333335f);
|
|
|
|
return;
|
|
}
|
|
|
|
void code_000d16d0(
|
|
void)
|
|
{
|
|
return;
|
|
}
|