/* TDKPIN-specific TWindow-derived constructors from Code1. */ #include "tdkpin_game_windows.h" static void write_far( Win16FarPtr base, uint16_t offset, Win16FarPtr value) { win16_write_u16(base, offset, win16_far_offset(value)); win16_write_u16( base, (uint16_t)(offset + 2), win16_far_selector(value)); } /* 1000:01d3 -- fixed 640x480 main window centered on the Win16 screen. */ Win16FarPtr tdkpin_main_window_construct( Win16FarPtr window, uint16_t vmt, Win16FarPtr title, Win16FarPtr parent) { BorlandObjectCallFrame frame = {window, vmt}; if (!borland_enter_object_constructor(&frame, 0)) { return frame.object; } frame.object = object_windows_window_construct( frame.object, 0, title, parent); win16_write_u16(frame.object, 0x2d, 640); win16_write_u16(frame.object, 0x2f, 480); INT16 x = (INT16)(GetSystemMetrics16(0) / 2 - 640 / 2); INT16 y = (INT16)(GetSystemMetrics16(1) / 2 - 480 / 2); win16_write_u16(frame.object, 0x29, (uint16_t)x); win16_write_u16(frame.object, 0x2b, (uint16_t)y); win16_write_u32(frame.object, 0x21, 0x86ca0000u); return frame.object; } /* 1000:5aea -- centered 360x300 child/overlay window with additive styles. */ Win16FarPtr tdkpin_centered_child_window_construct( Win16FarPtr window, uint16_t vmt, Win16FarPtr title, Win16FarPtr parent) { BorlandObjectCallFrame frame = {window, vmt}; if (!borland_enter_object_constructor(&frame, 0)) { return frame.object; } frame.object = object_windows_window_construct( frame.object, 0, title, parent); write_far(frame.object, 0x41, parent); win16_write_u16(frame.object, 0x2d, 360); win16_write_u16(frame.object, 0x2f, 300); win16_write_u16(frame.object, 0x29, 140); win16_write_u16(frame.object, 0x2b, 80); uint32_t style = win16_read_u32(win16_far_add_offset(frame.object, 0x21)); win16_write_u32(frame.object, 0x21, style | 0x46800002u); (void)SetFocus16(win16_read_u16(win16_far_add_offset(frame.object, 4))); return frame.object; } /* 1000:6073 -- fixed 640x460 origin window with replaced style dword. */ Win16FarPtr tdkpin_full_child_window_construct( Win16FarPtr window, uint16_t vmt, Win16FarPtr title, Win16FarPtr parent) { BorlandObjectCallFrame frame = {window, vmt}; if (!borland_enter_object_constructor(&frame, 0)) { return frame.object; } frame.object = object_windows_window_construct( frame.object, 0, title, parent); write_far(frame.object, 0x41, parent); win16_write_u16(frame.object, 0x2d, 640); win16_write_u16(frame.object, 0x2f, 460); win16_write_u16(frame.object, 0x29, 0); win16_write_u16(frame.object, 0x2b, 0); win16_write_u32(frame.object, 0x21, 0x46000002u); (void)SetFocus16(win16_read_u16(win16_far_add_offset(frame.object, 4))); return frame.object; }