다마고치 연구소 한국어판 소스 공개
This commit is contained in:
commit
db23855630
661 files changed
+503597
No files matched your search
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
# Wolf3D for the Paradise (arm-none-eabi-gcc, newlib-nano). Output: ../../wolf.bin (program into PRAM, up to 64 KB)
|
||||
# SOD=1: Spear of Destiny (-DSPEAR), output ../../wolfsod.bin
|
||||
set -e
|
||||
cd "$(dirname "$0")/.."
|
||||
E=../../emu/src/emu
|
||||
N=wolf; [ -n "$SOD" ] && { N=wolfsod; XCF="-DSPEAR $XCF"; }
|
||||
CF="-mcpu=cortex-m3 -mthumb -Os -ffunction-sections -fdata-sections -fno-common -w -DPARAMIX -DPMX_SD_IN_TICK -Iw4 -Ipmx -DFAST_LCD -DLCD_FASTCLK -DTONE_FIX -DHW_TONE_RESTART -DTONE_SAFE -DBL_SLEEP -DPARA_BACK -DPARA_MB_KEEP -DBL_PWM -DBL_MR3RST -DGPLAY -DEXIT_KEY $XCF"
|
||||
mkdir -p dev/obj; rm -f dev/obj/*.o
|
||||
for f in w4/*.c pmx/*.c dev/paradise.c $E/hw.c $E/flash.c; do
|
||||
n=$(basename $f .c); arm-none-eabi-gcc $CF -c $f -o dev/obj/$n.o; done
|
||||
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -nostartfiles --specs=nano.specs -Wl,--gc-sections -Wl,-Map=dev/wolf.map -Wl,--noinhibit-exec -T dev/link.ld dev/obj/*.o -lc -lgcc -o dev/wolf.elf
|
||||
arm-none-eabi-objcopy -O binary -j .text -j .data -j .scode --gap-fill 0xff dev/wolf.elf dev/wolf.bin
|
||||
arm-none-eabi-size -A dev/wolf.elf | grep -v "debug\|^$\|comment\|ARM"
|
||||
cp dev/wolf.bin ../$N.bin; rm -rf dev/obj dev/wolf.bin; [ -n "$KEEPELF" ] || rm -f dev/wolf.elf dev/wolf.map; ls -l ../$N.bin
|
||||
@@ -0,0 +1,37 @@
|
||||
/* Wolf3D on the Paradise: PRAM (64 KB, loaded by the menu: code and the start values of .data) and a second part of
|
||||
* code for the SRAM behind .bss, which lies behind the first 64 KB in wolf.bin; the program copies it from the flash
|
||||
* once the flash window is on again (the stub starts us with a system reset, which switches it off).
|
||||
* Not the RAM at 0x20000000: it has only 4 KB (mirrored), with the mailbox of the programs at its end. */
|
||||
ENTRY(Reset_Handler)
|
||||
MEMORY {
|
||||
PRAM (rwx) : ORIGIN = 0x00000000, LENGTH = 0x10000
|
||||
R20L (r) : ORIGIN = 0x00010000, LENGTH = 0x20000
|
||||
SRAM (rw) : ORIGIN = 0x18000000, LENGTH = 0x1F000
|
||||
}
|
||||
SECTIONS {
|
||||
.text : {
|
||||
KEEP(*(.vectors))
|
||||
KEEP(*(.pmxcfg))
|
||||
*(EXCLUDE_FILE(*pmx_main.o *pmx_save.o *wl_game.o *wl_utils.o *lib_a-*printf*.o *lib_a-*vfprintf*.o *lib_a-*vfiprintf*.o *libc_a-*printf*.o *libc_a-*vfprintf*.o *libc_a-*vfiprintf*.o *_udivmoddi4.o) .text*)
|
||||
*(EXCLUDE_FILE(*pmx_main.o *pmx_save.o *wl_game.o *wl_utils.o) .rodata*)
|
||||
KEEP(*(.initcode)) KEEP(*(.initdata*)) KEEP(*(.initcode_z))
|
||||
. = ALIGN(4);
|
||||
__prog_end = .;
|
||||
} > PRAM
|
||||
ASSERT(__prog_end <= 0x10000, "program too big for PRAM")
|
||||
__pram_used = LOADADDR(.data) + SIZEOF(.data);
|
||||
ASSERT(__pram_used <= 0x10000, "program and its data too big for PRAM")
|
||||
.data : { __data_start = .; *(.data*) . = ALIGN(4); __data_end = .; } > SRAM AT > PRAM
|
||||
__data_load = LOADADDR(.data);
|
||||
__load_end = LOADADDR(.data) + SIZEOF(.data);
|
||||
.bss (NOLOAD) : { __bss_start = .; *(.bss*) *(COMMON) . = ALIGN(4); __bss_end = .; } > SRAM
|
||||
.scode : {
|
||||
__sc_start = .;
|
||||
*(.text*) *(.rodata*)
|
||||
. = ALIGN(4);
|
||||
__sc_end = .;
|
||||
} > SRAM AT > R20L
|
||||
__sc_load = LOADADDR(.scode);
|
||||
ASSERT(__sc_end <= 0x1801C000, "RAM full (16 KB stay for the stack)")
|
||||
/DISCARD/ : { *(.comment) *(.ARM.*) *(.note*) *(.init) *(.fini) *(.init_array*) *(.fini_array*) *(.eh_frame) }
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
/* Paramix Wolf3D on the Tamagotchi Paradise: started from the Paramix menu like the other further programs.
|
||||
* The data pack (made by the Studio from the user's own game files) lies in the flash; the cached flash window
|
||||
* (1 MB from 0x10000000) is put on it, anything behind the first MB is read through the uncached window.
|
||||
* Settings block "PMXW" at 0x140 (filled in by the Studio): pack, its length, save area, flags, name, keys.
|
||||
* Author: mameise. GPL-2.0-or-later. */
|
||||
#include "../../../emu/src/emu/hw.h"
|
||||
#include "../../../emu/src/emu/flash.h"
|
||||
#define PARA_ATTR
|
||||
#include "../../../emu/src/emu/paraclock.h"
|
||||
#ifdef PARA_BACK
|
||||
#include "../../../emu/src/emu/paraback.h"
|
||||
#ifdef GPLAY
|
||||
#define GP_POINTS
|
||||
#include "../../../emu/src/emu/gplay.h"
|
||||
#endif
|
||||
#endif
|
||||
#include "../pmx/pmx_plat.h"
|
||||
#include <string.h>
|
||||
|
||||
typedef int s32;
|
||||
/* keys: masks A 1, B 2, C 4, wheel press 8; fire, forward, back, use, hold key; run with B twice; turn degrees per step
|
||||
* flags: bit 0 English, bit 1 wheel the other way round. save_off: 4 KB settings, then the saved game (60 KB). */
|
||||
typedef struct { u32 magic, version, rom_off, rom_len, save_off, flags; char name[16]; u8 k_fire, k_fwd, k_back, k_use, k_mod, run_dbl, turn_deg, r0; u32 prog_off; } WolfCfg;
|
||||
#define WOLF_MAGIC 0x57584D50u /* "PMXW" */
|
||||
__attribute__((section(".pmxcfg"), used))
|
||||
volatile const WolfCfg g_cfg = { WOLF_MAGIC, 1, 0, 0, 0, 0, "WOLFENSTEIN 3D", 1, 2, 4, 8, 4, 1, 15, 0, 0 };
|
||||
#define XIP_BASE_REG REG(0x4002F004u)
|
||||
#define XIP_CTRL_REG REG(0x4002F000u)
|
||||
#define WIN ((const u8 *)0x10000000u)
|
||||
#define WIN_LEN 0x100000u
|
||||
|
||||
/* ---- time: SysTick 1 ms; the wheel's encoder and the sound are served here ---- */
|
||||
static volatile u32 g_ms;
|
||||
static volatile s32 g_enc_acc; static u32 g_enc_last;
|
||||
static const signed char QD[16] = { 0, -1, 1, 0, 1, 0, 0, -1, -1, 0, 0, 1, 0, 1, -1, 0 };
|
||||
#define GPIO2 0x4001A000u
|
||||
#define SYST_CSR REG(0xE000E010u)
|
||||
#define SYST_RVR REG(0xE000E014u)
|
||||
#define SYST_CVR REG(0xE000E018u)
|
||||
#define CORE_HZ 96000000u
|
||||
void pmx_sd_service (uint32_t now);
|
||||
__attribute__((used)) void systick_c(void)
|
||||
{
|
||||
u32 ms = ++g_ms;
|
||||
u32 n = REG(GPIO2) & 3u;
|
||||
if (n != g_enc_last) { g_enc_acc += QD[(g_enc_last << 2) | n]; g_enc_last = n; }
|
||||
pmx_sd_service(ms);
|
||||
}
|
||||
__attribute__((naked)) void SysTick_Handler(void) { __asm__ volatile("b systick_c\n"); }
|
||||
|
||||
uint32_t plat_ms(void) { return g_ms; }
|
||||
void plat_wait(uint32_t ms) { u32 t0 = g_ms; hw_wdt_feed(); while (g_ms - t0 < ms) __asm__ volatile("wfi"); }
|
||||
#include "../../../emu/src/emu/exitkey.h"
|
||||
/* 1.7.3 test12: the way back chosen in the Studio (tab Menu); without EXIT_KEY the wheel 2 s as before */
|
||||
int plat_exit(uint32_t held) { return EXIT_NOW(held, 2000u); }
|
||||
uint32_t plat_keys(void) { hw_wdt_feed(); return hw_buttons() & 15u; }
|
||||
int plat_wheel(void)
|
||||
{
|
||||
s32 a = g_enc_acc, d = 0;
|
||||
while (a >= 4) { a -= 4; d++; }
|
||||
while (a <= -4) { a += 4; d--; }
|
||||
if (d) { __asm__ volatile("cpsid i"); g_enc_acc -= 4 * d; __asm__ volatile("cpsie i"); }
|
||||
return d;
|
||||
}
|
||||
static u16 g_row[128] __attribute__((aligned(4)));
|
||||
void plat_lcd(const u8 *fb, int y0, int y1, const u16 *lut)
|
||||
{
|
||||
hw_wdt_feed();
|
||||
hw_px_begin(0, (u32)y0, 128, (u32)y1);
|
||||
for (int y = y0; y < y1; y++) { const u8 *f = fb + y * 128; for (int x = 0; x < 128; x++) g_row[x] = lut[f[x]]; hw_px_row(g_row, 128); }
|
||||
hw_px_end();
|
||||
}
|
||||
void plat_tone(uint32_t hz) { hw_tone(hz); }
|
||||
const u8 *plat_pack(void) { return WIN; }
|
||||
/* the pack beyond the cached first MB: through the uncached window */
|
||||
const u8 *plat_pack_far(void) { return (const u8 *)(0x60000000u + g_cfg.rom_off); }
|
||||
uint32_t plat_pack_win(void) { return WIN_LEN; }
|
||||
|
||||
static u8 g_sec[0x1000] __attribute__((aligned(4)));
|
||||
void plat_save_at(uint32_t off, void *dst, int len)
|
||||
{
|
||||
const volatile u8 *p = XIP_PTR(g_cfg.save_off + 0x1000u + off); u8 *d = (u8 *)dst;
|
||||
if (off + (uint32_t)len > 0xF000u) return;
|
||||
for (int i = 0; i < len; i++) d[i] = p[i];
|
||||
}
|
||||
void pmx_sd_halt(void);
|
||||
void plat_save_page(uint32_t off, const void *src, int len)
|
||||
{
|
||||
if (off + 0x1000u > 0xF000u) return;
|
||||
pmx_sd_halt();
|
||||
for (int i = 0; i < 0x1000; i++) g_sec[i] = i < len ? ((const u8 *)src)[i] : 0xFF;
|
||||
hw_wdt_feed();
|
||||
flash_update4k(g_cfg.save_off + 0x1000u + off, g_sec);
|
||||
}
|
||||
int plat_settings_read(void *buf, int len)
|
||||
{
|
||||
const volatile u8 *p = XIP_PTR(g_cfg.save_off); u8 *d = (u8 *)buf;
|
||||
for (int i = 0; i < len; i++) d[i] = p[i];
|
||||
return len;
|
||||
}
|
||||
void plat_settings_write(const void *buf, int len)
|
||||
{
|
||||
for (int i = 0; i < 0x1000; i++) g_sec[i] = i < len ? ((const u8 *)buf)[i] : 0xFF;
|
||||
pmx_sd_halt();
|
||||
flash_update4k(g_cfg.save_off, g_sec);
|
||||
}
|
||||
|
||||
void plat_back(void)
|
||||
{
|
||||
__asm__ volatile("cpsid i");
|
||||
SYST_CSR = 0;
|
||||
hw_tone(0);
|
||||
REG(0x20000FF8u) = 0;
|
||||
REG(0x20000FFCu) = 0x4C584D50u; /* "PMXL": back on purpose, the autostart stays off */
|
||||
#ifdef PARA_BACK
|
||||
#ifdef GPLAY
|
||||
para_points((uint8_t *)g_sec); /* 1.7.2 test14: play time to Tamapoints */
|
||||
#endif
|
||||
para_back_fix(g_sec);
|
||||
#endif
|
||||
hw_bl_pwm_off();
|
||||
for (u32 t = 0; hw_buttons() && t < 20000000u; t++) if ((t & 0xFFFFu) == 0) hw_wdt_feed();
|
||||
XIP_BASE_REG = 0x60011000u; XIP_CTRL_REG = 3u;
|
||||
hw_back_to_paradise();
|
||||
for (;;) {}
|
||||
}
|
||||
|
||||
/* ---- a message on the screen, then back ---- */
|
||||
void pmx_text(int x, int y, const char *s, int color);
|
||||
u8 *pmx_screen(void);
|
||||
const u16 *pmx_lut(void);
|
||||
void plat_fatal(const char *s)
|
||||
{
|
||||
u8 *fb = pmx_screen();
|
||||
memset(fb, 0, 128 * 128);
|
||||
pmx_text(2, 50, "FEHLER", 15);
|
||||
pmx_text(2, 62, s, 15);
|
||||
plat_lcd(fb, 0, 128, pmx_lut());
|
||||
for (u32 t0 = g_ms; g_ms - t0 < 5000u; ) { hw_wdt_feed(); if (hw_buttons()) break; }
|
||||
plat_back();
|
||||
}
|
||||
void pmx_error(const char *s) { plat_fatal(s); }
|
||||
|
||||
/* newlib bits nobody needs here */
|
||||
void *_sbrk(int n) { (void)n; return (void *)-1; }
|
||||
void abort(void) { plat_fatal("ABORT"); for (;;) {} }
|
||||
|
||||
void pmx_main(void);
|
||||
void pmx_cfg_keys(uint32_t fire, uint32_t fwd, uint32_t back, uint32_t use, uint32_t mod, uint32_t run_dbl, uint32_t invert, uint32_t turn_deg, uint32_t english);
|
||||
extern u32 __bss_start, __bss_end;
|
||||
void Reset_Handler(void)
|
||||
{
|
||||
__asm__ volatile("cpsid i");
|
||||
u32 cnt = REG(0x45000304u), para = para_clock(cnt, 0, 0x1F000u, 0, 0);
|
||||
if (!para) para = para_mailbox(cnt);
|
||||
#ifdef PARA_BACK
|
||||
para_leave_mark(cnt, para);
|
||||
#endif
|
||||
__asm__ volatile("" ::: "memory");
|
||||
for (u32 *p = &__bss_start; p < &__bss_end; p++) *p = 0;
|
||||
{ extern u32 __data_start, __data_end, __data_load; /* start values of .data: in PRAM with the code */
|
||||
const u32 *src = &__data_load; for (u32 *p = &__data_start; p < &__data_end; p++) *p = *src++; }
|
||||
(void)para;
|
||||
REG(0xE000ED14u) &= ~(1u << 3); /* UNALIGN_TRP off (as DOOM: plain LDR/STR may be unaligned) */
|
||||
hw_init(); /* also switches the flash window on again */
|
||||
hw_tone(0);
|
||||
/* the second part (code for the SRAM behind .bss) lies behind the first 64 KB of the program in the flash
|
||||
* (g_cfg.prog_off, set by the Studio). The stub starts us with a system reset; only now (hw_init) can the flash be read. */
|
||||
{ extern u32 __sc_start, __sc_end, __sc_load;
|
||||
const volatile u32 *src = (const volatile u32 *)XIP_PTR(g_cfg.prog_off + (u32)&__sc_load);
|
||||
for (u32 *p = &__sc_start; p < &__sc_end; p++) { *p = *src++; }
|
||||
__asm__ volatile("dsb\n isb" ::: "memory"); }
|
||||
XIP_BASE_REG = 0x60000000u | g_cfg.rom_off; /* the pack in the cached window from 0x10000000 */
|
||||
XIP_CTRL_REG = 3u;
|
||||
__asm__ volatile("dsb\n isb" ::: "memory");
|
||||
/* the window's cache keeps lines of the old base: reading 64 KB elsewhere in it throws them out (as DOOM) */
|
||||
{ volatile u32 sum = 0; for (u32 i = 0; i < 0x4000u; i++) sum += *(const volatile u32 *)(0x100C0000u + 4u * i); (void)sum; }
|
||||
REG(GPIO2 + 0x04) &= ~3u; g_enc_last = REG(GPIO2) & 3u;
|
||||
pmx_cfg_keys(g_cfg.k_fire, g_cfg.k_fwd, g_cfg.k_back, g_cfg.k_use, g_cfg.k_mod, g_cfg.run_dbl, (g_cfg.flags >> 1) & 1u, g_cfg.turn_deg, g_cfg.flags & 1u);
|
||||
SYST_RVR = CORE_HZ / 1000u - 1u; SYST_CVR = 0; SYST_CSR = 7;
|
||||
__asm__ volatile("cpsie i");
|
||||
pmx_main();
|
||||
plat_back();
|
||||
}
|
||||
|
||||
/* a fault: "FEHLER" with the address on the screen, a key goes back to the Paradise (instead of hanging) */
|
||||
static void hex8(char *o, u32 v) { for (int i = 0; i < 8; i++) { u32 d = (v >> (28 - 4 * i)) & 15u; o[i] = (char)(d < 10 ? '0' + d : 'A' + d - 10); } o[8] = 0; }
|
||||
__attribute__((used)) void fault_c(u32 *sp, u32 lr)
|
||||
{
|
||||
char a[24] = "PC ", b[24] = "LR ", c[24] = "FS ";
|
||||
hex8(a + 3, sp[6]); hex8(b + 3, sp[5]); hex8(c + 3, REG(0xE000ED28u));
|
||||
(void)lr;
|
||||
hw_tone(0);
|
||||
u8 *fb = pmx_screen();
|
||||
memset(fb, 0, 128 * 128);
|
||||
pmx_text(2, 40, "FEHLER", 15); pmx_text(2, 52, a, 15); pmx_text(2, 62, b, 15); pmx_text(2, 72, c, 15);
|
||||
plat_lcd(fb, 0, 128, pmx_lut());
|
||||
while (hw_buttons()) hw_wdt_feed();
|
||||
while (!hw_buttons()) hw_wdt_feed();
|
||||
plat_back();
|
||||
}
|
||||
__attribute__((naked)) static void Default_Handler(void)
|
||||
{
|
||||
__asm__ volatile("tst lr, #4\n ite eq\n mrseq r0, msp\n mrsne r0, psp\n mov r1, lr\n ldr r2, =0x18020000\n mov sp, r2\n b fault_c\n .ltorg");
|
||||
}
|
||||
__attribute__((naked)) static void Irq_Off(void) { __asm__ volatile("cpsid i\n bx lr\n"); }
|
||||
__attribute__((section(".vectors"), used))
|
||||
const void *const g_vectors[16 + 64] = { (void *)0x18020000u, (void *)Reset_Handler,
|
||||
[2 ... 10] = (void *)Default_Handler, [11] = (void *)Irq_Off, [12 ... 13] = (void *)Default_Handler, [14] = (void *)Irq_Off,
|
||||
[15] = (void *)SysTick_Handler, [16 ... 79] = (void *)Irq_Off
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
# PC test runner (gcc): ./host/wolfhost
|
||||
set -e
|
||||
cd "$(dirname "$0")/.."
|
||||
gcc -O1 -g -w -fno-pie -DPARAMIX -Iw4 -Ipmx $XCF w4/*.c pmx/*.c host/host.c -lm -no-pie -o host/wolfhost
|
||||
@@ -0,0 +1,113 @@
|
||||
/* Paramix Wolf3D on the PC (test runner): the pack from a file, a virtual clock, keys from a script,
|
||||
* pictures as PPM, the buzzer as a list. No window.
|
||||
* ./wolfhost pack.bin seconds [KEYS="t:mask,..."] [WHEEL="t:steps,..."] [SHOTS="t,t,..."] [OUT=dir]
|
||||
* mask: A 1, B 2, C 4, wheel press 8. Author: mameise. */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <setjmp.h>
|
||||
#include "pmx_plat.h"
|
||||
|
||||
void pmx_main (void);
|
||||
static uint8_t *g_pack;
|
||||
static uint32_t g_ms;
|
||||
static double g_end;
|
||||
static jmp_buf g_quit;
|
||||
static const char *g_out = ".";
|
||||
typedef struct { double t; long v; } Ev;
|
||||
static Ev g_keys[256], g_wheel[256]; static int n_keys, n_wheel, i_wheel;
|
||||
static double g_shots[256]; static int n_shots, i_shot;
|
||||
static uint8_t g_last[128 * 128 * 3];
|
||||
static long g_frames;
|
||||
static FILE *g_tones;
|
||||
|
||||
static int parse (const char *s, Ev *e, int max)
|
||||
{
|
||||
int n = 0; if (!s) return 0;
|
||||
while (*s && n < max) { double t; long v; int k; if (sscanf (s, "%lf:%ld%n", &t, &v, &k) != 2) break; e[n].t = t; e[n].v = v; n++; s += k; if (*s == ',') s++; }
|
||||
return n;
|
||||
}
|
||||
static void shot (const char *name)
|
||||
{
|
||||
char p[512]; snprintf (p, sizeof p, "%s/%s", g_out, name);
|
||||
FILE *f = fopen (p, "wb"); if (!f) return;
|
||||
fprintf (f, "P6\n128 128\n255\n"); fwrite (g_last, 1, sizeof g_last, f); fclose (f);
|
||||
}
|
||||
static void tick_to (uint32_t ms)
|
||||
{
|
||||
while (g_ms < ms)
|
||||
{
|
||||
g_ms++;
|
||||
pmx_sd_service (g_ms);
|
||||
while (i_shot < n_shots && g_ms >= g_shots[i_shot] * 1000) { char n[32]; snprintf (n, sizeof n, "shot_%02d.ppm", i_shot); shot (n); i_shot++; }
|
||||
if (g_ms >= g_end * 1000) longjmp (g_quit, 1);
|
||||
}
|
||||
}
|
||||
uint32_t plat_ms (void) { return g_ms; }
|
||||
int plat_exit (uint32_t held) { return held > 2000u; }
|
||||
void plat_wait (uint32_t ms) { tick_to (g_ms + (ms ? ms : 1)); }
|
||||
uint32_t plat_keys (void)
|
||||
{
|
||||
long m = 0;
|
||||
for (int i = 0; i < n_keys; i++) if (g_ms >= g_keys[i].t * 1000) m = g_keys[i].v;
|
||||
return (uint32_t)m;
|
||||
}
|
||||
int plat_wheel (void)
|
||||
{
|
||||
int d = 0;
|
||||
while (i_wheel < n_wheel && g_ms >= g_wheel[i_wheel].t * 1000) d += (int)g_wheel[i_wheel++].v;
|
||||
return d;
|
||||
}
|
||||
void plat_lcd (const uint8_t *fb, int y0, int y1, const uint16_t *lut)
|
||||
{
|
||||
for (int y = y0; y < y1; y++) for (int x = 0; x < 128; x++)
|
||||
{
|
||||
uint16_t c = lut[fb[y * 128 + x]]; uint8_t *o = g_last + 3 * (y * 128 + x);
|
||||
o[0] = (uint8_t)((c >> 11) << 3); o[1] = (uint8_t)(((c >> 5) & 63) << 2); o[2] = (uint8_t)((c & 31) << 3);
|
||||
}
|
||||
g_frames++;
|
||||
tick_to (g_ms + 1); /* sending a picture takes a little time */
|
||||
}
|
||||
void plat_tone (uint32_t hz) { if (g_tones) fprintf (g_tones, "%u %u\n", g_ms, hz); }
|
||||
const uint8_t *plat_pack (void) { return g_pack; }
|
||||
const uint8_t *plat_pack_far (void) { return g_pack; }
|
||||
uint32_t plat_pack_win (void) { return getenv ("WIN") ? (uint32_t)strtoul (getenv ("WIN"), 0, 0) : 0xFFFFFFFFu; }
|
||||
static uint8_t g_set[256];
|
||||
int plat_settings_read (void *buf, int len) { memcpy (buf, g_set, (size_t)len); return len; }
|
||||
void plat_settings_write (const void *buf, int len) { memcpy (g_set, buf, (size_t)len); }
|
||||
void plat_back (void) { printf ("back to the Paradise at %u ms\n", g_ms); longjmp (g_quit, 2); }
|
||||
void plat_fatal (const char *s) { printf ("FATAL: %s\n", s); longjmp (g_quit, 3); }
|
||||
void pmx_error (const char *s) { plat_fatal (s); }
|
||||
static uint8_t g_save[0xF000];
|
||||
static const char *g_savefile;
|
||||
void plat_save_at (uint32_t off, void *dst, int len) { if (off + (uint32_t)len <= sizeof g_save) memcpy (dst, g_save + off, (size_t)len); }
|
||||
void plat_save_page (uint32_t off, const void *src, int len)
|
||||
{
|
||||
if (off + 0x1000 > sizeof g_save) return;
|
||||
memset (g_save + off, 0xFF, 0x1000); memcpy (g_save + off, src, (size_t)len);
|
||||
if (g_savefile) { FILE *f = fopen (g_savefile, "wb"); if (f) { fwrite (g_save, 1, sizeof g_save, f); fclose (f); } }
|
||||
}
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
if (argc < 3) { fprintf (stderr, "wolfhost pack seconds\n"); return 1; }
|
||||
FILE *f = fopen (argv[1], "rb"); if (!f) { perror (argv[1]); return 1; }
|
||||
fseek (f, 0, SEEK_END); long n = ftell (f); fseek (f, 0, SEEK_SET);
|
||||
g_pack = malloc ((size_t)n); if (fread (g_pack, 1, (size_t)n, f) != (size_t)n) return 1; fclose (f);
|
||||
g_end = atof (argv[2]);
|
||||
memset (g_save, 0xFF, sizeof g_save);
|
||||
g_savefile = getenv ("SAVE");
|
||||
if (g_savefile) { FILE *sf = fopen (g_savefile, "rb"); if (sf) { if (fread (g_save, 1, sizeof g_save, sf)) {} fclose (sf); } }
|
||||
n_keys = parse (getenv ("KEYS"), g_keys, 256);
|
||||
n_wheel = parse (getenv ("WHEEL"), g_wheel, 256);
|
||||
if (getenv ("OUT")) g_out = getenv ("OUT");
|
||||
{ const char *s = getenv ("SHOTS"); while (s && *s && n_shots < 256) { g_shots[n_shots++] = atof (s); s = strchr (s, ','); if (s) s++; } }
|
||||
{ char p[512]; snprintf (p, sizeof p, "%s/tones.txt", g_out); g_tones = fopen (p, "w"); }
|
||||
int r = setjmp (g_quit);
|
||||
if (!r) pmx_main ();
|
||||
shot ("shot_end.ppm");
|
||||
printf ("ms %u frames %ld end %d\n", g_ms, g_frames, r);
|
||||
if (g_tones) fclose (g_tones);
|
||||
return r == 3;
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
/* generated by gen/font.py: custom 5x7 font */
|
||||
static const unsigned char g_font[96][7]={
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x04,0x04,0x04,0x04,0x04,0x00,0x04},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x19,0x19,0x02,0x04,0x08,0x13,0x13},
|
||||
{0x0c,0x12,0x14,0x08,0x15,0x12,0x0d},
|
||||
{0x04,0x04,0x08,0x00,0x00,0x00,0x00},
|
||||
{0x02,0x04,0x08,0x08,0x08,0x04,0x02},
|
||||
{0x08,0x04,0x02,0x02,0x02,0x04,0x08},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x04,0x04,0x1f,0x04,0x04,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x0c,0x04,0x08},
|
||||
{0x00,0x00,0x00,0x1f,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x0c,0x0c},
|
||||
{0x01,0x01,0x02,0x04,0x08,0x10,0x10},
|
||||
{0x0e,0x11,0x13,0x15,0x19,0x11,0x0e},
|
||||
{0x04,0x0c,0x04,0x04,0x04,0x04,0x0e},
|
||||
{0x0e,0x11,0x01,0x02,0x04,0x08,0x1f},
|
||||
{0x1e,0x01,0x01,0x0e,0x01,0x01,0x1e},
|
||||
{0x02,0x06,0x0a,0x12,0x1f,0x02,0x02},
|
||||
{0x1f,0x10,0x1e,0x01,0x01,0x11,0x0e},
|
||||
{0x0e,0x10,0x10,0x1e,0x11,0x11,0x0e},
|
||||
{0x1f,0x01,0x02,0x04,0x08,0x08,0x08},
|
||||
{0x0e,0x11,0x11,0x0e,0x11,0x11,0x0e},
|
||||
{0x0e,0x11,0x11,0x0f,0x01,0x01,0x0e},
|
||||
{0x00,0x04,0x04,0x00,0x04,0x04,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x02,0x04,0x08,0x10,0x08,0x04,0x02},
|
||||
{0x00,0x00,0x1f,0x00,0x1f,0x00,0x00},
|
||||
{0x08,0x04,0x02,0x01,0x02,0x04,0x08},
|
||||
{0x0e,0x11,0x01,0x02,0x04,0x00,0x04},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x0e,0x11,0x11,0x1f,0x11,0x11,0x11},
|
||||
{0x1e,0x11,0x11,0x1e,0x11,0x11,0x1e},
|
||||
{0x0e,0x11,0x10,0x10,0x10,0x11,0x0e},
|
||||
{0x1e,0x11,0x11,0x11,0x11,0x11,0x1e},
|
||||
{0x1f,0x10,0x10,0x1e,0x10,0x10,0x1f},
|
||||
{0x1f,0x10,0x10,0x1e,0x10,0x10,0x10},
|
||||
{0x0e,0x11,0x10,0x17,0x11,0x11,0x0f},
|
||||
{0x11,0x11,0x11,0x1f,0x11,0x11,0x11},
|
||||
{0x0e,0x04,0x04,0x04,0x04,0x04,0x0e},
|
||||
{0x07,0x02,0x02,0x02,0x02,0x12,0x0c},
|
||||
{0x11,0x12,0x14,0x18,0x14,0x12,0x11},
|
||||
{0x10,0x10,0x10,0x10,0x10,0x10,0x1f},
|
||||
{0x11,0x1b,0x15,0x15,0x11,0x11,0x11},
|
||||
{0x11,0x19,0x15,0x13,0x11,0x11,0x11},
|
||||
{0x0e,0x11,0x11,0x11,0x11,0x11,0x0e},
|
||||
{0x1e,0x11,0x11,0x1e,0x10,0x10,0x10},
|
||||
{0x0e,0x11,0x11,0x11,0x15,0x12,0x0d},
|
||||
{0x1e,0x11,0x11,0x1e,0x14,0x12,0x11},
|
||||
{0x0f,0x10,0x10,0x0e,0x01,0x01,0x1e},
|
||||
{0x1f,0x04,0x04,0x04,0x04,0x04,0x04},
|
||||
{0x11,0x11,0x11,0x11,0x11,0x11,0x0e},
|
||||
{0x11,0x11,0x11,0x11,0x11,0x0a,0x04},
|
||||
{0x11,0x11,0x11,0x15,0x15,0x15,0x0a},
|
||||
{0x11,0x11,0x0a,0x04,0x0a,0x11,0x11},
|
||||
{0x11,0x11,0x0a,0x04,0x04,0x04,0x04},
|
||||
{0x1f,0x01,0x02,0x04,0x08,0x10,0x1f},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x11,0x0a,0x04,0x0a,0x11},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x11,0x0e,0x11,0x1f,0x11,0x11,0x11},
|
||||
{0x11,0x0e,0x11,0x11,0x11,0x11,0x0e},
|
||||
{0x11,0x00,0x11,0x11,0x11,0x11,0x0e},
|
||||
};
|
||||
@@ -0,0 +1,205 @@
|
||||
/* Paramix: what the Wolfenstein 3D core (Wolf4SDL) needs from its id_* layers, for a 128 x 128 screen with
|
||||
* three keys and a wheel. Replaces id_pm.h, id_sd.h, id_in.h, id_vl.h, id_vh.h, id_us.h, id_ca.h, wl_menu.h.
|
||||
* Implemented in pmx_*.c. Author: mameise. GPL-2.0-or-later like Wolf4SDL. */
|
||||
#ifndef PMX_H
|
||||
#define PMX_H
|
||||
|
||||
/* ---- SDL bits the core uses ---- */
|
||||
typedef struct { uint8_t r, g, b, a; } SDL_Color;
|
||||
typedef struct { byte *pixels; } SDL_Surface;
|
||||
#define SDL_ALPHA_OPAQUE 255
|
||||
uint32_t SDL_GetTicks (void);
|
||||
void SDL_Delay (uint32_t ms);
|
||||
static inline void SDL_GetRelativeMouseState (int *x, int *y) { *x = 0; *y = 0; }
|
||||
|
||||
/* ---- id_pm ---- */
|
||||
#define PMPageSize (TEXTURESIZE * TEXTURESIZE)
|
||||
#define PM_GetSpritePage(v) PM_GetPage (PMSpriteStart + (v))
|
||||
extern word ChunksInFile, PMSpriteStart, PMSoundStart;
|
||||
void PM_Startup (void);
|
||||
uint32_t PM_GetPageSize (int page);
|
||||
byte *PM_GetPage (int page);
|
||||
|
||||
/* ---- id_ca ---- */
|
||||
#define NUMMAPS 60
|
||||
#define MAPPLANES 2
|
||||
typedef struct
|
||||
{
|
||||
int32_t planestart[3];
|
||||
word planelength[3];
|
||||
word width,height;
|
||||
char name[16];
|
||||
} maptype;
|
||||
extern word *mapsegs[MAPPLANES];
|
||||
extern maptype *mapheaderseg[NUMMAPS];
|
||||
void CA_Startup (void);
|
||||
void CA_CacheMap (int mapnum);
|
||||
#define CA_CacheAudioChunk(c) (0)
|
||||
#define CA_LoadAllSounds()
|
||||
#define UNCACHEAUDIOCHUNK(c)
|
||||
#define UNCACHEGRCHUNK(c)
|
||||
#define CA_CacheGrChunk(c)
|
||||
|
||||
/* ---- id_sd ---- */
|
||||
#define TickBase 70
|
||||
enum SDMode { sdm_Off, sdm_PC, sdm_AdLib };
|
||||
enum SMMode { smm_Off, smm_AdLib };
|
||||
enum SDSMode { sds_Off, sds_PC, sds_SoundBlaster };
|
||||
typedef struct { longword length; word priority; } SoundCommon;
|
||||
typedef struct { int valid; fixed globalsoundx, globalsoundy; } globalsoundpos;
|
||||
extern globalsoundpos channelSoundPos[];
|
||||
extern boolean AdLibPresent, SoundBlasterPresent, SoundPositioned;
|
||||
extern byte SoundMode, DigiMode, MusicMode;
|
||||
#define GetTimeCount() ((SDL_GetTicks()*7)/100)
|
||||
void Delay (int32_t wolfticks);
|
||||
void SD_Startup (void);
|
||||
boolean SD_PlaySound (int sound);
|
||||
void SD_StopSound (void);
|
||||
void SD_WaitSoundDone (void);
|
||||
word SD_SoundPlaying (void);
|
||||
void SD_PositionSound (int leftvol, int rightvol);
|
||||
void SD_SetPosition (int channel, int leftvol, int rightvol);
|
||||
#define SD_StartMusic(c)
|
||||
#define SD_ContinueMusic(c, o)
|
||||
#define SD_MusicOn()
|
||||
#define SD_MusicOff() (0)
|
||||
#define SD_FadeOutMusic()
|
||||
#define SD_MusicPlaying() (false)
|
||||
#define SD_PrepareSound(w)
|
||||
#define SD_GetChannelForDigi(w) (0)
|
||||
|
||||
/* ---- id_in ---- */
|
||||
#define sc_None 0
|
||||
#define sc_Last 64
|
||||
typedef int32_t ScanCode;
|
||||
/* the keys the core asks for (Keyboard[]); set by pmx_in.c from the Paradise's keys */
|
||||
enum { sc_Return = 1, sc_Escape, sc_Space, sc_BackSpace, sc_Tab, sc_Alt, sc_Control, sc_LShift, sc_RShift,
|
||||
sc_UpArrow, sc_DownArrow, sc_LeftArrow, sc_RightArrow, sc_Y, sc_N, sc_Pause,
|
||||
sc_1, sc_2, sc_3, sc_4, sc_5, sc_6, sc_7, sc_8, sc_9, sc_0,
|
||||
sc_F1, sc_F2, sc_F3, sc_F4, sc_F5, sc_F6, sc_F7, sc_F8, sc_F9, sc_F10, sc_F11, sc_F12,
|
||||
sc_A, sc_B, sc_C, sc_D, sc_E, sc_G, sc_H, sc_I, sc_J, sc_K, sc_L, sc_M, sc_O, sc_P, sc_Q, sc_R, sc_S, sc_T,
|
||||
sc_U, sc_V, sc_W, sc_X, sc_Z, sc_Enter2 };
|
||||
#define sc_LAlt sc_Alt
|
||||
#define sc_RAlt sc_Alt
|
||||
#define sc_LControl sc_Control
|
||||
#define sc_RControl sc_Control
|
||||
#define sc_Enter sc_Return
|
||||
#define key_None sc_None
|
||||
enum Direction { dir_North, dir_NorthEast, dir_East, dir_SouthEast, dir_South, dir_SouthWest, dir_West, dir_NorthWest, dir_None };
|
||||
typedef struct
|
||||
{
|
||||
boolean button0,button1,button2,button3;
|
||||
int16_t x,y;
|
||||
int16_t xaxis,yaxis;
|
||||
byte dir;
|
||||
} ControlInfo;
|
||||
extern bool Keyboard[sc_Last];
|
||||
extern boolean MousePresent, Paused;
|
||||
extern ScanCode LastScan;
|
||||
#define IN_ClearKey(code) { Keyboard[code] = false; if (code == LastScan) LastScan = sc_None; }
|
||||
void IN_ClearKeysDown (void);
|
||||
void IN_Ack (void);
|
||||
boolean IN_UserInput (longword delay);
|
||||
void IN_ProcessEvents (void);
|
||||
static inline int IN_MouseButtons (void) { return 0; }
|
||||
static inline int IN_JoyButtons (void) { return 0; }
|
||||
static inline void IN_GetJoyDelta (int *dx, int *dy) { *dx = 0; *dy = 0; }
|
||||
static inline void IN_GetJoyFineDelta (int *dx, int *dy) { *dx = 0; *dy = 0; }
|
||||
static inline void IN_CenterMouse (void) {}
|
||||
void IN_StartAck (void);
|
||||
boolean IN_CheckAck (void);
|
||||
|
||||
/* ---- id_vl / id_vh ---- */
|
||||
extern SDL_Surface *screenBuffer;
|
||||
extern int16_t screenWidth, screenHeight;
|
||||
extern unsigned screenPitch, bufferPitch;
|
||||
extern int scaleFactor;
|
||||
extern boolean screenfaded;
|
||||
extern unsigned bordercolor;
|
||||
extern uint32_t *ylookup;
|
||||
extern SDL_Color gamepal[256];
|
||||
#define WHITE 15
|
||||
#define BLACK 0
|
||||
#define VL_WaitVBL(a) SDL_Delay((a)*8)
|
||||
void VL_SetPalette (SDL_Color *palette, bool forceupdate);
|
||||
void VL_FadeOut (int start, int end, int red, int green, int blue, int steps);
|
||||
void VL_FadeIn (int start, int end, SDL_Color *palette, int steps);
|
||||
byte *VL_LockSurface (SDL_Surface *surface);
|
||||
void VL_UnlockSurface (SDL_Surface *surface);
|
||||
void VL_BarScaledCoord (int scx, int scy, int scwidth, int scheight, int color);
|
||||
void VL_Bar (int x, int y, int width, int height, int color);
|
||||
void VL_ClearScreen (int color);
|
||||
void VWB_Bar (int x, int y, int width, int height, int color);
|
||||
#define VWB_BarScaledCoord VL_BarScaledCoord
|
||||
void VWB_DrawPic (int x, int y, int chunknum);
|
||||
void VWB_DrawPicScaledCoord (int x, int y, int chunknum);
|
||||
void VH_UpdateScreen (SDL_Surface *surface);
|
||||
#define VW_UpdateScreen() VH_UpdateScreen (screenBuffer)
|
||||
#define VW_WaitVBL VL_WaitVBL
|
||||
#define VW_FadeIn() VL_FadeIn(0,255,gamepal,30);
|
||||
#define VW_FadeOut() VL_FadeOut(0,255,0,0,0,30);
|
||||
boolean FizzleFade (SDL_Surface *source, int x1, int y1, unsigned width, unsigned height, unsigned frames, boolean abortable);
|
||||
extern byte fontcolor, backcolor;
|
||||
extern int fontnumber;
|
||||
extern int px, py;
|
||||
#define SETFONTCOLOR(f,b) fontcolor=f;backcolor=b;
|
||||
|
||||
/* ---- id_us ---- */
|
||||
#define MaxX 320
|
||||
#define MaxY 200
|
||||
extern boolean ingame;
|
||||
extern word PrintX, PrintY, WindowX, WindowY, WindowW, WindowH;
|
||||
void US_Print (const char *s);
|
||||
void US_PrintSigned (int32_t n);
|
||||
void US_PrintUnsigned (longword n);
|
||||
void US_CPrint (const char *s);
|
||||
void US_DrawWindow (word x, word y, word w, word h);
|
||||
void US_CenterWindow (word w, word h);
|
||||
void US_InitRndT (int randomize);
|
||||
int US_RndT (void);
|
||||
boolean US_LineInput (int x, int y, char *buf, const char *def, boolean escok, int maxchars, int maxwidth);
|
||||
void US_ControlPanel (ScanCode s);
|
||||
|
||||
/* ---- wl_menu ---- */
|
||||
#define MenuFadeOut() VL_FadeOut(0,255,43,0,0,10)
|
||||
#define MenuFadeIn() VL_FadeIn(0,255,gamepal,10)
|
||||
#define INTROSONG NAZI_NOR_MUS
|
||||
#define VIEWCOLOR 0x7f
|
||||
void Message (const char *string);
|
||||
void CenterWindow (word w, word h);
|
||||
void ClearMemory (void);
|
||||
void ClearSplitVWB (void);
|
||||
|
||||
/* ---- Paramix own (pmx_*.c) ---- */
|
||||
int pmx_iangle (int32_t dy, int32_t dx); /* atan2 in whole degrees 0..359 (as (int)(atan2/(2 pi)*360)) */
|
||||
void pmx_hud_dirty (void); /* the status bar changed */
|
||||
extern unsigned pmx_face; /* face pic (game chunk number) set by DrawFace */
|
||||
void pmx_status (void); /* draw it into the screen buffer */
|
||||
uint32_t pmx_ms (void); /* milliseconds */
|
||||
void pmx_present (void); /* the 8-bit screen to the display */
|
||||
void pmx_poll (void); /* keys */
|
||||
extern uint32_t pmx_keys; /* PMX_K_* held */
|
||||
#define PMX_K_A 1u
|
||||
#define PMX_K_B 2u
|
||||
#define PMX_K_C 4u
|
||||
#define PMX_K_WHEEL 8u
|
||||
void pmx_buttons (void); /* keys to buttonstate[] (PollKeyboardButtons) */
|
||||
void pmx_move (int delta); /* keys and wheel to controlx, controly (PollKeyboardMove) */
|
||||
void pmx_error (const char *s); /* shown, then back to the Paradise */
|
||||
typedef struct { uint32_t fire, fwd, back, use, mod, run_dbl, invert, turn_deg; } PmxKeys;
|
||||
extern PmxKeys pmx_k; /* key layout (from the settings block the Studio writes) */
|
||||
extern int pmx_run, pmx_leave_req, pmx_sound_on;
|
||||
void pmx_leave (void); /* save and back to the Paradise */
|
||||
void pmx_idle (void); /* waiting: sound, leave request */
|
||||
void pmx_sd_service (uint32_t now);
|
||||
byte *pmx_screen (void);
|
||||
const uint16_t *pmx_lut (void);
|
||||
void pmx_vl_init (void);
|
||||
void pmx_palshift (int r, int g, int b, int i, int steps); /* the game's palette shifted i/steps towards r, g, b */
|
||||
void pmx_text (int x, int y, const char *s, int color);
|
||||
void pmx_text_c (int y, const char *s, int color);
|
||||
void pmx_drawpic (int x, int y, int k);
|
||||
void pmx_drawpic_scaled (int x, int y, int k, int dw, int dh);
|
||||
extern int pmx_wheel; /* wheel steps since the last poll (+ one way) */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,150 @@
|
||||
/* Paramix Wolf3D: the data pack (W3DP, built by the Studio from the user's game files): pages, maps, pics, sounds.
|
||||
* Maps are unpacked (Carmack, then RLEW) into RAM when a level starts; everything else is read in place.
|
||||
* Author: mameise. GPL-2.0-or-later (CAL_CarmackExpand and CA_RLEWexpand from Wolf4SDL / id Software). */
|
||||
#include "wl_def.h"
|
||||
#include "pmx_plat.h"
|
||||
#include "pmx_ca.h"
|
||||
|
||||
word ChunksInFile, PMSpriteStart, PMSoundStart;
|
||||
word *mapsegs[MAPPLANES];
|
||||
maptype *mapheaderseg[NUMMAPS];
|
||||
static word g_plane[MAPPLANES][MAPAREA];
|
||||
static maptype g_maphead;
|
||||
static const uint8_t *P, *PF; /* the pack: fast up to g_win, then through PF */
|
||||
static uint32_t g_win;
|
||||
static const uint8_t *at (uint32_t o) { return o < g_win ? P + o : PF + o; }
|
||||
/* a piece that ends behind the fast part is read whole through the slow path */
|
||||
static const uint8_t *atn (uint32_t o, uint32_t n) { return o + n <= g_win ? P + o : PF + o; }
|
||||
static uint32_t n_pages, pages_tab, n_maps, rlew, maps_tab, n_snd, snd_tab, n_pics, pics_tab;
|
||||
int pmx_episodes, pmx_shareware;
|
||||
|
||||
static uint32_t rd32 (uint32_t o) { const uint8_t *b = at (o); return b[0] | b[1] << 8 | b[2] << 16 | (uint32_t)b[3] << 24; }
|
||||
static uint16_t rd16 (uint32_t o) { const uint8_t *b = at (o); return (uint16_t)(b[0] | b[1] << 8); }
|
||||
|
||||
int pmx_pack_open (void)
|
||||
{
|
||||
P = plat_pack (); PF = plat_pack_far (); g_win = plat_pack_win ();
|
||||
if (!P || P[0] != 'W' || P[1] != '3' || P[2] != 'D' || P[3] != 'P') return 0;
|
||||
pmx_shareware = rd32 (8) & 1;
|
||||
#ifdef SPEAR
|
||||
if (!(rd32 (8) & 2)) return 0; /* 1.6.11 test2: the Spear of Destiny program needs a pack of the .SOD files */
|
||||
pmx_episodes = 1;
|
||||
#else
|
||||
if (rd32 (8) & 2) return 0;
|
||||
#endif
|
||||
n_pages = rd32 (16); PMSpriteStart = (word)rd32 (20); pages_tab = rd32 (24);
|
||||
n_maps = rd32 (28); rlew = rd32 (32); maps_tab = rd32 (36);
|
||||
n_snd = rd32 (40); snd_tab = rd32 (44);
|
||||
n_pics = rd32 (48); pics_tab = rd32 (52);
|
||||
#ifndef SPEAR
|
||||
pmx_episodes = (int)rd32 (60);
|
||||
#endif
|
||||
if (pmx_episodes < 1) pmx_episodes = 1;
|
||||
if (pmx_episodes > 6) pmx_episodes = 6;
|
||||
ChunksInFile = PMSoundStart = (word)n_pages;
|
||||
for (int i = 0; i < MAPPLANES; i++) mapsegs[i] = g_plane[i];
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ---- pages (walls 64 x 64 by columns, sprites as t_compshape) ---- */
|
||||
byte *PM_GetPage (int page)
|
||||
{
|
||||
if ((uint32_t)page >= n_pages) Quit ("PM_GetPage: page %d", page);
|
||||
uint32_t o = rd32 (pages_tab + 8u * (uint32_t)page);
|
||||
if (!o) return (byte *)P + 64; /* empty page: something harmless */
|
||||
return (byte *)atn (o, rd32 (pages_tab + 8u * (uint32_t)page + 4));
|
||||
}
|
||||
uint32_t PM_GetPageSize (int page) { return (uint32_t)page < n_pages ? rd32 (pages_tab + 8u * (uint32_t)page + 4) : 0; }
|
||||
void PM_Startup (void) {}
|
||||
|
||||
/* ---- maps ---- */
|
||||
#define NEARTAG 0xa7
|
||||
#define FARTAG 0xa8
|
||||
static void carmack (const byte *src, word *dest, int length)
|
||||
{
|
||||
word ch, chhigh, count, offset;
|
||||
word *copyptr, *outptr = dest;
|
||||
length /= 2;
|
||||
while (length > 0)
|
||||
{
|
||||
ch = (word)(src[0] | src[1] << 8); src += 2;
|
||||
chhigh = ch >> 8;
|
||||
if (chhigh == NEARTAG || chhigh == FARTAG)
|
||||
{
|
||||
count = ch & 0xff;
|
||||
if (!count) { ch |= *src++; *outptr++ = ch; length--; continue; }
|
||||
if (chhigh == NEARTAG) { offset = *src++; copyptr = outptr - offset; }
|
||||
else { offset = (word)(src[0] | src[1] << 8); src += 2; copyptr = dest + offset; }
|
||||
length -= count;
|
||||
if (length < 0) return;
|
||||
while (count--) *outptr++ = *copyptr++;
|
||||
}
|
||||
else { *outptr++ = ch; length--; }
|
||||
}
|
||||
}
|
||||
static void rlewexpand (const word *source, word *dest, int32_t length, word tag)
|
||||
{
|
||||
word *end = dest + length / 2;
|
||||
do
|
||||
{
|
||||
word value = *source++;
|
||||
if (value != tag) *dest++ = value;
|
||||
else { word count = *source++; value = *source++; for (word i = 1; i <= count && dest < end; i++) *dest++ = value; }
|
||||
} while (dest < end);
|
||||
}
|
||||
/* the Carmack-unpacked plane (RLEW packed, at most a little longer than the plane): in the screen buffer, which is
|
||||
* drawn anew after a level was loaded (saves 8 KB of RAM) */
|
||||
#define SCRATCH_LEN (128u * 128u)
|
||||
static word *scratch (void) { return (word *)pmx_screen (); }
|
||||
|
||||
void CA_CacheMap (int mapnum)
|
||||
{
|
||||
if ((uint32_t)mapnum >= n_maps || !rd32 (maps_tab + 4u * (uint32_t)mapnum)) Quit ("no map %d", mapnum);
|
||||
uint32_t h = rd32 (maps_tab + 4u * (uint32_t)mapnum);
|
||||
pmx_read (&g_maphead, h, sizeof g_maphead);
|
||||
mapheaderseg[mapnum] = &g_maphead;
|
||||
for (int plane = 0; plane < MAPPLANES; plane++)
|
||||
{
|
||||
uint32_t pos = (uint32_t)g_maphead.planestart[plane], len = g_maphead.planelength[plane];
|
||||
if (!pos || !len) Quit ("map %d plane %d", mapnum, plane);
|
||||
const byte *src = atn (pos, len); /* read in place (memory mapped flash) */
|
||||
word expanded = (word)(src[0] | src[1] << 8);
|
||||
if (expanded > SCRATCH_LEN) Quit ("map %d too big", mapnum);
|
||||
carmack (src + 2, scratch (), expanded);
|
||||
rlewexpand (scratch () + 1, g_plane[plane], MAPAREA * 2, (word)rlew);
|
||||
}
|
||||
}
|
||||
void CA_Startup (void) {}
|
||||
/* the map unpacking buffer, free while a level runs (the save uses it) */
|
||||
byte *pmx_ca_scratch (uint32_t *len) { *len = SCRATCH_LEN; return (byte *)scratch (); }
|
||||
uint32_t pmx_pack_len (void) { return rd32 (12); }
|
||||
|
||||
/* ---- pics (8-bit, rows from the top; index see pmx_ca.h) ---- */
|
||||
const byte *pmx_pic (int k, int *w, int *h)
|
||||
{
|
||||
if ((uint32_t)k >= n_pics) { *w = *h = 0; return 0; }
|
||||
uint32_t o = rd32 (pics_tab + 8u * (uint32_t)k);
|
||||
*w = rd16 (pics_tab + 8u * (uint32_t)k + 4); *h = rd16 (pics_tab + 8u * (uint32_t)k + 6);
|
||||
if (!o) { *w = *h = 0; return 0; }
|
||||
return atn (o, (uint32_t)*w * (uint32_t)*h);
|
||||
}
|
||||
|
||||
/* ---- PC speaker sounds: u32 length, u16 priority, bytes ---- */
|
||||
const byte *pmx_sound (int k, uint32_t *len, int *prio)
|
||||
{
|
||||
if ((uint32_t)k >= n_snd) return 0;
|
||||
uint32_t o = rd32 (snd_tab + 8u * (uint32_t)k);
|
||||
if (!o) return 0;
|
||||
*len = rd32 (o); *prio = rd16 (o + 4);
|
||||
return atn (o + 6, *len);
|
||||
}
|
||||
|
||||
void pmx_read (void *dst, uint32_t off, uint32_t n)
|
||||
{
|
||||
const uint8_t *s = atn (off, n); uint8_t *d = (uint8_t *)dst;
|
||||
while (n--) *d++ = *s++;
|
||||
}
|
||||
|
||||
/* demos are not played or recorded on the Paradise */
|
||||
void CA_LoadFile (const char *filename, void **ptr) { (void)filename; *ptr = 0; Quit ("no demos"); }
|
||||
void CA_WriteFile (const char *filename, void *ptr, int32_t length) { (void)filename; (void)ptr; (void)length; }
|
||||
@@ -0,0 +1,27 @@
|
||||
/* Paramix Wolf3D: the data pack. Author: mameise. */
|
||||
#ifndef PMX_CA_H
|
||||
#define PMX_CA_H
|
||||
#include <stdint.h>
|
||||
|
||||
/* pics in the pack: the game's range L_COLONPIC .. GETPSYCHEDPIC (same order in every version) */
|
||||
enum {
|
||||
PK_L_COLON = 0, PK_L_NUM0 = 1, PK_L_PERCENT = 11, PK_L_A = 12, /* L_APIC .. L_ZPIC: 26 */
|
||||
PK_L_EXPOINT = 38, PK_L_APOSTROPHE = 39, PK_L_GUY = 40, PK_L_GUY2 = 41,
|
||||
PK_STATUSBAR = 42, PK_TITLE = 43, PK_PG13 = 44, PK_CREDITS = 45, PK_HIGHSCORES = 46,
|
||||
PK_KNIFE = 47, PK_GUN, PK_MACHINEGUN, PK_GATLING, PK_NOKEY, PK_GOLDKEY, PK_SILVERKEY, PK_N_BLANK,
|
||||
PK_N_0 = 55, PK_FACE1A = 65, PK_FACE8A = 86, PK_GOTGATLING = 87, PK_MUTANTBJ = 88, PK_PAUSED = 89, PK_GETPSYCHED = 90,
|
||||
PK_SOD_GOD1 = 91 /* Spear of Destiny: GODMODEFACE1..3, BJWAITING1..2, BJOUCH */
|
||||
};
|
||||
|
||||
extern int pmx_episodes, pmx_shareware;
|
||||
int pmx_pack_open (void);
|
||||
const uint8_t *pmx_pic (int k, int *w, int *h);
|
||||
int chunk_to_pk (int chunk);
|
||||
const uint8_t *pmx_sound (int k, uint32_t *len, int *prio);
|
||||
void pmx_read (void *dst, uint32_t off, uint32_t n);
|
||||
uint32_t pmx_pack_len (void);
|
||||
int pmx_save_game (void);
|
||||
int pmx_load_game (void);
|
||||
int pmx_save_present (void);
|
||||
void pmx_save_forget (void);
|
||||
#endif
|
||||
@@ -0,0 +1,122 @@
|
||||
/* Paramix Wolf3D: the Paradise's keys to the game (same layout as DOOM on the Paradise, set in the Studio):
|
||||
* A fire, B forward, C back, wheel turns, wheel press use (doors, switches), hold C + wheel: weapon,
|
||||
* B twice quickly: run on/off, A+C: menu, wheel held 2 s: save and back to the Paradise.
|
||||
* The hold key (C) only moves back after 120 ms and while the wheel was not turned.
|
||||
* Author: mameise. GPL-2.0-or-later. */
|
||||
#include "wl_def.h"
|
||||
#include "pmx_plat.h"
|
||||
|
||||
bool Keyboard[sc_Last];
|
||||
boolean MousePresent, Paused;
|
||||
ScanCode LastScan;
|
||||
uint32_t pmx_keys;
|
||||
int pmx_wheel;
|
||||
|
||||
PmxKeys pmx_k = { PMX_K_A, PMX_K_B, PMX_K_C, PMX_K_WHEEL, PMX_K_C, 1, 0, 15 };
|
||||
int pmx_run; /* run on (B twice) */
|
||||
static int turn_pending; /* controlx units still to turn (20 per degree) */
|
||||
static int use_left, chg_left, chg_dir;
|
||||
static uint32_t mod_t0, b_last, b_prev, wh_t0;
|
||||
static int det_seen, menu_hold, esc_req;
|
||||
int pmx_leave_req;
|
||||
|
||||
/* once per game tic batch (PollControls): read the keys and the wheel */
|
||||
void pmx_poll (void)
|
||||
{
|
||||
uint32_t now = plat_ms (), b = plat_keys ();
|
||||
int det = plat_wheel ();
|
||||
if (pmx_k.invert) det = -det;
|
||||
pmx_keys = b;
|
||||
/* wheel pressed: short = use, held 2 s = leave */
|
||||
if (b & PMX_K_WHEEL) { if (!wh_t0) wh_t0 = now | 1u; else if (plat_exit (now - wh_t0)) pmx_leave_req = 1; }
|
||||
else { if (wh_t0 && now - wh_t0 < 800u && pmx_k.use == PMX_K_WHEEL) use_left = 2; wh_t0 = 0; }
|
||||
if (det)
|
||||
{
|
||||
if (b & pmx_k.mod) { chg_left = 1; chg_dir = det > 0; det_seen = 1; }
|
||||
else
|
||||
{
|
||||
int add = det * pmx_k.turn_deg * 20;
|
||||
if ((add > 0) != (turn_pending > 0)) turn_pending = 0;
|
||||
turn_pending += add;
|
||||
}
|
||||
}
|
||||
int ac = (b & PMX_K_A) && (b & PMX_K_C);
|
||||
if (ac) { if (++menu_hold == 1) esc_req = 1; } else menu_hold = 0;
|
||||
if (!(b & pmx_k.mod)) { mod_t0 = 0; det_seen = 0; }
|
||||
else if (!mod_t0) mod_t0 = now | 1u;
|
||||
if (pmx_k.run_dbl && (b & pmx_k.fwd) && !(b_last & pmx_k.fwd))
|
||||
{
|
||||
if (b_prev && now - b_prev < 300u) { pmx_run ^= 1; b_prev = 0; pmx_hud_dirty (); } else b_prev = now;
|
||||
}
|
||||
if (pmx_k.use != PMX_K_WHEEL && (b & pmx_k.use) && !(b_last & pmx_k.use)) use_left = 2;
|
||||
b_last = b;
|
||||
}
|
||||
|
||||
static int held (uint32_t key)
|
||||
{
|
||||
uint32_t b = pmx_keys;
|
||||
if ((b & PMX_K_A) && (b & PMX_K_C)) return 0; /* the menu pair */
|
||||
if (!(b & key)) return 0;
|
||||
if (key == pmx_k.mod) return !det_seen && mod_t0 && (int)(plat_ms () - mod_t0) >= 120;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void pmx_buttons (void)
|
||||
{
|
||||
pmx_poll ();
|
||||
if (held (pmx_k.fire)) buttonstate[bt_attack] = true;
|
||||
if (use_left) { use_left--; buttonstate[bt_use] = true; }
|
||||
if (pmx_run) buttonstate[bt_run] = true;
|
||||
if (chg_left) { chg_left--; buttonstate[chg_dir ? bt_nextweapon : bt_prevweapon] = true; }
|
||||
if (esc_req) { esc_req = 0; buttonstate[bt_esc] = true; }
|
||||
}
|
||||
|
||||
void pmx_move (int delta)
|
||||
{
|
||||
if (held (pmx_k.fwd)) controly -= delta;
|
||||
if (held (pmx_k.back)) controly += delta;
|
||||
if (turn_pending)
|
||||
{
|
||||
int max = 100 * (int)tics, t = turn_pending;
|
||||
if (t > max) t = max;
|
||||
if (t < -max) t = -max;
|
||||
controlx += t; turn_pending -= t;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---- the id input calls the game still makes ---- */
|
||||
void IN_ClearKeysDown (void) { memset (Keyboard, 0, sizeof Keyboard); LastScan = sc_None; esc_req = 0; }
|
||||
void IN_ProcessEvents (void) { if (pmx_leave_req) pmx_leave (); }
|
||||
|
||||
/* a fresh key press (any of A, B, C, wheel press, or a wheel step) */
|
||||
static uint32_t ack_last;
|
||||
void IN_StartAck (void) { ack_last = plat_keys (); plat_wheel (); }
|
||||
boolean IN_CheckAck (void)
|
||||
{
|
||||
uint32_t b = plat_keys ();
|
||||
int det = plat_wheel ();
|
||||
boolean r = (b & ~ack_last) != 0;
|
||||
ack_last = b;
|
||||
(void)det;
|
||||
pmx_idle ();
|
||||
return r;
|
||||
}
|
||||
void IN_Ack (void) { IN_StartAck (); while (!IN_CheckAck ()) plat_wait (10); }
|
||||
boolean IN_UserInput (longword delay)
|
||||
{
|
||||
uint32_t t0 = plat_ms (), ms = delay * 1000u / 70u;
|
||||
IN_StartAck ();
|
||||
while (plat_ms () - t0 < ms) { if (IN_CheckAck ()) return true; plat_wait (10); }
|
||||
return false;
|
||||
}
|
||||
|
||||
/* the key layout from the settings block (the Studio writes it) */
|
||||
int pmx_english;
|
||||
void pmx_cfg_keys (uint32_t fire, uint32_t fwd, uint32_t back, uint32_t use, uint32_t mod, uint32_t run_dbl, uint32_t invert, uint32_t turn_deg, uint32_t english)
|
||||
{
|
||||
if (fire && fwd && back && fire != fwd && fire != back && fwd != back)
|
||||
{ pmx_k.fire = fire; pmx_k.fwd = fwd; pmx_k.back = back; pmx_k.use = use ? use : PMX_K_WHEEL; pmx_k.mod = mod; }
|
||||
pmx_k.run_dbl = run_dbl; pmx_k.invert = invert;
|
||||
if (turn_deg >= 2 && turn_deg <= 90) pmx_k.turn_deg = turn_deg;
|
||||
pmx_english = (int)english;
|
||||
}
|
||||
@@ -0,0 +1,454 @@
|
||||
/* Paramix Wolf3D: start, menus, interludes and the status bar for the 128 x 128 screen.
|
||||
* BuildTables, CalcProjection, SetupWalls, SetViewSize, NewGame and the level bonus logic come from Wolf4SDL
|
||||
* (wl_main.c, wl_inter.c by id Software); the screens are new.
|
||||
* Author: mameise. GPL-2.0-or-later. */
|
||||
#include "wl_def.h"
|
||||
#include "pmx_plat.h"
|
||||
#include "pmx_ca.h"
|
||||
extern int pmx_english;
|
||||
#define TX(de, en) (pmx_english ? (en) : (de))
|
||||
/* settings kept on the device (4 KB settings page): sound */
|
||||
typedef struct { uint32_t magic; uint8_t sound, r[3]; } PmxSet;
|
||||
#define SET_MAGIC 0x31533357u /* "W3S1" */
|
||||
static void set_load (void) { PmxSet t; plat_settings_read (&t, sizeof t); if (t.magic == SET_MAGIC) pmx_sound_on = t.sound & 1; }
|
||||
static void set_store (void) { PmxSet t = { SET_MAGIC, (uint8_t)pmx_sound_on, {0, 0, 0} }; PmxSet o; plat_settings_read (&o, sizeof o); if (memcmp (&o, &t, sizeof t)) plat_settings_write (&t, sizeof t); }
|
||||
|
||||
/* ---- wl_main.c globals ---- */
|
||||
#define FOCALLENGTH (0x5700l)
|
||||
#define VIEWGLOBAL 0x10000
|
||||
char str[80];
|
||||
int dirangle[9] = {0,ANGLES/8,2*ANGLES/8,3*ANGLES/8,4*ANGLES/8,5*ANGLES/8,6*ANGLES/8,7*ANGLES/8,ANGLES};
|
||||
fixed focallength;
|
||||
unsigned screenofs;
|
||||
int viewscreenx, viewscreeny;
|
||||
int viewwidth;
|
||||
int viewheight;
|
||||
short centerx,centery;
|
||||
int shootdelta;
|
||||
fixed scale;
|
||||
int32_t heightnumerator;
|
||||
boolean startgame;
|
||||
boolean loadedgame;
|
||||
int mouseadjustment;
|
||||
boolean param_debugmode = false;
|
||||
boolean param_nowait = false;
|
||||
int param_difficulty = 1;
|
||||
int param_tedlevel = -1;
|
||||
int param_mission = 0;
|
||||
boolean param_goodtimes = true;
|
||||
LRstruct LevelRatios[LRpack];
|
||||
static short g_pixelangle[128];
|
||||
static int16_t g_wallheight[128];
|
||||
unsigned pmx_face;
|
||||
static int hud_dirty = 1;
|
||||
|
||||
static const byte rndtable_[256] = {
|
||||
#include "rndtable.inc"
|
||||
};
|
||||
static int rndindex;
|
||||
void US_InitRndT (int randomize) { rndindex = randomize ? (int)((plat_ms () >> 4) & 0xff) : 0; }
|
||||
int US_RndT (void) { rndindex = (rndindex + 1) & 0xff; return rndtable_[rndindex]; }
|
||||
|
||||
uint32_t SDL_GetTicks (void) { return plat_ms (); }
|
||||
void SDL_Delay (uint32_t ms)
|
||||
{
|
||||
uint32_t t0 = plat_ms ();
|
||||
pmx_idle ();
|
||||
while (plat_ms () - t0 < ms) { plat_wait (ms - (plat_ms () - t0) > 5 ? 5 : 1); pmx_idle (); }
|
||||
}
|
||||
void pmx_idle (void)
|
||||
{
|
||||
#ifndef PMX_SD_IN_TICK /* on the Paradise the millisecond tick serves the sound */
|
||||
pmx_sd_service (plat_ms ());
|
||||
#endif
|
||||
if (pmx_leave_req) pmx_leave ();
|
||||
}
|
||||
|
||||
/* ---- tables (wl_main.c BuildTables and CalcProjection, computed on the PC for a view 128 wide) ---- */
|
||||
#include "pmx_tables.h"
|
||||
void BuildTables (void) {}
|
||||
void CalcProjection (int32_t focal)
|
||||
{
|
||||
focallength = focal;
|
||||
scale = PMX_T_SCALE;
|
||||
heightnumerator = PMX_T_HEIGHTNUMERATOR;
|
||||
for (int i = 0; i < viewwidth && i < 128; i++) pixelangle[i] = pmx_pixelangle[i];
|
||||
}
|
||||
void SetupWalls (void)
|
||||
{
|
||||
horizwall[0]=0;
|
||||
vertwall[0]=0;
|
||||
for (int i=1;i<MAXWALLTILES;i++)
|
||||
{
|
||||
horizwall[i]=(i-1)*2;
|
||||
vertwall[i]=(i-1)*2+1;
|
||||
}
|
||||
}
|
||||
boolean SetViewSize (unsigned width, unsigned height)
|
||||
{
|
||||
viewwidth = width&~15;
|
||||
viewheight = height&~1;
|
||||
centerx = viewwidth/2-1;
|
||||
centery = viewheight / 2;
|
||||
shootdelta = viewwidth/10;
|
||||
viewscreenx = 0; viewscreeny = 0; screenofs = 0;
|
||||
CalcProjection (FOCALLENGTH);
|
||||
return true;
|
||||
}
|
||||
void NewGame (int difficulty,int episode)
|
||||
{
|
||||
memset (&gamestate,0,sizeof(gamestate));
|
||||
gamestate.difficulty = difficulty;
|
||||
gamestate.weapon = gamestate.bestweapon = gamestate.chosenweapon = wp_pistol;
|
||||
gamestate.health = 100;
|
||||
gamestate.ammo = STARTAMMO;
|
||||
gamestate.lives = 3;
|
||||
gamestate.nextextra = EXTRAPOINTS;
|
||||
gamestate.episode=episode;
|
||||
startgame = true;
|
||||
}
|
||||
void Quit (const char *errorStr, ...)
|
||||
{
|
||||
char b[80];
|
||||
va_list ap; va_start (ap, errorStr); vsnprintf (b, sizeof b, errorStr ? errorStr : "", ap); va_end (ap);
|
||||
pmx_error (b);
|
||||
}
|
||||
|
||||
/* ---- screen out ---- */
|
||||
void pmx_hud_dirty (void) { hud_dirty = 1; }
|
||||
#define HUD_Y 96
|
||||
static int hud_bg = 0x1d;
|
||||
static void num_big (int x, int y, int digits, int32_t v)
|
||||
{
|
||||
char s[12]; snprintf (s, sizeof s, "%ld", (long)v);
|
||||
int n = (int)strlen (s);
|
||||
for (int i = 0; i < digits; i++)
|
||||
{
|
||||
int k = i - (digits - n);
|
||||
pmx_drawpic (x + 8 * i, y, k < 0 ? PK_N_BLANK : PK_N_0 + (s[k] - '0'));
|
||||
}
|
||||
}
|
||||
void pmx_status (void)
|
||||
{
|
||||
byte *s = pmx_screen ();
|
||||
memset (s + HUD_Y * 128, hud_bg, 32 * 128);
|
||||
for (int x = 0; x < 128; x++) s[HUD_Y * 128 + x] = 0x00;
|
||||
if (pmx_face) pmx_drawpic (0, HUD_Y, chunk_to_pk ((int)pmx_face)); /* 24 x 32 */
|
||||
num_big (26, HUD_Y + 2, 3, gamestate.health); /* 8 x 16 digits */
|
||||
pmx_text (50, HUD_Y + 6, "%", 0x0f);
|
||||
num_big (58, HUD_Y + 2, 2, gamestate.ammo > 99 ? 99 : gamestate.ammo);
|
||||
pmx_drawpic (78, HUD_Y + 2, (gamestate.keys & 1) ? PK_GOLDKEY : PK_NOKEY);
|
||||
pmx_drawpic (86, HUD_Y + 2, (gamestate.keys & 2) ? PK_SILVERKEY : PK_NOKEY);
|
||||
if (gamestate.weapon >= 0) pmx_drawpic_scaled (96, HUD_Y + 2, PK_KNIFE + gamestate.weapon, 32, 16);
|
||||
char line[24];
|
||||
#ifdef SPEAR
|
||||
snprintf (line, sizeof line, "%d", gamestate.mapon + 1);
|
||||
#else
|
||||
snprintf (line, sizeof line, "%d-%d", gamestate.episode + 1, gamestate.mapon + 1);
|
||||
#endif
|
||||
pmx_text (26, HUD_Y + 22, line, 0x0f);
|
||||
snprintf (line, sizeof line, "%d", gamestate.lives);
|
||||
pmx_drawpic_scaled (52, HUD_Y + 20, PK_FACE1A, 6, 8);
|
||||
pmx_text (60, HUD_Y + 22, line, 0x0f);
|
||||
snprintf (line, sizeof line, "%07ld", (long)gamestate.score);
|
||||
pmx_text (128 - 6 * 7, HUD_Y + 22, line, 0x0f);
|
||||
if (pmx_run) pmx_text (72, HUD_Y + 22, ">>", 0x0e);
|
||||
hud_dirty = 0;
|
||||
}
|
||||
static int g_hud_on, g_hud_shown;
|
||||
extern int pmx_lut_changed;
|
||||
/* in a level the status bar is drawn and sent only when it changed (or the palette did) */
|
||||
void pmx_present (void)
|
||||
{
|
||||
int full = 1;
|
||||
if (g_hud_on)
|
||||
{
|
||||
full = hud_dirty || !g_hud_shown || pmx_lut_changed;
|
||||
if (hud_dirty || !g_hud_shown) pmx_status ();
|
||||
g_hud_shown = 1;
|
||||
}
|
||||
else g_hud_shown = 0;
|
||||
pmx_lut_changed = 0;
|
||||
pmx_idle ();
|
||||
plat_lcd (pmx_screen (), 0, full ? 128 : 128 - STATUSLINES, pmx_lut ());
|
||||
}
|
||||
|
||||
/* ---- menus ---- */
|
||||
#define C_TEXT 0x0f
|
||||
#define C_HI 0x0e
|
||||
#define C_DIM 0x08
|
||||
#define C_BACK 0x00
|
||||
|
||||
/* keys for menus: a fresh press of A/B (ok), C (back), wheel steps or A+C */
|
||||
enum { MK_NONE, MK_UP, MK_DOWN, MK_OK, MK_BACK };
|
||||
static uint32_t mk_last;
|
||||
static int menu_key (void)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
pmx_idle ();
|
||||
uint32_t b = plat_keys (), n = b & ~mk_last;
|
||||
int det = plat_wheel ();
|
||||
if (pmx_k.invert) det = -det;
|
||||
mk_last = b;
|
||||
if (det > 0) return MK_DOWN;
|
||||
if (det < 0) return MK_UP;
|
||||
if (n & (PMX_K_A | PMX_K_B | PMX_K_WHEEL)) return MK_OK;
|
||||
if (n & PMX_K_C) return MK_BACK;
|
||||
plat_wait (10);
|
||||
}
|
||||
}
|
||||
static int menu (const char *title, const char *const *items, int n, int sel, int top_pic)
|
||||
{
|
||||
mk_last = plat_keys ();
|
||||
for (;;)
|
||||
{
|
||||
VL_ClearScreen (C_BACK);
|
||||
int y = 4;
|
||||
if (top_pic) { pmx_drawpic_scaled (0, 0, PK_TITLE, 128, 80); y = 82; }
|
||||
else { pmx_text_c (y, title, C_HI); y += 12; }
|
||||
int rows = (128 - y) / 10, first = sel - rows + 1; if (first < 0) first = 0;
|
||||
for (int i = first; i < n && i < first + rows; i++)
|
||||
{
|
||||
int yy = y + (i - first) * 10;
|
||||
if (i == sel) VL_Bar (0, yy - 2, 128, 10, 0x29);
|
||||
pmx_text (4, yy, items[i], i == sel ? C_HI : C_TEXT);
|
||||
}
|
||||
pmx_present ();
|
||||
switch (menu_key ())
|
||||
{
|
||||
case MK_UP: sel = (sel + n - 1) % n; break;
|
||||
case MK_DOWN: sel = (sel + 1) % n; break;
|
||||
case MK_OK: return sel;
|
||||
case MK_BACK: return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const char *const EPISODES[6] = { "ESCAPE", "EISENFAUST", "DIE FUHRER DIE", "A DARK SECRET", "TRAIL OF MADMAN", "CONFRONTATION" };
|
||||
static const char *const SKILLS[4] = { "CAN I PLAY, DADDY?", "DON'T HURT ME.", "BRING 'EM ON!", "I AM DEATH INCARNATE" };
|
||||
|
||||
static int choose_new_game (void)
|
||||
{
|
||||
int ep = 0;
|
||||
if (pmx_episodes > 1)
|
||||
{
|
||||
const char *items[6]; char buf[6][24];
|
||||
for (int i = 0; i < pmx_episodes; i++) { snprintf (buf[i], sizeof buf[i], "%d %s", i + 1, EPISODES[i]); items[i] = buf[i]; }
|
||||
ep = menu ("EPISODE", items, pmx_episodes, 0, 0);
|
||||
if (ep < 0) return 0;
|
||||
}
|
||||
int sk = menu (TX ("SCHWIERIGKEIT", "DIFFICULTY"), SKILLS, 4, 2, 0);
|
||||
if (sk < 0) return 0;
|
||||
NewGame (sk, ep);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* in game (A+C): returns with startgame set for a new game, playstate ex_abort to the title */
|
||||
void US_ControlPanel (ScanCode s)
|
||||
{
|
||||
(void)s;
|
||||
g_hud_on = 0;
|
||||
for (;;)
|
||||
{
|
||||
const char *items[] = { TX ("WEITER", "CONTINUE"), TX ("NEUES SPIEL", "NEW GAME"), pmx_sound_on ? TX ("TON: AN", "SOUND: ON") : TX ("TON: AUS", "SOUND: OFF"), TX ("ZUM PARADISE", "TO THE PARADISE") };
|
||||
int r = menu ("MENU", items, 4, 0, 0);
|
||||
if (r < 0 || r == 0) break;
|
||||
if (r == 1) { if (choose_new_game ()) break; continue; }
|
||||
if (r == 2) { pmx_sound_on ^= 1; if (!pmx_sound_on) SD_StopSound (); set_store (); continue; }
|
||||
if (r == 3) pmx_leave ();
|
||||
}
|
||||
VL_SetPalette (gamepal, true);
|
||||
g_hud_on = 1; hud_dirty = 1;
|
||||
}
|
||||
|
||||
void Message (const char *string)
|
||||
{
|
||||
VL_Bar (4, 30, 120, 40, 0x7f);
|
||||
PrintX = WindowX = 8; PrintY = 34; fontcolor = 0;
|
||||
US_Print (string);
|
||||
pmx_present ();
|
||||
}
|
||||
void ClearSplitVWB (void) {}
|
||||
void DrawPlayScreen (void) { VL_ClearScreen (0); g_hud_on = 1; hud_dirty = 1; DrawFace (); }
|
||||
void DrawPlayBorder (void) {}
|
||||
void DrawPlayBorderSides (void) {}
|
||||
void DrawStatusBorder (byte color) { (void)color; }
|
||||
void Write (int x, int y, const char *string) { pmx_text (x * 128 / 40, y * 128 / 25, string, C_TEXT); }
|
||||
boolean US_LineInput (int x, int y, char *buf, const char *def, boolean escok, int maxchars, int maxwidth)
|
||||
{ (void)x; (void)y; (void)buf; (void)def; (void)escok; (void)maxchars; (void)maxwidth; return false; }
|
||||
|
||||
void PreloadGraphics (void)
|
||||
{
|
||||
VL_Bar (0, 0, 128, viewheight, VIEWCOLOR);
|
||||
pmx_drawpic_scaled (0, 34, PK_GETPSYCHED, 128, 27);
|
||||
VW_UpdateScreen ();
|
||||
VW_FadeIn ();
|
||||
SDL_Delay (1000);
|
||||
}
|
||||
|
||||
/* ---- end of a floor (bonus as in wl_inter.c LevelCompleted) ---- */
|
||||
static const uint16_t PAR[60] = { /* par times in seconds (wl_inter.c parTimes; 0 = boss or secret floor) */
|
||||
90,120,120,210,180,180,150,150,0,0, 90,210,180,120,240,360,60,180,0,0, 90,90,150,150,210,150,120,360,0,0,
|
||||
120,120,90,60,270,210,120,270,0,0, 150,90,150,150,240,180,270,210,0,0, 390,240,270,360,300,300,330,330,510,0 };
|
||||
#ifdef SPEAR /* 1.6.11 test2: Spear of Destiny, 21 floors (wl_inter.c parTimes; 0 = boss or secret floor) */
|
||||
static const uint16_t PAR_SOD[21] = { 90,210,165,210,0, 270,195,165,285,0, 390,270,165,270,360,0, 360,0, 0,0,0 };
|
||||
static int normal_floor (void) { int m = gamestate.mapon; return m != 4 && m != 9 && m != 15 && m < 17; }
|
||||
#else
|
||||
static int normal_floor (void) { return gamestate.mapon < 8; }
|
||||
#endif
|
||||
static void line2 (int y, const char *a, const char *b) { pmx_text (6, y, a, C_TEXT); pmx_text (128 - 6 * (int)strlen (b) - 4, y, b, C_HI); }
|
||||
void LevelCompleted (void)
|
||||
{
|
||||
char t[24], v[16];
|
||||
g_hud_on = 0;
|
||||
VL_SetPalette (gamepal, true);
|
||||
VL_ClearScreen (VIEWCOLOR);
|
||||
if (normal_floor ())
|
||||
{
|
||||
int sec = gamestate.TimeCount / 70, kr = 0, sr = 0, tr = 0;
|
||||
int32_t timeleft = 0;
|
||||
if (sec > 99 * 60) sec = 99 * 60;
|
||||
#ifdef SPEAR
|
||||
int par = PAR_SOD[gamestate.mapon % 21];
|
||||
#else
|
||||
int par = PAR[(gamestate.episode * 10 + gamestate.mapon) % 60];
|
||||
#endif
|
||||
if (gamestate.TimeCount < par * 70) timeleft = par - sec;
|
||||
if (gamestate.killtotal) kr = (gamestate.killcount * 100) / gamestate.killtotal;
|
||||
if (gamestate.secrettotal) sr = (gamestate.secretcount * 100) / gamestate.secrettotal;
|
||||
if (gamestate.treasuretotal) tr = (gamestate.treasurecount * 100) / gamestate.treasuretotal;
|
||||
int32_t bonus = timeleft * 500 + 10000 * (kr >= 100) + 10000 * (sr >= 100) + 10000 * (tr >= 100);
|
||||
snprintf (t, sizeof t, "FLOOR %d COMPLETED", gamestate.mapon + 1); pmx_text_c (6, t, C_HI);
|
||||
snprintf (v, sizeof v, "%ld", (long)bonus); line2 (24, "BONUS", v);
|
||||
snprintf (v, sizeof v, "%02d:%02d", sec / 60, sec % 60); line2 (36, "TIME", v);
|
||||
snprintf (v, sizeof v, "%02d:%02d", par / 60, par % 60); line2 (46, "PAR", par > 0 ? v : "??:??");
|
||||
snprintf (v, sizeof v, "%d%%", kr); line2 (60, "KILL RATIO", v);
|
||||
snprintf (v, sizeof v, "%d%%", sr); line2 (70, "SECRET RATIO", v);
|
||||
snprintf (v, sizeof v, "%d%%", tr); line2 (80, "TREASURE RATIO", v);
|
||||
GivePoints (bonus);
|
||||
LevelRatios[gamestate.mapon].kill = kr;
|
||||
LevelRatios[gamestate.mapon].secret = sr;
|
||||
LevelRatios[gamestate.mapon].treasure = tr;
|
||||
LevelRatios[gamestate.mapon].time = sec;
|
||||
SD_PlaySound (bonus ? ENDBONUS2SND : NOBONUSSND);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef SPEAR
|
||||
static const char *const BOSS[6] = { "TRANS GROSSE", "BARNACLE WILHELM", "UBERMUTANT", "DEATH KNIGHT", "SECRET TUNNEL AREA", "SECRET CASTLE AREA" };
|
||||
int m = gamestate.mapon, b = m == 4 ? 0 : m == 9 ? 1 : m == 15 ? 2 : m == 17 ? 3 : m == 18 ? 4 : 5;
|
||||
pmx_text_c (30, BOSS[b], C_HI);
|
||||
pmx_text_c (40, b < 4 ? "DEFEATED!" : "COMPLETED!", C_HI);
|
||||
#else
|
||||
pmx_text_c (30, "SECRET FLOOR", C_HI);
|
||||
pmx_text_c (40, "COMPLETED!", C_HI);
|
||||
#endif
|
||||
pmx_text_c (60, "15000 BONUS!", C_TEXT);
|
||||
GivePoints (15000);
|
||||
SD_PlaySound (ENDBONUS2SND);
|
||||
}
|
||||
snprintf (v, sizeof v, "%ld", (long)gamestate.score); line2 (100, "SCORE", v);
|
||||
pmx_text_c (116, TX ("TASTE: WEITER", "KEY: GO ON"), C_DIM);
|
||||
pmx_present ();
|
||||
IN_Ack ();
|
||||
g_hud_on = 1; hud_dirty = 1;
|
||||
}
|
||||
|
||||
void Victory (void)
|
||||
{
|
||||
char v[24];
|
||||
int32_t sec = 0, kr = 0, sr = 0, tr = 0, n = 0;
|
||||
for (int i = 0; i < LRpack && i < 20; i++) { if (!LevelRatios[i].time && !LevelRatios[i].kill && !LevelRatios[i].secret && !LevelRatios[i].treasure) continue; sec += LevelRatios[i].time; kr += LevelRatios[i].kill; sr += LevelRatios[i].secret; tr += LevelRatios[i].treasure; n++; }
|
||||
g_hud_on = 0;
|
||||
VL_SetPalette (gamepal, true);
|
||||
VL_ClearScreen (VIEWCOLOR);
|
||||
pmx_text_c (8, "YOU WIN!", C_HI);
|
||||
snprintf (v, sizeof v, "%02ld:%02ld", (long)(sec / 60) % 100, (long)(sec % 60)); line2 (30, "TOTAL TIME", v);
|
||||
if (!n) n = 1;
|
||||
snprintf (v, sizeof v, "%ld%%", (long)(kr / n)); line2 (44, "KILL", v);
|
||||
snprintf (v, sizeof v, "%ld%%", (long)(sr / n)); line2 (54, "SECRET", v);
|
||||
snprintf (v, sizeof v, "%ld%%", (long)(tr / n)); line2 (64, "TREASURE", v);
|
||||
snprintf (v, sizeof v, "%ld", (long)gamestate.score); line2 (84, "SCORE", v);
|
||||
pmx_text_c (116, TX ("TASTE: WEITER", "KEY: GO ON"), C_DIM);
|
||||
pmx_present ();
|
||||
IN_Ack ();
|
||||
}
|
||||
void CheckHighScore (int32_t score, word other) { (void)score; (void)other; }
|
||||
|
||||
/* ---- start ---- */
|
||||
static void init_game (void)
|
||||
{
|
||||
if (!pmx_pack_open ()) pmx_error (TX ("KEINE WOLF3D-DATEN", "NO WOLF3D DATA"));
|
||||
set_load ();
|
||||
pmx_vl_init ();
|
||||
BuildTables ();
|
||||
SetupWalls ();
|
||||
pixelangle = g_pixelangle;
|
||||
wallheight = g_wallheight;
|
||||
viewsize = 20;
|
||||
SetViewSize (128, 128 - STATUSLINES);
|
||||
InitRedShifts ();
|
||||
US_InitRndT (true);
|
||||
hud_bg = 0x1d;
|
||||
{ int w, h; const byte *sb = pmx_pic (PK_STATUSBAR, &w, &h); if (sb && w > 4 && h > 20) hud_bg = sb[20 * w + 2]; }
|
||||
}
|
||||
|
||||
void pmx_leave (void)
|
||||
{
|
||||
pmx_leave_req = 0;
|
||||
plat_tone (0);
|
||||
if (ingame && !playstate && gamestate.health > 0)
|
||||
{
|
||||
VL_Bar (0, 40, 128, 16, 0);
|
||||
pmx_text_c (45, TX ("SPEICHERE", "SAVING"), C_HI);
|
||||
plat_lcd (pmx_screen (), 40, 56, pmx_lut ());
|
||||
pmx_save_game ();
|
||||
}
|
||||
plat_back ();
|
||||
}
|
||||
|
||||
void pmx_main (void)
|
||||
{
|
||||
init_game ();
|
||||
for (;;)
|
||||
{
|
||||
int cont = pmx_save_present ();
|
||||
const char *items[4]; int n = 0, act[4];
|
||||
if (cont) { items[n] = TX ("WEITER", "CONTINUE"); act[n++] = 0; }
|
||||
items[n] = TX ("NEUES SPIEL", "NEW GAME"); act[n++] = 1;
|
||||
items[n] = pmx_sound_on ? TX ("TON: AN", "SOUND: ON") : TX ("TON: AUS", "SOUND: OFF"); act[n++] = 2;
|
||||
items[n] = TX ("ZUM PARADISE", "TO THE PARADISE"); act[n++] = 3;
|
||||
g_hud_on = 0;
|
||||
VL_SetPalette (gamepal, true);
|
||||
int r = menu ("", items, n, 0, 1);
|
||||
if (r < 0) continue;
|
||||
r = act[r];
|
||||
if (r == 0) { if (!pmx_load_game ()) { pmx_save_forget (); continue; } loadedgame = true; }
|
||||
else if (r == 1) { if (!choose_new_game ()) continue; }
|
||||
else if (r == 2) { pmx_sound_on ^= 1; set_store (); continue; }
|
||||
else pmx_leave ();
|
||||
g_hud_on = 1;
|
||||
GameLoop ();
|
||||
g_hud_on = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* atan2 without floating point: the first quadrant from finetangent (tenths of a degree), then the quadrant */
|
||||
int pmx_iangle (int32_t dy, int32_t dx)
|
||||
{
|
||||
int64_t ay = dy < 0 ? -(int64_t)dy : dy, ax = dx < 0 ? -(int64_t)dx : dx;
|
||||
int a;
|
||||
if (!ax) a = ay ? 900 : 0;
|
||||
else
|
||||
{
|
||||
int64_t r = (ay << 16) / ax;
|
||||
int lo = 0, hi = FINEANGLES / 4; /* first a with tan(a + 0.5 tenth) > r */
|
||||
while (lo < hi) { int m = (lo + hi) / 2; if (finetangent[m] <= r) lo = m + 1; else hi = m; }
|
||||
a = lo; /* tenths of a degree, 0..900 */
|
||||
}
|
||||
if (dx < 0) a = 1800 - a;
|
||||
if (dy < 0) a = 3600 - a;
|
||||
if (a >= 3600) a -= 3600;
|
||||
return a / 10;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/* Paramix Wolf3D: what the platform (PC test runner or the Paradise) gives the game. Author: mameise. */
|
||||
#ifndef PMX_PLAT_H
|
||||
#define PMX_PLAT_H
|
||||
#include <stdint.h>
|
||||
|
||||
uint32_t plat_ms (void); /* milliseconds since start */
|
||||
void plat_wait (uint32_t ms); /* sleep (the Paradise: wfi until then) */
|
||||
int plat_exit (uint32_t held); /* 1.7.3 test12: the wheel held this long: go back (the way chosen in the Studio) */
|
||||
uint32_t plat_keys (void); /* PMX_K_* held now */
|
||||
int plat_wheel (void); /* wheel steps since the last call (+ one way, - the other) */
|
||||
void plat_lcd (const uint8_t *fb, int y0, int y1, const uint16_t *lut); /* rows y0..y1-1 of the 128-wide screen */
|
||||
void plat_tone (uint32_t hz); /* buzzer, 0 = off */
|
||||
const uint8_t *plat_pack (void); /* the data pack (W3DP), fast (cached) */
|
||||
const uint8_t *plat_pack_far (void); /* the same pack through a slower path, for offsets >= plat_pack_win() */
|
||||
uint32_t plat_pack_win (void); /* how much of the pack the fast pointer reaches */
|
||||
int plat_settings_read (void *buf, int len);
|
||||
void plat_settings_write (const void *buf, int len);
|
||||
void plat_back (void); /* leave to the Paradise (does not return) */
|
||||
void plat_save_at (uint32_t off, void *dst, int len); /* read the save area (60 KB) */
|
||||
void plat_save_page (uint32_t off, const void *src, int len); /* write one 4 KB page (off 4 KB aligned; rest 0xFF) */
|
||||
#define plat_save_read(buf, len) plat_save_at (0, (buf), (len))
|
||||
void plat_fatal (const char *s);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,173 @@
|
||||
/* Paramix Wolf3D: the game is saved when leaving to the Paradise and can be continued at the next start.
|
||||
* Same contents as SaveTheGame / LoadTheGame in Wolf4SDL's wl_main.c (id Software), streamed in 4 KB pieces into
|
||||
* the save area of the flash instead of a file. A header tells this program's build and the pack apart, so an
|
||||
* old save after an update is not used. Author: mameise. GPL-2.0-or-later. */
|
||||
#include "wl_def.h"
|
||||
#include "pmx_plat.h"
|
||||
#include "pmx_ca.h"
|
||||
|
||||
extern statetype s_grdstand, s_player;
|
||||
#define SAVE_MAGIC 0x56533357u /* "W3SV" */
|
||||
#define SAVE_MAX 0xF000
|
||||
|
||||
typedef struct { uint32_t magic, build, pack_len, len, sum; } SaveHead;
|
||||
|
||||
static uint32_t build_tag (void)
|
||||
{
|
||||
return (uint32_t)(uintptr_t)&s_grdstand ^ ((uint32_t)(uintptr_t)&s_player << 7) ^ (uint32_t)sizeof (objtype) << 20
|
||||
^ (uint32_t)sizeof (statobj_t) << 26 ^ (uint32_t)sizeof (gamestate);
|
||||
}
|
||||
|
||||
/* ---- writing: a 4 KB page at a time ---- */
|
||||
static byte *wbuf; /* borrowed: the map unpacking buffer (pmx_ca.c), free while a level runs */
|
||||
static uint32_t wpos, wsum;
|
||||
static int werr;
|
||||
extern byte *pmx_ca_scratch (uint32_t *len);
|
||||
static void wflush (void)
|
||||
{
|
||||
uint32_t page = (wpos - 1) & ~0xFFFu, n = wpos - page;
|
||||
if (!werr) plat_save_page (page, wbuf, (int)n);
|
||||
}
|
||||
static void wr (const void *p, uint32_t n)
|
||||
{
|
||||
const byte *s = (const byte *)p;
|
||||
while (n--)
|
||||
{
|
||||
if (wpos >= SAVE_MAX) { werr = 1; return; }
|
||||
wsum = wsum * 31u + *s;
|
||||
wbuf[wpos & 0xFFFu] = *s++; wpos++;
|
||||
if (!(wpos & 0xFFFu)) wflush ();
|
||||
}
|
||||
}
|
||||
|
||||
int pmx_save_game (void)
|
||||
{
|
||||
uint32_t cap; wbuf = pmx_ca_scratch (&cap);
|
||||
if (cap < 0x1000u) return 0;
|
||||
wpos = sizeof (SaveHead); wsum = 0; werr = 0;
|
||||
memset (wbuf, 0xFF, sizeof (SaveHead));
|
||||
wr (&gamestate, sizeof gamestate);
|
||||
wr (LevelRatios, sizeof LevelRatios);
|
||||
wr (tilemap, sizeof tilemap);
|
||||
for (int i = 0; i < mapwidth; i++)
|
||||
for (int j = 0; j < mapheight; j++)
|
||||
{
|
||||
objtype *ob = actorat[i][j];
|
||||
word actnum = ISPOINTER (ob) ? (word)(0x8000 | (word)(ob - objlist)) : (word)(uintptr_t)ob;
|
||||
wr (&actnum, sizeof actnum);
|
||||
}
|
||||
wr (areaconnect, sizeof areaconnect);
|
||||
wr (areabyplayer, sizeof areabyplayer);
|
||||
objtype nullobj;
|
||||
for (objtype *ob = player; ob; ob = ob->next)
|
||||
{
|
||||
memcpy (&nullobj, ob, sizeof nullobj);
|
||||
if (ob == player) nullobj.state = (statetype *)((uintptr_t)nullobj.state - (uintptr_t)&s_player);
|
||||
else nullobj.state = (statetype *)((uintptr_t)nullobj.state - (uintptr_t)&s_grdstand);
|
||||
wr (&nullobj, sizeof nullobj);
|
||||
}
|
||||
nullobj.active = ac_badobject;
|
||||
wr (&nullobj, sizeof nullobj);
|
||||
word laststatobjnum = (word)(laststatobj - statobjlist);
|
||||
wr (&laststatobjnum, sizeof laststatobjnum);
|
||||
for (statobj_t *st = &statobjlist[0]; st < laststatobj; st++) wr (st, sizeof *st);
|
||||
for (doorobj_t *door = &doorobjlist[0]; door < lastdoorobj; door++) wr (door, sizeof *door);
|
||||
wr (&pwallstate, sizeof pwallstate); wr (&pwalltile, sizeof pwalltile); wr (&pwallx, sizeof pwallx);
|
||||
wr (&pwally, sizeof pwally); wr (&pwalldir, sizeof pwalldir); wr (&pwallpos, sizeof pwallpos);
|
||||
if (werr) return 0;
|
||||
uint32_t len = wpos;
|
||||
if (wpos & 0xFFFu) wflush ();
|
||||
/* the header last: a save cut short (power gone) stays invalid */
|
||||
SaveHead h = { SAVE_MAGIC, build_tag (), pmx_pack_len (), len, wsum };
|
||||
plat_save_read (wbuf, 0x1000);
|
||||
memcpy (wbuf, &h, sizeof h);
|
||||
plat_save_page (0, wbuf, (int)(len < 0x1000u ? len : 0x1000u));
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ---- reading: straight from the flash ---- */
|
||||
static uint32_t rpos, rsum, rlen;
|
||||
static int rd (void *p, uint32_t n)
|
||||
{
|
||||
if (rpos + n > rlen) return 0;
|
||||
byte *d = (byte *)p;
|
||||
plat_save_at (rpos, d, (int)n);
|
||||
for (uint32_t i = 0; i < n; i++) rsum = rsum * 31u + d[i];
|
||||
rpos += n;
|
||||
return 1;
|
||||
}
|
||||
static int head_ok (SaveHead *h)
|
||||
{
|
||||
plat_save_at (0, h, sizeof *h);
|
||||
return h->magic == SAVE_MAGIC && h->build == build_tag () && h->pack_len == pmx_pack_len () && h->len > sizeof *h && h->len <= SAVE_MAX;
|
||||
}
|
||||
int pmx_save_present (void) { SaveHead h; return head_ok (&h); }
|
||||
void pmx_save_forget (void)
|
||||
{
|
||||
uint32_t cap; byte *b = pmx_ca_scratch (&cap);
|
||||
plat_save_read (b, 0x1000);
|
||||
memset (b, 0xFF, sizeof (SaveHead));
|
||||
plat_save_page (0, b, 0x1000);
|
||||
}
|
||||
|
||||
int pmx_load_game (void)
|
||||
{
|
||||
SaveHead h;
|
||||
if (!head_ok (&h)) return 0;
|
||||
/* the checksum over everything first, so a broken save does not leave a half loaded game */
|
||||
{ byte b[64]; rpos = sizeof h; rlen = h.len; rsum = 0;
|
||||
while (rpos < rlen) { uint32_t n = rlen - rpos < sizeof b ? rlen - rpos : sizeof b; rd (b, n); }
|
||||
if (rsum != h.sum) return 0; }
|
||||
rpos = sizeof h; rlen = h.len; rsum = 0;
|
||||
rd (&gamestate, sizeof gamestate);
|
||||
rd (LevelRatios, sizeof LevelRatios);
|
||||
SetupGameLevel ();
|
||||
rd (tilemap, sizeof tilemap);
|
||||
for (int i = 0; i < mapwidth; i++)
|
||||
for (int j = 0; j < mapheight; j++)
|
||||
{
|
||||
word actnum = 0; rd (&actnum, sizeof actnum);
|
||||
actorat[i][j] = (actnum & 0x8000) ? &objlist[actnum & 0x7fff] : (objtype *)(uintptr_t)actnum;
|
||||
}
|
||||
rd (areaconnect, sizeof areaconnect);
|
||||
rd (areabyplayer, sizeof areabyplayer);
|
||||
InitActorList ();
|
||||
objtype nullobj, *newobj;
|
||||
for (;;)
|
||||
{
|
||||
if (!rd (&nullobj, sizeof nullobj)) return 0;
|
||||
if (nullobj.active == ac_badobject) break;
|
||||
if (nullobj.obclass == playerobj) { newobj = player; nullobj.state = (statetype *)((uintptr_t)nullobj.state + (uintptr_t)&s_player); }
|
||||
else { newobj = GetNewActor (); nullobj.state = (statetype *)((uintptr_t)nullobj.state + (uintptr_t)&s_grdstand); }
|
||||
memcpy (newobj, &nullobj, sizeof nullobj - (sizeof nullobj.next + sizeof nullobj.prev));
|
||||
}
|
||||
word laststatobjnum = 0; rd (&laststatobjnum, sizeof laststatobjnum);
|
||||
if (laststatobjnum > MAXSTATS) return 0;
|
||||
laststatobj = &statobjlist[laststatobjnum];
|
||||
for (statobj_t *st = &statobjlist[0]; st < laststatobj; st++) rd (st, sizeof *st);
|
||||
for (doorobj_t *door = &doorobjlist[0]; door < lastdoorobj; door++) rd (door, sizeof *door);
|
||||
rd (&pwallstate, sizeof pwallstate); rd (&pwalltile, sizeof pwalltile); rd (&pwallx, sizeof pwallx);
|
||||
rd (&pwally, sizeof pwally); rd (&pwalldir, sizeof pwalldir); rd (&pwallpos, sizeof pwallpos);
|
||||
if (gamestate.secretcount)
|
||||
{
|
||||
word *map = mapsegs[0], tile;
|
||||
for (int y = 0; y < mapheight; y++)
|
||||
for (int x = 0; x < mapwidth; x++)
|
||||
{
|
||||
tile = *map;
|
||||
if (MAPSPOT (x, y, 1) == PUSHABLETILE && !tilemap[x][y] && !VALIDAREA (tile))
|
||||
{
|
||||
if (VALIDAREA (*(map + 1))) tile = *(map + 1);
|
||||
if (VALIDAREA (*(map - mapwidth))) tile = *(map - mapwidth);
|
||||
if (VALIDAREA (*(map + mapwidth))) tile = *(map + mapwidth);
|
||||
if (VALIDAREA (*(map - 1))) tile = *(map - 1);
|
||||
*map = tile;
|
||||
MAPSPOT (x, y, 1) = 0;
|
||||
}
|
||||
map++;
|
||||
}
|
||||
}
|
||||
Thrust (0, 0);
|
||||
lastgamemusicoffset = 0;
|
||||
return 1;
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/* Paramix Wolf3D: sound on the Paradise's buzzer. The game's PC speaker sounds are one tone at a time already:
|
||||
* one byte every 1/140 s, 0 = silence, else the PC timer divisor / 60 (frequency = 1193181 / (byte * 60) Hz).
|
||||
* pmx_sd_service() is called every millisecond (the Paradise's tick) or often (PC test).
|
||||
* Author: mameise. GPL-2.0-or-later. */
|
||||
#include "wl_def.h"
|
||||
#include "pmx_plat.h"
|
||||
#include "pmx_ca.h"
|
||||
|
||||
globalsoundpos channelSoundPos[1];
|
||||
boolean AdLibPresent, SoundBlasterPresent, SoundPositioned;
|
||||
byte SoundMode = sdm_PC, DigiMode = sds_Off, MusicMode = smm_Off;
|
||||
int pmx_sound_on = 1;
|
||||
|
||||
static volatile const byte *s_data;
|
||||
static volatile uint32_t s_len, s_start;
|
||||
static volatile int s_num, s_prio;
|
||||
static volatile uint32_t s_hz;
|
||||
|
||||
void SD_Startup (void) {}
|
||||
|
||||
boolean SD_PlaySound (int sound)
|
||||
{
|
||||
uint32_t len; int prio;
|
||||
if (!pmx_sound_on) return false;
|
||||
const byte *d = pmx_sound (sound, &len, &prio);
|
||||
if (!d || !len) return false;
|
||||
if (s_data && prio < s_prio) return false; /* a more important sound is playing */
|
||||
s_data = 0; /* the tick does not read while we change it */
|
||||
s_len = len; s_prio = prio; s_num = sound; s_start = plat_ms ();
|
||||
s_data = d;
|
||||
return true;
|
||||
}
|
||||
|
||||
void pmx_sd_service (uint32_t now)
|
||||
{
|
||||
const byte *d = (const byte *)s_data;
|
||||
uint32_t hz = 0;
|
||||
if (d)
|
||||
{
|
||||
uint32_t i = (now - s_start) * 140u / 1000u;
|
||||
if (i >= s_len) { s_data = 0; s_num = 0; }
|
||||
else { byte b = d[i]; hz = b ? 1193181u / ((uint32_t)b * 60u) : 0; }
|
||||
}
|
||||
if (hz != s_hz)
|
||||
{
|
||||
/* a new pitch always starts the buzzer anew (as in GBEmu test39: changing the running timer stays silent) */
|
||||
if (hz && s_hz) plat_tone (0);
|
||||
s_hz = hz; plat_tone (hz);
|
||||
}
|
||||
}
|
||||
|
||||
/* before writing the flash: nothing in the millisecond tick reads the flash any more */
|
||||
void pmx_sd_halt (void) { s_data = 0; s_num = 0; s_hz = 0; plat_tone (0); }
|
||||
void SD_StopSound (void)
|
||||
{
|
||||
s_data = 0; s_num = 0;
|
||||
#ifndef PMX_SD_IN_TICK
|
||||
pmx_sd_service (plat_ms ());
|
||||
#endif
|
||||
}
|
||||
word SD_SoundPlaying (void) { return s_data ? (word)s_num : 0; }
|
||||
void SD_WaitSoundDone (void) { uint32_t t0 = plat_ms (); while (s_data && plat_ms () - t0 < 3000u) { pmx_idle (); plat_wait (2); } }
|
||||
void SD_PositionSound (int leftvol, int rightvol) { (void)leftvol; (void)rightvol; }
|
||||
void SD_SetPosition (int channel, int leftvol, int rightvol) { (void)channel; (void)leftvol; (void)rightvol; }
|
||||
void SD_StopDigitized (void) {}
|
||||
|
||||
void Delay (int32_t wolfticks)
|
||||
{
|
||||
if (wolfticks > 0) SDL_Delay ((uint32_t)wolfticks * 100u / 7u);
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
/* generated by tools/gen_tables.c (BuildTables, CalcProjection of Wolf4SDL for a view 128 wide) */
|
||||
#define PMX_T_SCALE 87
|
||||
#define PMX_T_HEIGHTNUMERATOR 89088
|
||||
const int32_t finetangent[900] = {
|
||||
57,171,285,400,514,629,743,857,972,1086,
|
||||
1201,1315,1430,1544,1658,1773,1887,2002,2116,2231,
|
||||
2345,2460,2574,2689,2804,2918,3033,3147,3262,3377,
|
||||
3491,3606,3721,3836,3950,4065,4180,4295,4410,4525,
|
||||
4640,4755,4870,4985,5100,5215,5330,5445,5560,5676,
|
||||
5791,5906,6021,6137,6252,6368,6483,6599,6714,6830,
|
||||
6945,7061,7177,7293,7408,7524,7640,7756,7872,7988,
|
||||
8104,8221,8337,8453,8569,8686,8802,8919,9035,9152,
|
||||
9268,9385,9502,9619,9735,9852,9969,10086,10204,10321,
|
||||
10438,10555,10673,10790,10908,11025,11143,11261,11378,11496,
|
||||
11614,11732,11850,11968,12087,12205,12323,12442,12560,12679,
|
||||
12798,12917,13035,13154,13273,13393,13512,13631,13750,13870,
|
||||
13989,14109,14229,14349,14468,14588,14709,14829,14949,15069,
|
||||
15190,15311,15431,15552,15673,15794,15915,16036,16157,16279,
|
||||
16400,16522,16644,16765,16887,17009,17131,17254,17376,17499,
|
||||
17621,17744,17867,17990,18113,18236,18359,18483,18606,18730,
|
||||
18854,18977,19102,19226,19350,19474,19599,19724,19848,19973,
|
||||
20098,20224,20349,20474,20600,20726,20852,20978,21104,21230,
|
||||
21357,21483,21610,21737,21864,21991,22118,22246,22374,22501,
|
||||
22629,22757,22886,23014,23143,23271,23400,23529,23659,23788,
|
||||
23917,24047,24177,24307,24437,24568,24698,24829,24960,25091,
|
||||
25222,25353,25485,25617,25749,25881,26013,26146,26278,26411,
|
||||
26544,26678,26811,26945,27078,27212,27347,27481,27616,27750,
|
||||
27885,28021,28156,28292,28427,28563,28700,28836,28973,29110,
|
||||
29247,29384,29521,29659,29797,29935,30073,30212,30351,30490,
|
||||
30629,30769,30908,31048,31188,31329,31469,31610,31751,31893,
|
||||
32034,32176,32318,32461,32603,32746,32889,33032,33176,33320,
|
||||
33464,33608,33753,33898,34043,34188,34334,34480,34626,34772,
|
||||
34919,35066,35213,35361,35509,35657,35805,35954,36103,36252,
|
||||
36401,36551,36701,36852,37003,37154,37305,37456,37608,37761,
|
||||
37913,38066,38219,38372,38526,38680,38835,38989,39144,39300,
|
||||
39455,39611,39768,39924,40081,40239,40396,40554,40713,40871,
|
||||
41031,41190,41350,41510,41670,41831,41992,42154,42316,42478,
|
||||
42640,42803,42967,43131,43295,43459,43624,43789,43955,44121,
|
||||
44287,44454,44621,44789,44957,45125,45294,45463,45633,45803,
|
||||
45974,46144,46316,46487,46660,46832,47005,47179,47353,47527,
|
||||
47702,47877,48052,48229,48405,48582,48760,48938,49116,49295,
|
||||
49474,49654,49834,50015,50196,50378,50560,50743,50926,51110,
|
||||
51294,51479,51664,51850,52036,52223,52410,52598,52786,52975,
|
||||
53164,53354,53545,53736,53927,54119,54312,54505,54699,54893,
|
||||
55088,55284,55480,55676,55874,56072,56270,56469,56669,56869,
|
||||
57070,57271,57473,57676,57879,58083,58287,58493,58698,58905,
|
||||
59112,59320,59528,59737,59947,60157,60369,60580,60793,61006,
|
||||
61220,61434,61650,61866,62082,62300,62518,62737,62956,63176,
|
||||
63397,63619,63842,64065,64289,64514,64740,64966,65193,65421,
|
||||
65650,65880,66110,66341,66573,66806,67040,67274,67509,67746,
|
||||
67983,68221,68459,68699,68939,69181,69423,69666,69910,70155,
|
||||
70401,70648,70896,71145,71394,71645,71896,72149,72403,72657,
|
||||
72912,73169,73426,73685,73944,74205,74466,74729,74993,75257,
|
||||
75523,75790,76058,76327,76597,76868,77140,77414,77688,77964,
|
||||
78241,78519,78798,79078,79360,79643,79926,80212,80498,80785,
|
||||
81074,81364,81656,81948,82242,82537,82834,83132,83431,83731,
|
||||
84033,84336,84640,84946,85254,85562,85872,86184,86497,86811,
|
||||
87127,87444,87763,88083,88405,88728,89053,89379,89707,90037,
|
||||
90368,90700,91035,91371,91708,92047,92388,92731,93075,93421,
|
||||
93769,94118,94469,94822,95177,95533,95892,96252,96614,96978,
|
||||
97344,97711,98081,98453,98826,99202,99579,99959,100340,100724,
|
||||
101109,101497,101887,102279,102673,103069,103467,103868,104271,104676,
|
||||
105083,105493,105905,106319,106735,107154,107576,107999,108426,108854,
|
||||
109286,109719,110156,110594,111036,111480,111927,112376,112828,113283,
|
||||
113740,114201,114664,115130,115599,116070,116545,117022,117503,117987,
|
||||
118473,118963,119456,119952,120451,120953,121459,121968,122480,122996,
|
||||
123515,124037,124563,125092,125625,126162,126702,127246,127793,128344,
|
||||
128899,129458,130021,130587,131158,131732,132311,132893,133480,134071,
|
||||
134666,135266,135870,136478,137091,137708,138329,138956,139587,140222,
|
||||
140863,141508,142158,142813,143473,144138,144809,145484,146165,146851,
|
||||
147542,148239,148941,149649,150363,151082,151808,152539,153276,154019,
|
||||
154768,155523,156285,157053,157828,158609,159396,160191,160992,161800,
|
||||
162615,163437,164267,165103,165948,166799,167658,168525,169400,170282,
|
||||
171173,172072,172979,173894,174818,175751,176692,177643,178602,179570,
|
||||
180548,181536,182532,183539,184555,185582,186619,187666,188723,189792,
|
||||
190871,191961,193062,194175,195299,196435,197584,198744,199916,201101,
|
||||
202299,203510,204734,205971,207222,208487,209766,211060,212368,213691,
|
||||
215029,216383,217752,219137,220538,221956,223391,224843,226313,227800,
|
||||
229306,230830,232373,233935,235516,237118,238740,240383,242047,243732,
|
||||
245440,247170,248923,250699,252499,254324,256173,258048,259949,261876,
|
||||
263831,265813,267823,269862,271931,274030,276160,278321,280515,282741,
|
||||
285002,287297,289627,291994,294397,296839,299320,301840,304401,307005,
|
||||
309651,312341,315076,317858,320687,323564,326492,329471,332503,335589,
|
||||
338731,341930,345188,348506,351886,355330,358841,362418,366066,369785,
|
||||
373579,377448,381397,385426,389539,393738,398026,402406,406880,411453,
|
||||
416128,420906,425794,430793,435909,441144,446504,451993,457616,463378,
|
||||
469284,475339,481549,487921,494460,501174,508070,515155,522436,529924,
|
||||
537626,545551,553710,562114,570773,579699,588905,598404,608212,618342,
|
||||
628811,639637,650838,662434,674447,686899,699816,713223,727149,741625,
|
||||
756684,772363,788701,805739,823525,842108,861544,881893,903221,925600,
|
||||
949110,973839,999886,1027357,1056374,1087071,1119598,1154125,1190842,1229963,
|
||||
1271734,1316434,1364382,1415946,1471551,1531692,1596949,1668002,1745662,1830894,
|
||||
1924864,2028989,2145010,2275089,2421948,2589058,2780919,3003472,3264723,3575729,
|
||||
3952202,4417248,5006295,5776577,6826947,8344131,10728256,15019650,25032852,75098708,
|
||||
};
|
||||
const int32_t sintable[450] = {
|
||||
0,1143,2287,3429,4571,5711,6850,7986,9120,10252,
|
||||
11380,12504,13625,14742,15854,16961,18064,19160,20251,21336,
|
||||
22414,23486,24550,25606,26655,27696,28729,29752,30767,31772,
|
||||
32767,33753,34728,35693,36647,37589,38521,39440,40347,41243,
|
||||
42125,42995,43852,44695,45525,46340,47142,47930,48702,49460,
|
||||
50203,50931,51643,52339,53019,53683,54331,54963,55577,56175,
|
||||
56755,57319,57864,58393,58903,59395,59870,60326,60763,61183,
|
||||
61583,61965,62328,62672,62997,63302,63589,63856,64103,64331,
|
||||
64540,64729,64898,65047,65176,65286,65376,65446,65496,65526,
|
||||
65536,65526,65496,65446,65376,65286,65176,65047,64898,64729,
|
||||
64540,64331,64103,63856,63589,63302,62997,62672,62328,61965,
|
||||
61583,61183,60763,60326,59870,59395,58903,58393,57864,57319,
|
||||
56755,56175,55577,54963,54331,53683,53019,52339,51643,50931,
|
||||
50203,49460,48702,47930,47142,46340,45525,44695,43852,42995,
|
||||
42125,41243,40347,39440,38521,37589,36647,35693,34728,33753,
|
||||
32767,31772,30767,29752,28729,27696,26655,25606,24550,23486,
|
||||
22414,21336,20251,19160,18064,16961,15854,14742,13625,12504,
|
||||
11380,10252,9120,7986,6850,5711,4571,3429,2287,1143,
|
||||
0,-1143,-2287,-3429,-4571,-5711,-6850,-7986,-9120,-10252,
|
||||
-11380,-12504,-13625,-14742,-15854,-16961,-18064,-19160,-20251,-21336,
|
||||
-22414,-23486,-24550,-25606,-26655,-27696,-28729,-29752,-30767,-31772,
|
||||
-32767,-33753,-34728,-35693,-36647,-37589,-38521,-39440,-40347,-41243,
|
||||
-42125,-42995,-43852,-44695,-45525,-46340,-47142,-47930,-48702,-49460,
|
||||
-50203,-50931,-51643,-52339,-53019,-53683,-54331,-54963,-55577,-56175,
|
||||
-56755,-57319,-57864,-58393,-58903,-59395,-59870,-60326,-60763,-61183,
|
||||
-61583,-61965,-62328,-62672,-62997,-63302,-63589,-63856,-64103,-64331,
|
||||
-64540,-64729,-64898,-65047,-65176,-65286,-65376,-65446,-65496,-65526,
|
||||
-65536,-65526,-65496,-65446,-65376,-65286,-65176,-65047,-64898,-64729,
|
||||
-64540,-64331,-64103,-63856,-63589,-63302,-62997,-62672,-62328,-61965,
|
||||
-61583,-61183,-60763,-60326,-59870,-59395,-58903,-58393,-57864,-57319,
|
||||
-56755,-56175,-55577,-54963,-54331,-53683,-53019,-52339,-51643,-50931,
|
||||
-50203,-49460,-48702,-47930,-47142,-46340,-45525,-44695,-43852,-42995,
|
||||
-42125,-41243,-40347,-39440,-38521,-37589,-36647,-35693,-34728,-33753,
|
||||
-32767,-31772,-30767,-29752,-28729,-27696,-26655,-25606,-24550,-23486,
|
||||
-22414,-21336,-20251,-19160,-18064,-16961,-15854,-14742,-13625,-12504,
|
||||
-11380,-10252,-9120,-7986,-6850,-5711,-4571,-3429,-2287,-1143,
|
||||
0,1143,2287,3429,4571,5711,6850,7986,9120,10252,
|
||||
11380,12504,13625,14742,15854,16961,18064,19160,20251,21336,
|
||||
22414,23486,24550,25606,26655,27696,28729,29752,30767,31772,
|
||||
32767,33753,34728,35693,36647,37589,38521,39440,40347,41243,
|
||||
42125,42995,43852,44695,45525,46340,47142,47930,48702,49460,
|
||||
50203,50931,51643,52339,53019,53683,54331,54963,55577,56175,
|
||||
56755,57319,57864,58393,58903,59395,59870,60326,60763,61183,
|
||||
61583,61965,62328,62672,62997,63302,63589,63856,64103,64331,
|
||||
64540,64729,64898,65047,65176,65286,65376,65446,65496,65526,
|
||||
};
|
||||
static const short pmx_pixelangle[128] = {
|
||||
357,353,348,344,339,335,330,326,321,316,312,307,302,297,292,287,
|
||||
282,277,272,266,261,256,251,245,240,234,229,223,218,212,206,200,
|
||||
195,189,183,177,171,165,159,153,147,141,134,128,122,116,109,103,
|
||||
97,90,84,78,71,65,58,52,45,39,32,26,19,13,6,0,
|
||||
0,-6,-13,-19,-26,-32,-39,-45,-52,-58,-65,-71,-78,-84,-90,-97,
|
||||
-103,-109,-116,-122,-128,-134,-141,-147,-153,-159,-165,-171,-177,-183,-189,-195,
|
||||
-200,-206,-212,-218,-223,-229,-234,-240,-245,-251,-256,-261,-266,-272,-277,-282,
|
||||
-287,-292,-297,-302,-307,-312,-316,-321,-326,-330,-335,-339,-344,-348,-353,-357,
|
||||
};
|
||||
@@ -0,0 +1,235 @@
|
||||
/* Paramix Wolf3D: the screen. One 8-bit buffer of 128 x 128 (view 128 x 96 above, status bar 128 x 32 below),
|
||||
* sent to the display through a table of the current palette (RGB565).
|
||||
* Author: mameise. GPL-2.0-or-later. */
|
||||
#include "wl_def.h"
|
||||
#include "pmx_plat.h"
|
||||
#include "pmx_ca.h"
|
||||
#include "font.h"
|
||||
|
||||
#define RGB(r, g, b) {(r)*255/63, (g)*255/63, (b)*255/63, 0}
|
||||
SDL_Color gamepal[] = {
|
||||
#ifdef SPEAR
|
||||
#include "sodpal.inc"
|
||||
#else
|
||||
#include "wolfpal.inc"
|
||||
#endif
|
||||
};
|
||||
#undef RGB
|
||||
|
||||
static byte g_screen[128 * 128] __attribute__((aligned(4)));
|
||||
static SDL_Surface g_surf = { g_screen };
|
||||
SDL_Surface *screenBuffer = &g_surf;
|
||||
int16_t screenWidth = 128, screenHeight = 128;
|
||||
unsigned screenPitch = 128, bufferPitch = 128;
|
||||
int scaleFactor = 1;
|
||||
boolean screenfaded;
|
||||
unsigned bordercolor;
|
||||
static uint32_t g_ylookup[128];
|
||||
uint32_t *ylookup = g_ylookup;
|
||||
byte fontcolor, backcolor;
|
||||
int fontnumber;
|
||||
int px, py;
|
||||
static uint16_t g_lut[256];
|
||||
static SDL_Color g_curpal[256];
|
||||
|
||||
byte *pmx_screen (void) { return g_screen; }
|
||||
const uint16_t *pmx_lut (void) { return g_lut; }
|
||||
|
||||
void pmx_vl_init (void)
|
||||
{
|
||||
for (int i = 0; i < 128; i++) g_ylookup[i] = (uint32_t)i * 128u;
|
||||
VL_SetPalette (gamepal, true);
|
||||
}
|
||||
|
||||
int pmx_lut_changed;
|
||||
void VL_SetPalette (SDL_Color *palette, bool forceupdate)
|
||||
{
|
||||
(void)forceupdate;
|
||||
pmx_lut_changed = 1;
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
g_curpal[i] = palette[i];
|
||||
g_lut[i] = (uint16_t)((palette[i].r >> 3) << 11 | (palette[i].g >> 2) << 5 | (palette[i].b >> 3));
|
||||
}
|
||||
}
|
||||
|
||||
void pmx_palshift (int r, int g, int b, int i, int steps)
|
||||
{
|
||||
for (int j = 0; j < 256; j++)
|
||||
{
|
||||
const SDL_Color *p = &gamepal[j]; SDL_Color *o = &g_curpal[j];
|
||||
o->r = (uint8_t)(p->r + (r - p->r) * i / steps);
|
||||
o->g = (uint8_t)(p->g + (g - p->g) * i / steps);
|
||||
o->b = (uint8_t)(p->b + (b - p->b) * i / steps);
|
||||
g_lut[j] = (uint16_t)((o->r >> 3) << 11 | (o->g >> 2) << 5 | (o->b >> 3));
|
||||
}
|
||||
pmx_lut_changed = 1;
|
||||
}
|
||||
|
||||
/* fades in a few steps (each one a full picture) */
|
||||
#define FADE_STEPS 6
|
||||
void VL_FadeOut (int start, int end, int red, int green, int blue, int steps)
|
||||
{
|
||||
(void)steps;
|
||||
SDL_Color pal[256], from[256];
|
||||
memcpy (from, g_curpal, sizeof from);
|
||||
red = red * 255 / 63; green = green * 255 / 63; blue = blue * 255 / 63;
|
||||
for (int s = 1; s <= FADE_STEPS; s++)
|
||||
{
|
||||
memcpy (pal, from, sizeof pal);
|
||||
for (int i = start; i <= end; i++)
|
||||
{
|
||||
pal[i].r = (uint8_t)(from[i].r + (red - from[i].r) * s / FADE_STEPS);
|
||||
pal[i].g = (uint8_t)(from[i].g + (green - from[i].g) * s / FADE_STEPS);
|
||||
pal[i].b = (uint8_t)(from[i].b + (blue - from[i].b) * s / FADE_STEPS);
|
||||
}
|
||||
VL_SetPalette (pal, true);
|
||||
pmx_present ();
|
||||
SDL_Delay (20);
|
||||
}
|
||||
screenfaded = true;
|
||||
}
|
||||
void VL_FadeIn (int start, int end, SDL_Color *palette, int steps)
|
||||
{
|
||||
(void)steps;
|
||||
SDL_Color pal[256], from[256];
|
||||
memcpy (from, g_curpal, sizeof from);
|
||||
for (int s = 1; s <= FADE_STEPS; s++)
|
||||
{
|
||||
memcpy (pal, from, sizeof pal);
|
||||
for (int i = start; i <= end; i++)
|
||||
{
|
||||
pal[i].r = (uint8_t)(from[i].r + (palette[i].r - from[i].r) * s / FADE_STEPS);
|
||||
pal[i].g = (uint8_t)(from[i].g + (palette[i].g - from[i].g) * s / FADE_STEPS);
|
||||
pal[i].b = (uint8_t)(from[i].b + (palette[i].b - from[i].b) * s / FADE_STEPS);
|
||||
}
|
||||
VL_SetPalette (pal, true);
|
||||
pmx_present ();
|
||||
SDL_Delay (20);
|
||||
}
|
||||
VL_SetPalette (palette, true);
|
||||
screenfaded = false;
|
||||
}
|
||||
|
||||
byte *VL_LockSurface (SDL_Surface *surface) { return surface->pixels; }
|
||||
void VL_UnlockSurface (SDL_Surface *surface) { (void)surface; }
|
||||
|
||||
void VL_Bar (int x, int y, int w, int h, int color)
|
||||
{
|
||||
if (x < 0) { w += x; x = 0; }
|
||||
if (y < 0) { h += y; y = 0; }
|
||||
if (x + w > 128) w = 128 - x;
|
||||
if (y + h > 128) h = 128 - y;
|
||||
for (int j = 0; j < h; j++) memset (g_screen + (y + j) * 128 + x, color, (size_t)(w > 0 ? w : 0));
|
||||
}
|
||||
void VL_BarScaledCoord (int scx, int scy, int scwidth, int scheight, int color) { VL_Bar (scx, scy, scwidth, scheight, color); }
|
||||
void VWB_Bar (int x, int y, int width, int height, int color) { VL_Bar (x, y, width, height, color); }
|
||||
void VL_ClearScreen (int color) { memset (g_screen, color, sizeof g_screen); }
|
||||
|
||||
/* a pic of the pack, cut at the screen's edges; colour 255 is not transparent in Wolf3D pics */
|
||||
void pmx_drawpic (int x, int y, int k)
|
||||
{
|
||||
int w, h; const byte *p = pmx_pic (k, &w, &h);
|
||||
if (!p) return;
|
||||
for (int j = 0; j < h; j++)
|
||||
{
|
||||
int yy = y + j; if (yy < 0 || yy >= 128) continue;
|
||||
for (int i = 0; i < w; i++) { int xx = x + i; if (xx >= 0 && xx < 128) g_screen[yy * 128 + xx] = p[j * w + i]; }
|
||||
}
|
||||
}
|
||||
/* a pic shrunk to dw x dh (nearest dot) */
|
||||
void pmx_drawpic_scaled (int x, int y, int k, int dw, int dh)
|
||||
{
|
||||
int w, h; const byte *p = pmx_pic (k, &w, &h);
|
||||
if (!p || dw <= 0 || dh <= 0) return;
|
||||
for (int j = 0; j < dh; j++)
|
||||
{
|
||||
int yy = y + j; if (yy < 0 || yy >= 128) continue;
|
||||
const byte *row = p + (j * h / dh) * w;
|
||||
for (int i = 0; i < dw; i++) { int xx = x + i; if (xx >= 0 && xx < 128) g_screen[yy * 128 + xx] = row[i * w / dw]; }
|
||||
}
|
||||
}
|
||||
/* the game's chunk numbers (gfxv_wl6.h) to the pack's pics */
|
||||
int chunk_to_pk (int c)
|
||||
{
|
||||
#ifdef SPEAR /* 1.6.11 test2 Spear of Destiny: the pack keeps the order of Wolf3D, the faces of SOD come after */
|
||||
if (c >= L_COLONPIC && c <= L_BJWINSPIC) return c - L_COLONPIC;
|
||||
if (c >= KNIFEPIC && c <= GOTGATLINGPIC) return c - KNIFEPIC + PK_KNIFE;
|
||||
if (c >= GODMODEFACE1PIC && c <= BJOUCHPIC) return PK_SOD_GOD1 + c - GODMODEFACE1PIC;
|
||||
switch (c)
|
||||
{
|
||||
case STATUSBARPIC: return PK_STATUSBAR;
|
||||
case TITLE1PIC: return PK_TITLE;
|
||||
case PG13PIC: return PK_PG13;
|
||||
case CREDITSPIC: return PK_CREDITS;
|
||||
case HIGHSCORESPIC: return PK_HIGHSCORES;
|
||||
case PAUSEDPIC: return PK_PAUSED;
|
||||
case GETPSYCHEDPIC: return PK_GETPSYCHED;
|
||||
}
|
||||
return -1;
|
||||
#else
|
||||
return c - L_COLONPIC;
|
||||
#endif
|
||||
}
|
||||
void VWB_DrawPic (int x, int y, int chunknum) { pmx_drawpic (x * 128 / 320, y * 128 / 320, chunk_to_pk (chunknum)); }
|
||||
void VWB_DrawPicScaledCoord (int x, int y, int chunknum) { pmx_drawpic (x, y, chunk_to_pk (chunknum)); }
|
||||
|
||||
/* ---- text: 5 x 7 dots, 6 per letter ---- */
|
||||
void pmx_text (int x, int y, const char *s, int color)
|
||||
{
|
||||
for (; *s; s++, x += 6)
|
||||
{
|
||||
int c = (unsigned char)*s; if (c >= 'a' && c <= 'z') c -= 32;
|
||||
c = (c < 32 || c > 127) ? 0 : c - 32;
|
||||
for (int r = 0; r < 7; r++)
|
||||
{
|
||||
int yy = y + r; if (yy < 0 || yy >= 128) continue;
|
||||
unsigned bits = g_font[c][r];
|
||||
for (int k = 0; k < 5; k++) if ((bits & (0x10u >> k)) && x + k >= 0 && x + k < 128) g_screen[yy * 128 + x + k] = (byte)color;
|
||||
}
|
||||
}
|
||||
}
|
||||
void pmx_text_c (int y, const char *s, int color) { pmx_text ((128 - 6 * (int)strlen (s)) / 2 + 1, y, s, color); }
|
||||
|
||||
/* ---- the id print routines the game still uses (debug texts, messages) ---- */
|
||||
word PrintX, PrintY, WindowX, WindowY, WindowW, WindowH;
|
||||
void US_Print (const char *s)
|
||||
{
|
||||
char line[24]; int n = 0;
|
||||
for (;; s++)
|
||||
{
|
||||
if (*s == '\n' || !*s || n == 21)
|
||||
{
|
||||
line[n] = 0; pmx_text (PrintX, PrintY, line, fontcolor);
|
||||
if (!*s) { PrintX += 6 * n; break; }
|
||||
PrintY += 8; PrintX = WindowX; n = 0;
|
||||
if (*s != '\n') line[n++] = *s;
|
||||
continue;
|
||||
}
|
||||
line[n++] = *s;
|
||||
}
|
||||
}
|
||||
void US_PrintSigned (int32_t n) { char b[16]; snprintf (b, sizeof b, "%ld", (long)n); US_Print (b); }
|
||||
void US_PrintUnsigned (longword n) { char b[16]; snprintf (b, sizeof b, "%lu", (unsigned long)n); US_Print (b); }
|
||||
void US_CPrint (const char *s) { US_Print (s); }
|
||||
void US_DrawWindow (word x, word y, word w, word h)
|
||||
{
|
||||
WindowX = x; WindowY = y; WindowW = w; WindowH = h; PrintX = x; PrintY = y;
|
||||
VL_Bar (x, y, w, h, 0x7f);
|
||||
}
|
||||
void US_CenterWindow (word w, word h) { US_DrawWindow (4, 20, 120, 60); (void)w; (void)h; }
|
||||
|
||||
void VH_UpdateScreen (SDL_Surface *surface)
|
||||
{
|
||||
(void)surface;
|
||||
pmx_present ();
|
||||
}
|
||||
|
||||
boolean FizzleFade (SDL_Surface *source, int x1, int y1, unsigned width, unsigned height, unsigned frames, boolean abortable)
|
||||
{
|
||||
(void)source; (void)abortable;
|
||||
pmx_present ();
|
||||
SDL_Delay (frames * 1000u / 70u / 3u);
|
||||
(void)x1; (void)y1; (void)width; (void)height;
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
0, 8, 109, 220, 222, 241, 149, 107, 75, 248, 254, 140, 16, 66,
|
||||
74, 21, 211, 47, 80, 242, 154, 27, 205, 128, 161, 89, 77, 36,
|
||||
95, 110, 85, 48, 212, 140, 211, 249, 22, 79, 200, 50, 28, 188,
|
||||
52, 140, 202, 120, 68, 145, 62, 70, 184, 190, 91, 197, 152, 224,
|
||||
149, 104, 25, 178, 252, 182, 202, 182, 141, 197, 4, 81, 181, 242,
|
||||
145, 42, 39, 227, 156, 198, 225, 193, 219, 93, 122, 175, 249, 0,
|
||||
175, 143, 70, 239, 46, 246, 163, 53, 163, 109, 168, 135, 2, 235,
|
||||
25, 92, 20, 145, 138, 77, 69, 166, 78, 176, 173, 212, 166, 113,
|
||||
94, 161, 41, 50, 239, 49, 111, 164, 70, 60, 2, 37, 171, 75,
|
||||
136, 156, 11, 56, 42, 146, 138, 229, 73, 146, 77, 61, 98, 196,
|
||||
135, 106, 63, 197, 195, 86, 96, 203, 113, 101, 170, 247, 181, 113,
|
||||
80, 250, 108, 7, 255, 237, 129, 226, 79, 107, 112, 166, 103, 241,
|
||||
24, 223, 239, 120, 198, 58, 60, 82, 128, 3, 184, 66, 143, 224,
|
||||
145, 224, 81, 206, 163, 45, 63, 90, 168, 114, 59, 33, 159, 95,
|
||||
28, 139, 123, 98, 125, 196, 15, 70, 194, 253, 54, 14, 109, 226,
|
||||
71, 17, 161, 93, 186, 87, 244, 138, 20, 52, 123, 251, 26, 36,
|
||||
17, 46, 52, 231, 232, 76, 31, 221, 84, 37, 216, 165, 212, 106,
|
||||
197, 242, 98, 43, 39, 175, 254, 145, 190, 84, 118, 222, 187, 136,
|
||||
120, 163, 236, 249
|
||||
@@ -0,0 +1,35 @@
|
||||
/* Paramix Wolf3D: the trig tables of BuildTables and CalcProjection (Wolf4SDL wl_main.c) for a 128 dot wide view,
|
||||
* written as C, so the Paradise program needs no floating point. gcc gen_tables.c -lm && ./a.out > ../pmx/pmx_tables.h */
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#define PI 3.141592657
|
||||
#define FINEANGLES 3600
|
||||
#define ANGLES 360
|
||||
#define ANGLEQUAD (ANGLES/4)
|
||||
#define GLOBAL1 (1l<<16)
|
||||
#define TILEGLOBAL GLOBAL1
|
||||
#define MINDIST 0x5800l
|
||||
#define FOCALLENGTH 0x5700l
|
||||
#define VIEWGLOBAL 0x10000
|
||||
#define VIEWWIDTH 128
|
||||
int main (void)
|
||||
{
|
||||
static int32_t finetangent[FINEANGLES/4], sintable[ANGLES+ANGLES/4];
|
||||
static short pixelangle[VIEWWIDTH];
|
||||
const float radtoint = (float)(FINEANGLES/2/PI);
|
||||
for (int i=0;i<FINEANGLES/8;i++) { double tang=tan((i+0.5)/radtoint); finetangent[i]=(int32_t)(tang*GLOBAL1); finetangent[FINEANGLES/4-1-i]=(int32_t)((1/tang)*GLOBAL1); }
|
||||
float angle=0, anglestep=(float)(PI/2/ANGLEQUAD);
|
||||
for (int i=0;i<ANGLEQUAD;i++) { int32_t value=(int32_t)(GLOBAL1*sin(angle)); sintable[i]=sintable[i+ANGLES]=sintable[ANGLES/2-i]=value; sintable[ANGLES-i]=sintable[ANGLES/2+i]=-value; angle+=anglestep; }
|
||||
sintable[ANGLEQUAD] = 65536; sintable[3*ANGLEQUAD] = -65536;
|
||||
double facedist = FOCALLENGTH+MINDIST; int halfview = VIEWWIDTH/2;
|
||||
int32_t scale = (int32_t)(halfview*facedist/(VIEWGLOBAL/2));
|
||||
int32_t heightnumerator = (TILEGLOBAL*scale)>>6;
|
||||
for (int i=0;i<halfview;i++) { double tang=(int32_t)i*VIEWGLOBAL/VIEWWIDTH/facedist; float a=(float)atan(tang); int intang=(int)(a*radtoint); pixelangle[halfview-1-i]=intang; pixelangle[halfview+i]=-intang; }
|
||||
printf ("/* generated by tools/gen_tables.c (BuildTables, CalcProjection of Wolf4SDL for a view 128 wide) */\n");
|
||||
printf ("#define PMX_T_SCALE %ld\n#define PMX_T_HEIGHTNUMERATOR %ld\n", (long)scale, (long)heightnumerator);
|
||||
printf ("const int32_t finetangent[%d] = {", FINEANGLES/4); for (int i=0;i<FINEANGLES/4;i++) printf ("%s%ld,", i%10?"":"\n", (long)finetangent[i]); printf ("\n};\n");
|
||||
printf ("const int32_t sintable[%d] = {", ANGLES+ANGLES/4); for (int i=0;i<ANGLES+ANGLES/4;i++) printf ("%s%ld,", i%10?"":"\n", (long)sintable[i]); printf ("\n};\n");
|
||||
printf ("static const short pmx_pixelangle[%d] = {", VIEWWIDTH); for (int i=0;i<VIEWWIDTH;i++) printf ("%s%d,", i%16?"":"\n", pixelangle[i]); printf ("\n};\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
/////////////////////////////////////////////////
|
||||
//
|
||||
// MUSE Header for .SOD
|
||||
// Created Thu Aug 13 09:25:58 1992
|
||||
//
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
#ifndef __AUDIOSOD_H_
|
||||
#define __AUDIOSOD_H_
|
||||
|
||||
#define NUMSOUNDS 81
|
||||
#define NUMSNDCHUNKS 267
|
||||
|
||||
//
|
||||
// Sound names & indexes
|
||||
//
|
||||
enum soundnames
|
||||
{
|
||||
HITWALLSND, // 0
|
||||
MISSILEHITSND, // 1
|
||||
SELECTITEMSND, // 2
|
||||
GHOSTSIGHTSND, // 3
|
||||
MOVEGUN2SND, // 4
|
||||
MOVEGUN1SND, // 5
|
||||
NOWAYSND, // 6
|
||||
NAZIHITPLAYERSND, // 7
|
||||
MISSILEFIRESND, // 8
|
||||
PLAYERDEATHSND, // 9
|
||||
DOGDEATHSND, // 10
|
||||
ATKGATLINGSND, // 11
|
||||
GETKEYSND, // 12
|
||||
NOITEMSND, // 13
|
||||
WALK1SND, // 14
|
||||
WALK2SND, // 15
|
||||
TAKEDAMAGESND, // 16
|
||||
GAMEOVERSND, // 17
|
||||
OPENDOORSND, // 18
|
||||
CLOSEDOORSND, // 19
|
||||
DONOTHINGSND, // 20
|
||||
HALTSND, // 21
|
||||
DEATHSCREAM2SND, // 22
|
||||
ATKKNIFESND, // 23
|
||||
ATKPISTOLSND, // 24
|
||||
DEATHSCREAM3SND, // 25
|
||||
ATKMACHINEGUNSND, // 26
|
||||
HITENEMYSND, // 27
|
||||
SHOOTDOORSND, // 28
|
||||
DEATHSCREAM1SND, // 29
|
||||
GETMACHINESND, // 30
|
||||
GETAMMOSND, // 31
|
||||
SHOOTSND, // 32
|
||||
HEALTH1SND, // 33
|
||||
HEALTH2SND, // 34
|
||||
BONUS1SND, // 35
|
||||
BONUS2SND, // 36
|
||||
BONUS3SND, // 37
|
||||
GETGATLINGSND, // 38
|
||||
ESCPRESSEDSND, // 39
|
||||
LEVELDONESND, // 40
|
||||
DOGBARKSND, // 41
|
||||
ENDBONUS1SND, // 42
|
||||
ENDBONUS2SND, // 43
|
||||
BONUS1UPSND, // 44
|
||||
BONUS4SND, // 45
|
||||
PUSHWALLSND, // 46
|
||||
NOBONUSSND, // 47
|
||||
PERCENT100SND, // 48
|
||||
BOSSACTIVESND, // 49
|
||||
DEATHSCREAM4SND, // 50
|
||||
SCHUTZADSND, // 51
|
||||
AHHHGSND, // 52
|
||||
DEATHSCREAM5SND, // 53
|
||||
DEATHSCREAM7SND, // 54
|
||||
DEATHSCREAM8SND, // 55
|
||||
LEBENSND, // 56
|
||||
DEATHSCREAM6SND, // 57
|
||||
NAZIFIRESND, // 58
|
||||
BOSSFIRESND, // 59
|
||||
SSFIRESND, // 60
|
||||
SLURPIESND, // 61
|
||||
GHOSTFADESND, // 62
|
||||
DEATHSCREAM9SND, // 63
|
||||
GETAMMOBOXSND, // 64
|
||||
ANGELSIGHTSND, // 65
|
||||
SPIONSND, // 66
|
||||
NEINSOVASSND, // 67
|
||||
DOGATTACKSND, // 68
|
||||
ANGELFIRESND, // 69
|
||||
TRANSSIGHTSND, // 70
|
||||
TRANSDEATHSND, // 71
|
||||
WILHELMSIGHTSND, // 72
|
||||
WILHELMDEATHSND, // 73
|
||||
UBERDEATHSND, // 74
|
||||
KNIGHTSIGHTSND, // 75
|
||||
KNIGHTDEATHSND, // 76
|
||||
ANGELDEATHSND, // 77
|
||||
KNIGHTMISSILESND, // 78
|
||||
GETSPEARSND, // 79
|
||||
ANGELTIREDSND, // 80
|
||||
LASTSOUND
|
||||
};
|
||||
|
||||
//
|
||||
// Base offsets
|
||||
//
|
||||
#define STARTPCSOUNDS 0
|
||||
#define STARTADLIBSOUNDS 81
|
||||
#define STARTDIGISOUNDS 162
|
||||
#define STARTMUSIC 243
|
||||
|
||||
//
|
||||
// Music names & indexes
|
||||
//
|
||||
enum musicnames
|
||||
{
|
||||
XFUNKIE_MUS, // 0
|
||||
DUNGEON_MUS, // 1
|
||||
XDEATH_MUS, // 2
|
||||
GETTHEM_MUS, // 3
|
||||
XTIPTOE_MUS, // 4
|
||||
GOINGAFT_MUS, // 5
|
||||
URAHERO_MUS, // 6
|
||||
XTHEEND_MUS, // 7
|
||||
NAZI_OMI_MUS, // 8
|
||||
POW_MUS, // 9
|
||||
TWELFTH_MUS, // 10
|
||||
SEARCHN_MUS, // 11
|
||||
SUSPENSE_MUS, // 12
|
||||
ZEROHOUR_MUS, // 13
|
||||
WONDERIN_MUS, // 14
|
||||
ULTIMATE_MUS, // 15
|
||||
ENDLEVEL_MUS, // 16
|
||||
XEVIL_MUS, // 17
|
||||
XJAZNAZI_MUS, // 18
|
||||
COPYPRO_MUS, // 19
|
||||
XAWARD_MUS, // 20
|
||||
XPUTIT_MUS, // 21
|
||||
XGETYOU_MUS, // 22
|
||||
XTOWER2_MUS, // 23
|
||||
LASTMUSIC
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
//
|
||||
// Thanks for playing with MUSE!
|
||||
//
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,160 @@
|
||||
/////////////////////////////////////////////////
|
||||
//
|
||||
// MUSE Header for .WL6
|
||||
// Created Tue Jul 14 15:04:53 1992
|
||||
//
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
#ifndef __AUDIOWL6_H_
|
||||
#define __AUDIOWL6_H_
|
||||
|
||||
//
|
||||
// Sound names & indexes
|
||||
//
|
||||
enum soundnames
|
||||
{
|
||||
HITWALLSND, // 0
|
||||
SELECTWPNSND, // 1
|
||||
SELECTITEMSND, // 2
|
||||
HEARTBEATSND, // 3
|
||||
MOVEGUN2SND, // 4
|
||||
MOVEGUN1SND, // 5
|
||||
NOWAYSND, // 6
|
||||
NAZIHITPLAYERSND, // 7
|
||||
SCHABBSTHROWSND, // 8
|
||||
PLAYERDEATHSND, // 9
|
||||
DOGDEATHSND, // 10
|
||||
ATKGATLINGSND, // 11
|
||||
GETKEYSND, // 12
|
||||
NOITEMSND, // 13
|
||||
WALK1SND, // 14
|
||||
WALK2SND, // 15
|
||||
TAKEDAMAGESND, // 16
|
||||
GAMEOVERSND, // 17
|
||||
OPENDOORSND, // 18
|
||||
CLOSEDOORSND, // 19
|
||||
DONOTHINGSND, // 20
|
||||
HALTSND, // 21
|
||||
DEATHSCREAM2SND, // 22
|
||||
ATKKNIFESND, // 23
|
||||
ATKPISTOLSND, // 24
|
||||
DEATHSCREAM3SND, // 25
|
||||
ATKMACHINEGUNSND, // 26
|
||||
HITENEMYSND, // 27
|
||||
SHOOTDOORSND, // 28
|
||||
DEATHSCREAM1SND, // 29
|
||||
GETMACHINESND, // 30
|
||||
GETAMMOSND, // 31
|
||||
SHOOTSND, // 32
|
||||
HEALTH1SND, // 33
|
||||
HEALTH2SND, // 34
|
||||
BONUS1SND, // 35
|
||||
BONUS2SND, // 36
|
||||
BONUS3SND, // 37
|
||||
GETGATLINGSND, // 38
|
||||
ESCPRESSEDSND, // 39
|
||||
LEVELDONESND, // 40
|
||||
DOGBARKSND, // 41
|
||||
ENDBONUS1SND, // 42
|
||||
ENDBONUS2SND, // 43
|
||||
BONUS1UPSND, // 44
|
||||
BONUS4SND, // 45
|
||||
PUSHWALLSND, // 46
|
||||
NOBONUSSND, // 47
|
||||
PERCENT100SND, // 48
|
||||
BOSSACTIVESND, // 49
|
||||
MUTTISND, // 50
|
||||
SCHUTZADSND, // 51
|
||||
AHHHGSND, // 52
|
||||
DIESND, // 53
|
||||
EVASND, // 54
|
||||
GUTENTAGSND, // 55
|
||||
LEBENSND, // 56
|
||||
SCHEISTSND, // 57
|
||||
NAZIFIRESND, // 58
|
||||
BOSSFIRESND, // 59
|
||||
SSFIRESND, // 60
|
||||
SLURPIESND, // 61
|
||||
TOT_HUNDSND, // 62
|
||||
MEINGOTTSND, // 63
|
||||
SCHABBSHASND, // 64
|
||||
HITLERHASND, // 65
|
||||
SPIONSND, // 66
|
||||
NEINSOVASSND, // 67
|
||||
DOGATTACKSND, // 68
|
||||
FLAMETHROWERSND, // 69
|
||||
MECHSTEPSND, // 70
|
||||
GOOBSSND, // 71
|
||||
YEAHSND, // 72
|
||||
#ifndef APOGEE_1_0
|
||||
DEATHSCREAM4SND, // 73
|
||||
DEATHSCREAM5SND, // 74
|
||||
DEATHSCREAM6SND, // 75
|
||||
DEATHSCREAM7SND, // 76
|
||||
DEATHSCREAM8SND, // 77
|
||||
DEATHSCREAM9SND, // 78
|
||||
DONNERSND, // 79
|
||||
EINESND, // 80
|
||||
ERLAUBENSND, // 81
|
||||
KEINSND, // 82
|
||||
MEINSND, // 83
|
||||
ROSESND, // 84
|
||||
MISSILEFIRESND, // 85
|
||||
MISSILEHITSND, // 86
|
||||
#endif
|
||||
LASTSOUND
|
||||
};
|
||||
|
||||
//
|
||||
// Base offsets
|
||||
//
|
||||
#define STARTPCSOUNDS 0
|
||||
#define STARTADLIBSOUNDS LASTSOUND
|
||||
#define STARTDIGISOUNDS (2*LASTSOUND)
|
||||
#define STARTMUSIC (3*LASTSOUND)
|
||||
|
||||
//
|
||||
// Music names & indexes
|
||||
//
|
||||
enum musicnames
|
||||
{
|
||||
CORNER_MUS, // 0
|
||||
DUNGEON_MUS, // 1
|
||||
WARMARCH_MUS, // 2
|
||||
GETTHEM_MUS, // 3
|
||||
HEADACHE_MUS, // 4
|
||||
HITLWLTZ_MUS, // 5
|
||||
INTROCW3_MUS, // 6
|
||||
NAZI_NOR_MUS, // 7
|
||||
NAZI_OMI_MUS, // 8
|
||||
POW_MUS, // 9
|
||||
SALUTE_MUS, // 10
|
||||
SEARCHN_MUS, // 11
|
||||
SUSPENSE_MUS, // 12
|
||||
VICTORS_MUS, // 13
|
||||
WONDERIN_MUS, // 14
|
||||
FUNKYOU_MUS, // 15
|
||||
ENDLEVEL_MUS, // 16
|
||||
GOINGAFT_MUS, // 17
|
||||
PREGNANT_MUS, // 18
|
||||
ULTIMATE_MUS, // 19
|
||||
NAZI_RAP_MUS, // 20
|
||||
ZEROHOUR_MUS, // 21
|
||||
TWELFTH_MUS, // 22
|
||||
ROSTER_MUS, // 23
|
||||
URAHERO_MUS, // 24
|
||||
VICMARCH_MUS, // 25
|
||||
PACMAN_MUS, // 26
|
||||
LASTMUSIC
|
||||
};
|
||||
|
||||
#define NUMSOUNDS LASTSOUND
|
||||
#define NUMSNDCHUNKS (STARTMUSIC + LASTMUSIC)
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
//
|
||||
// Thanks for playing with MUSE!
|
||||
//
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,81 @@
|
||||
#ifndef __F_SPEAR_H_
|
||||
#define __F_SPEAR_H_
|
||||
|
||||
#define STR_ENDGAME1 "We owe you a great debt, Mr. Blazkowicz."
|
||||
#define STR_ENDGAME2 "You have served your country well."
|
||||
#define STR_ENDGAME3 "With the spear gone, the Allies will finally"
|
||||
#define STR_ENDGAME4 "by able to destroy Hitler..."
|
||||
|
||||
#define STR_COPY1 "That's close, but not close enough to get"
|
||||
#define STR_COPY2 "you into the game."
|
||||
|
||||
#define STR_COPY3 "Wow, you must have the early version of the"
|
||||
#define STR_COPY4 "manual with the totally false information in it."
|
||||
|
||||
#define STR_COPY5 "I would let you into the game, but seeing"
|
||||
#define STR_COPY6 "as that was not at all the right answer..."
|
||||
|
||||
#define STR_COPY7 "It's just too bad we can't get together on"
|
||||
#define STR_COPY8 "this one. Sorry."
|
||||
|
||||
#define STR_COPY9 "Hey, you're just SO off base!"
|
||||
|
||||
#define STR_COPY10 "You know, I once typed that myself when"
|
||||
#define STR_COPY11 "I was your age."
|
||||
|
||||
#define STR_COPY12 "Nops. Zero points. Zugga."
|
||||
|
||||
#define STR_COPY13 "Yeah...right."
|
||||
|
||||
#define STR_COPY14 "You must like these quizzes."
|
||||
|
||||
#define STR_COPY15 "Could be called \"PixelMeister\"?"
|
||||
|
||||
#define STR_COPY16 "Might engineer some software?"
|
||||
|
||||
#define STR_COPY17 "Would be found"
|
||||
#define STR_COPY18 "directing creatively?"
|
||||
|
||||
#define STR_COPY19 "Might be found"
|
||||
#define STR_COPY20 "handling operations?"
|
||||
|
||||
#define STR_COPY21 "Has a name familiar"
|
||||
#define STR_COPY22 "to your weatherman?"
|
||||
|
||||
#define STR_NOPE1 "Welcome to the DOS prompt, pirate!"
|
||||
#define STR_NOPE2 "Eat hot DOS prompt, goober!"
|
||||
#define STR_NOPE3 "Ya know, this program doesn't cost that much."
|
||||
#define STR_NOPE4 "Hey...weren't you just AT this DOS prompt?"
|
||||
#define STR_NOPE5 "What's a nice user like you doin' at a DOS prompt like this?"
|
||||
#define STR_NOPE6 "Well, I'm sure you just \"misplaced\" the manual..."
|
||||
#define STR_NOPE7 "Run me again when you've boned up on your manual a bit."
|
||||
#define STR_NOPE8 "Nice try, but no Spear."
|
||||
#define STR_NOPE9 "That information is in the Spear of Destiny manual, by the way."
|
||||
|
||||
#define STR_MISC1 "Under \"Killing the Enemy\", what"
|
||||
#define STR_MISC2 "type of enemy is pictured?"
|
||||
|
||||
#define STR_MISC3 "How many eyelets are on B.J.'s"
|
||||
#define STR_MISC4 "boots? (see page 2)"
|
||||
|
||||
#define STR_MISC5 "The word \"minister\" appears in"
|
||||
#define STR_MISC6 "what gray shape on page 2?"
|
||||
|
||||
#define STR_MISC7 "How many bullets does B.J. have"
|
||||
#define STR_MISC8 "on the screen-shot in the middle"
|
||||
#define STR_MISC9 "of page 9?"
|
||||
|
||||
#define STR_STAR "star"
|
||||
#define STR_DEBRIEF " DEBRIEFING\n SESSION\n"
|
||||
#define STR_ENEMY1 "Name the member of the"
|
||||
#define STR_ENEMY2 "enemy forces shown above"
|
||||
|
||||
#define STR_CHECKMAN "CHECK YER MANUAL!"
|
||||
#define STR_MAN1 "Which manual page"
|
||||
#define STR_MAN2 "is the Options Menu"
|
||||
#define STR_MAN3 "function"
|
||||
#define STR_MAN4 "on?"
|
||||
|
||||
#define STR_ID1 "Which member of Id Software:"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,137 @@
|
||||
#ifndef __FOREIGN_H_
|
||||
#define __FOREIGN_H_
|
||||
|
||||
#define QUITSUR "Are you sure you want\n"\
|
||||
"to quit this great game?"
|
||||
|
||||
#define CURGAME "You are currently in\n"\
|
||||
"a game. Continuing will\n"\
|
||||
"erase old game. Ok?"
|
||||
|
||||
#define GAMESVD "There's already a game\n"\
|
||||
"saved at this position.\n"\
|
||||
" Overwrite?"
|
||||
|
||||
#define ENDGAMESTR "Are you sure you want\n"\
|
||||
"to end the game you\n"\
|
||||
"are playing? (" YESBUTTONNAME " or " NOBUTTONNAME "):"
|
||||
|
||||
#define STR_NG "New Game"
|
||||
#define STR_SD "Sound"
|
||||
#define STR_CL "Control"
|
||||
#define STR_LG "Load Game"
|
||||
#define STR_SG "Save Game"
|
||||
#define STR_CV "Change View"
|
||||
#define STR_VS "View Scores"
|
||||
#define STR_EG "End Game"
|
||||
#define STR_BD "Back to Demo"
|
||||
#define STR_BG "Back to Game"
|
||||
#define STR_QT "Quit"
|
||||
|
||||
#define STR_LOADING "Loading"
|
||||
#define STR_SAVING "Saving"
|
||||
|
||||
#define STR_GAME "Game"
|
||||
#define STR_DEMO "Demo"
|
||||
#define STR_LGC "Load Game called\n\""
|
||||
#define STR_EMPTY "empty"
|
||||
#define STR_CALIB "Calibrate"
|
||||
#define STR_JOYST "Joystick"
|
||||
#define STR_MOVEJOY "Move joystick to\nupper left and\npress button 0\n"
|
||||
#define STR_MOVEJOY2 "Move joystick to\nlower right and\npress button 1\n"
|
||||
#define STR_ESCEXIT "ESC to exit"
|
||||
|
||||
#define STR_NONE "None"
|
||||
#define STR_PC "PC Speaker"
|
||||
#define STR_ALSB "AdLib/Sound Blaster"
|
||||
#define STR_DISNEY "Disney Sound Source"
|
||||
#define STR_SB "Sound Blaster"
|
||||
|
||||
#define STR_MOUSEEN "Mouse Enabled"
|
||||
#define STR_JOYEN "Joystick Enabled"
|
||||
#define STR_PORT2 "Use joystick port 2"
|
||||
#define STR_GAMEPAD "Gravis GamePad Enabled"
|
||||
#define STR_SENS "Mouse Sensitivity"
|
||||
#define STR_CUSTOM "Customize controls"
|
||||
|
||||
#define STR_DADDY "Can I play, Daddy?"
|
||||
#define STR_HURTME "Don't hurt me."
|
||||
#define STR_BRINGEM "Bring 'em on!"
|
||||
#define STR_DEATH "I am Death incarnate!"
|
||||
|
||||
#define STR_MOUSEADJ "Adjust Mouse Sensitivity"
|
||||
#define STR_SLOW "Slow"
|
||||
#define STR_FAST "Fast"
|
||||
|
||||
#define STR_CRUN "Run"
|
||||
#define STR_COPEN "Open"
|
||||
#define STR_CFIRE "Fire"
|
||||
#define STR_CSTRAFE "Strafe"
|
||||
|
||||
#define STR_LEFT "Left"
|
||||
#define STR_RIGHT "Right"
|
||||
#define STR_FRWD "Frwd"
|
||||
#define STR_BKWD "Bkwrd"
|
||||
#define STR_THINK "Thinking"
|
||||
|
||||
#define STR_SIZE1 "Use arrows to size"
|
||||
#define STR_SIZE2 "ENTER to accept"
|
||||
#define STR_SIZE3 "ESC to cancel"
|
||||
|
||||
#define STR_YOUWIN "you win!"
|
||||
|
||||
#define STR_TOTALTIME "total time"
|
||||
|
||||
#define STR_RATKILL "kill %"
|
||||
#define STR_RATSECRET "secret %"
|
||||
#define STR_RATTREASURE "treasure %"
|
||||
|
||||
#define STR_BONUS "bonus"
|
||||
#define STR_TIME "time"
|
||||
#define STR_PAR " par"
|
||||
|
||||
#define STR_RAT2KILL "kill ratio %"
|
||||
#define STR_RAT2SECRET "secret ratio %"
|
||||
#define STR_RAT2TREASURE "treasure ratio %"
|
||||
|
||||
#define STR_DEFEATED "defeated!"
|
||||
|
||||
#define STR_CHEATER1 "You now have 100% Health,"
|
||||
#define STR_CHEATER2 "99 Ammo and both Keys!"
|
||||
#define STR_CHEATER3 "Note that you have basically"
|
||||
#define STR_CHEATER4 "eliminated your chances of"
|
||||
#define STR_CHEATER5 "getting a high score!"
|
||||
|
||||
#define STR_NOSPACE1 "There is not enough space"
|
||||
#define STR_NOSPACE2 "on your disk to Save Game!"
|
||||
|
||||
#define STR_SAVECHT1 "Your Save Game file is,"
|
||||
#define STR_SAVECHT2 "shall we say, \"corrupted\"."
|
||||
#define STR_SAVECHT3 "But I'll let you go on and"
|
||||
#define STR_SAVECHT4 "play anyway...."
|
||||
|
||||
#define STR_SEEAGAIN "Let's see that again!"
|
||||
|
||||
#ifdef SPEAR
|
||||
#define ENDSTR1 "Heroes don't quit, but\ngo ahead and press " YESBUTTONNAME "\nif you aren't one."
|
||||
#define ENDSTR2 "Press " YESBUTTONNAME " to quit,\nor press " NOBUTTONNAME " to enjoy\nmore violent diversion."
|
||||
#define ENDSTR3 "Depressing the " YESBUTTONNAME " key means\nyou must return to the\nhumdrum workday world."
|
||||
#define ENDSTR4 "Hey, quit or play,\n" YESBUTTONNAME " or " NOBUTTONNAME ":\nit's your choice."
|
||||
#define ENDSTR5 "Sure you don't want to\nwaste a few more\nproductive hours?"
|
||||
#define ENDSTR6 "I think you had better\nplay some more. Please\npress " NOBUTTONNAME "...please?"
|
||||
#define ENDSTR7 "If you are tough, press " NOBUTTONNAME ".\nIf not, press " YESBUTTONNAME " daintily."
|
||||
#define ENDSTR8 "I'm thinkin' that\nyou might wanna press " NOBUTTONNAME "\nto play more. You do it."
|
||||
#define ENDSTR9 "Sure. Fine. Quit.\nSee if we care.\nGet it over with.\nPress " YESBUTTONNAME "."
|
||||
#else
|
||||
#define ENDSTR1 "Dost thou wish to\nleave with such hasty\nabandon?"
|
||||
#define ENDSTR2 "Chickening out...\nalready?"
|
||||
#define ENDSTR3 "Press " NOBUTTONNAME " for more carnage.\nPress " YESBUTTONNAME " to be a weenie."
|
||||
#define ENDSTR4 "So, you think you can\nquit this easily, huh?"
|
||||
#define ENDSTR5 "Press " NOBUTTONNAME " to save the world.\nPress " YESBUTTONNAME " to abandon it in\nits hour of need."
|
||||
#define ENDSTR6 "Press " NOBUTTONNAME " if you are brave.\nPress " YESBUTTONNAME " to cower in shame."
|
||||
#define ENDSTR7 "Heroes, press " NOBUTTONNAME ".\nWimps, press " YESBUTTONNAME "."
|
||||
#define ENDSTR8 "You are at an intersection.\nA sign says, 'Press " YESBUTTONNAME " to quit.'\n>"
|
||||
#define ENDSTR9 "For guns and glory, press " NOBUTTONNAME ".\nFor work and worry, press " YESBUTTONNAME "."
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,296 @@
|
||||
//////////////////////////////////////
|
||||
//
|
||||
// Graphics .H file for .SOD
|
||||
// IGRAB-ed on Thu Oct 08 20:38:29 1992
|
||||
//
|
||||
//////////////////////////////////////
|
||||
|
||||
#ifndef __GFXV_SOD_H_
|
||||
#define __GFXV_SOD_H_
|
||||
|
||||
enum graphicnums
|
||||
{
|
||||
// Lump Start
|
||||
C_BACKDROPPIC=3,
|
||||
C_MOUSELBACKPIC, // 4
|
||||
C_CURSOR1PIC, // 5
|
||||
C_CURSOR2PIC, // 6
|
||||
C_NOTSELECTEDPIC, // 7
|
||||
C_SELECTEDPIC, // 8
|
||||
// Lump Start
|
||||
C_CUSTOMIZEPIC, // 9
|
||||
C_JOY1PIC, // 10
|
||||
C_JOY2PIC, // 11
|
||||
C_MOUSEPIC, // 12
|
||||
C_JOYSTICKPIC, // 13
|
||||
C_KEYBOARDPIC, // 14
|
||||
C_CONTROLPIC, // 15
|
||||
// Lump Start
|
||||
C_OPTIONSPIC, // 16
|
||||
// Lump Start
|
||||
C_FXTITLEPIC, // 17
|
||||
C_DIGITITLEPIC, // 18
|
||||
C_MUSICTITLEPIC, // 19
|
||||
// Lump Start
|
||||
C_HOWTOUGHPIC, // 20
|
||||
C_BABYMODEPIC, // 21
|
||||
C_EASYPIC, // 22
|
||||
C_NORMALPIC, // 23
|
||||
C_HARDPIC, // 24
|
||||
// Lump Start
|
||||
C_DISKLOADING1PIC, // 25
|
||||
C_DISKLOADING2PIC, // 26
|
||||
C_LOADGAMEPIC, // 27
|
||||
C_SAVEGAMEPIC, // 28
|
||||
// Lump Start
|
||||
HIGHSCORESPIC, // 29
|
||||
C_WONSPEARPIC, // 30
|
||||
#ifndef SPEARDEMO
|
||||
// Lump Start
|
||||
BJCOLLAPSE1PIC, // 31
|
||||
BJCOLLAPSE2PIC, // 32
|
||||
BJCOLLAPSE3PIC, // 33
|
||||
BJCOLLAPSE4PIC, // 34
|
||||
ENDPICPIC, // 35
|
||||
#endif
|
||||
// Lump Start
|
||||
L_GUYPIC, // 36
|
||||
L_COLONPIC, // 37
|
||||
L_NUM0PIC, // 38
|
||||
L_NUM1PIC, // 39
|
||||
L_NUM2PIC, // 40
|
||||
L_NUM3PIC, // 41
|
||||
L_NUM4PIC, // 42
|
||||
L_NUM5PIC, // 43
|
||||
L_NUM6PIC, // 44
|
||||
L_NUM7PIC, // 45
|
||||
L_NUM8PIC, // 46
|
||||
L_NUM9PIC, // 47
|
||||
L_PERCENTPIC, // 48
|
||||
L_APIC, // 49
|
||||
L_BPIC, // 50
|
||||
L_CPIC, // 51
|
||||
L_DPIC, // 52
|
||||
L_EPIC, // 53
|
||||
L_FPIC, // 54
|
||||
L_GPIC, // 55
|
||||
L_HPIC, // 56
|
||||
L_IPIC, // 57
|
||||
L_JPIC, // 58
|
||||
L_KPIC, // 59
|
||||
L_LPIC, // 60
|
||||
L_MPIC, // 61
|
||||
L_NPIC, // 62
|
||||
L_OPIC, // 63
|
||||
L_PPIC, // 64
|
||||
L_QPIC, // 65
|
||||
L_RPIC, // 66
|
||||
L_SPIC, // 67
|
||||
L_TPIC, // 68
|
||||
L_UPIC, // 69
|
||||
L_VPIC, // 70
|
||||
L_WPIC, // 71
|
||||
L_XPIC, // 72
|
||||
L_YPIC, // 73
|
||||
L_ZPIC, // 74
|
||||
L_EXPOINTPIC, // 75
|
||||
L_APOSTROPHEPIC, // 76
|
||||
L_GUY2PIC, // 77
|
||||
L_BJWINSPIC, // 78
|
||||
// Lump Start
|
||||
TITLE1PIC, // 79
|
||||
TITLE2PIC, // 80
|
||||
#ifndef SPEARDEMO
|
||||
// Lump Start
|
||||
ENDSCREEN11PIC, // 81
|
||||
// Lump Start
|
||||
ENDSCREEN12PIC, // 82
|
||||
ENDSCREEN3PIC, // 83
|
||||
ENDSCREEN4PIC, // 84
|
||||
ENDSCREEN5PIC, // 85
|
||||
ENDSCREEN6PIC, // 86
|
||||
ENDSCREEN7PIC, // 87
|
||||
ENDSCREEN8PIC, // 88
|
||||
ENDSCREEN9PIC, // 89
|
||||
#endif
|
||||
STATUSBARPIC, // 90
|
||||
PG13PIC, // 91
|
||||
CREDITSPIC, // 92
|
||||
#ifndef SPEARDEMO
|
||||
// Lump Start
|
||||
IDGUYS1PIC, // 93
|
||||
IDGUYS2PIC, // 94
|
||||
// Lump Start
|
||||
COPYPROTTOPPIC, // 95
|
||||
COPYPROTBOXPIC, // 96
|
||||
BOSSPIC1PIC, // 97
|
||||
BOSSPIC2PIC, // 98
|
||||
BOSSPIC3PIC, // 99
|
||||
BOSSPIC4PIC, // 100
|
||||
#endif
|
||||
// Lump Start
|
||||
KNIFEPIC, // 101
|
||||
GUNPIC, // 102
|
||||
MACHINEGUNPIC, // 103
|
||||
GATLINGGUNPIC, // 104
|
||||
NOKEYPIC, // 105
|
||||
GOLDKEYPIC, // 106
|
||||
SILVERKEYPIC, // 107
|
||||
N_BLANKPIC, // 108
|
||||
N_0PIC, // 109
|
||||
N_1PIC, // 110
|
||||
N_2PIC, // 111
|
||||
N_3PIC, // 112
|
||||
N_4PIC, // 113
|
||||
N_5PIC, // 114
|
||||
N_6PIC, // 115
|
||||
N_7PIC, // 116
|
||||
N_8PIC, // 117
|
||||
N_9PIC, // 118
|
||||
FACE1APIC, // 119
|
||||
FACE1BPIC, // 120
|
||||
FACE1CPIC, // 121
|
||||
FACE2APIC, // 122
|
||||
FACE2BPIC, // 123
|
||||
FACE2CPIC, // 124
|
||||
FACE3APIC, // 125
|
||||
FACE3BPIC, // 126
|
||||
FACE3CPIC, // 127
|
||||
FACE4APIC, // 128
|
||||
FACE4BPIC, // 129
|
||||
FACE4CPIC, // 130
|
||||
FACE5APIC, // 131
|
||||
FACE5BPIC, // 132
|
||||
FACE5CPIC, // 133
|
||||
FACE6APIC, // 134
|
||||
FACE6BPIC, // 135
|
||||
FACE6CPIC, // 136
|
||||
FACE7APIC, // 137
|
||||
FACE7BPIC, // 138
|
||||
FACE7CPIC, // 139
|
||||
FACE8APIC, // 140
|
||||
GOTGATLINGPIC, // 141
|
||||
GODMODEFACE1PIC, // 142
|
||||
GODMODEFACE2PIC, // 143
|
||||
GODMODEFACE3PIC, // 144
|
||||
BJWAITING1PIC, // 145
|
||||
BJWAITING2PIC, // 146
|
||||
BJOUCHPIC, // 147
|
||||
PAUSEDPIC, // 148
|
||||
GETPSYCHEDPIC, // 149
|
||||
|
||||
TILE8, // 150
|
||||
|
||||
ORDERSCREEN, // 151
|
||||
ERRORSCREEN, // 152
|
||||
TITLEPALETTE, // 153
|
||||
#ifndef SPEARDEMO
|
||||
END1PALETTE, // 154
|
||||
END2PALETTE, // 155
|
||||
END3PALETTE, // 156
|
||||
END4PALETTE, // 157
|
||||
END5PALETTE, // 158
|
||||
END6PALETTE, // 159
|
||||
END7PALETTE, // 160
|
||||
END8PALETTE, // 161
|
||||
END9PALETTE, // 162
|
||||
IDGUYSPALETTE, // 163
|
||||
#endif
|
||||
T_DEMO0, // 164
|
||||
#ifndef SPEARDEMO
|
||||
T_DEMO1, // 165
|
||||
T_DEMO2, // 166
|
||||
T_DEMO3, // 167
|
||||
T_ENDART1, // 168
|
||||
#endif
|
||||
ENUMEND
|
||||
};
|
||||
|
||||
//
|
||||
// Data LUMPs
|
||||
//
|
||||
#define BACKDROP_LUMP_START 3
|
||||
#define BACKDROP_LUMP_END 8
|
||||
|
||||
#define CONTROL_LUMP_START 9
|
||||
#define CONTROL_LUMP_END 15
|
||||
|
||||
#define OPTIONS_LUMP_START 16
|
||||
#define OPTIONS_LUMP_END 16
|
||||
|
||||
#define SOUND_LUMP_START 17
|
||||
#define SOUND_LUMP_END 19
|
||||
|
||||
#define NEWGAME_LUMP_START 20
|
||||
#define NEWGAME_LUMP_END 24
|
||||
|
||||
#define LOADSAVE_LUMP_START 25
|
||||
#define LOADSAVE_LUMP_END 28
|
||||
|
||||
#define HIGHSCORES_LUMP_START 29
|
||||
#define HIGHSCORES_LUMP_END 30
|
||||
|
||||
#define ENDGAME_LUMP_START 31
|
||||
#define ENDGAME_LUMP_END 35
|
||||
|
||||
#define LEVELEND_LUMP_START L_GUYPIC
|
||||
#define LEVELEND_LUMP_END L_BJWINSPIC
|
||||
|
||||
#define TITLESCREEN_LUMP_START TITLE1PIC
|
||||
#define TITLESCREEN_LUMP_END TITLE2PIC
|
||||
|
||||
#define ENDGAME1_LUMP_START ENDSCREEN11PIC
|
||||
#define ENDGAME1_LUMP_END ENDSCREEN11PIC
|
||||
|
||||
#define ENDGAME2_LUMP_START ENDSCREEN12PIC
|
||||
#define ENDGAME2_LUMP_END ENDSCREEN12PIC
|
||||
|
||||
#define EASTEREGG_LUMP_START IDGUYS1PIC
|
||||
#define EASTEREGG_LUMP_END IDGUYS2PIC
|
||||
|
||||
#define COPYPROT_LUMP_START COPYPROTTOPPIC
|
||||
#define COPYPROT_LUMP_END BOSSPIC4PIC
|
||||
|
||||
#define LATCHPICS_LUMP_START KNIFEPIC
|
||||
#define LATCHPICS_LUMP_END GETPSYCHEDPIC
|
||||
|
||||
|
||||
//
|
||||
// Amount of each data item
|
||||
//
|
||||
#define NUMCHUNKS ENUMEND
|
||||
#define NUMFONT 2
|
||||
#define NUMFONTM 0
|
||||
#define NUMPICS (GETPSYCHEDPIC - NUMFONT)
|
||||
#define NUMPICM 0
|
||||
#define NUMSPRITES 0
|
||||
#define NUMTILE8 35
|
||||
#define NUMTILE8M 0
|
||||
#define NUMTILE16 0
|
||||
#define NUMTILE16M 0
|
||||
#define NUMTILE32 0
|
||||
#define NUMTILE32M 0
|
||||
#define NUMEXTERNS 18
|
||||
//
|
||||
// File offsets for data items
|
||||
//
|
||||
#define STRUCTPIC 0
|
||||
|
||||
#define STARTFONT 1
|
||||
#define STARTFONTM 3
|
||||
#define STARTPICS 3
|
||||
#define STARTPICM TILE8
|
||||
#define STARTSPRITES TILE8
|
||||
#define STARTTILE8 TILE8
|
||||
#define STARTTILE8M ORDERSCREEN
|
||||
#define STARTTILE16 ORDERSCREEN
|
||||
#define STARTTILE16M ORDERSCREEN
|
||||
#define STARTTILE32 ORDERSCREEN
|
||||
#define STARTTILE32M ORDERSCREEN
|
||||
#define STARTEXTERNS ORDERSCREEN
|
||||
|
||||
//
|
||||
// Thank you for using IGRAB!
|
||||
//
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,222 @@
|
||||
//////////////////////////////////////
|
||||
//
|
||||
// Graphics .H file for .WL6
|
||||
// IGRAB-ed on Wed Apr 13 06:58:44 1994
|
||||
//
|
||||
//////////////////////////////////////
|
||||
|
||||
#ifndef __GFXV_WL6_H_
|
||||
#define __GFXV_WL6_H_
|
||||
|
||||
enum graphicnums
|
||||
{
|
||||
// Lump Start
|
||||
H_BJPIC=3,
|
||||
H_CASTLEPIC, // 4
|
||||
H_BLAZEPIC, // 5
|
||||
H_TOPWINDOWPIC, // 6
|
||||
H_LEFTWINDOWPIC, // 7
|
||||
H_RIGHTWINDOWPIC, // 8
|
||||
H_BOTTOMINFOPIC, // 9
|
||||
// Lump Start
|
||||
C_OPTIONSPIC, // 10
|
||||
C_CURSOR1PIC, // 11
|
||||
C_CURSOR2PIC, // 12
|
||||
C_NOTSELECTEDPIC, // 13
|
||||
C_SELECTEDPIC, // 14
|
||||
C_FXTITLEPIC, // 15
|
||||
C_DIGITITLEPIC, // 16
|
||||
C_MUSICTITLEPIC, // 17
|
||||
C_MOUSELBACKPIC, // 18
|
||||
C_BABYMODEPIC, // 19
|
||||
C_EASYPIC, // 20
|
||||
C_NORMALPIC, // 21
|
||||
C_HARDPIC, // 22
|
||||
C_LOADSAVEDISKPIC, // 23
|
||||
C_DISKLOADING1PIC, // 24
|
||||
C_DISKLOADING2PIC, // 25
|
||||
C_CONTROLPIC, // 26
|
||||
C_CUSTOMIZEPIC, // 27
|
||||
C_LOADGAMEPIC, // 28
|
||||
C_SAVEGAMEPIC, // 29
|
||||
C_EPISODE1PIC, // 30
|
||||
C_EPISODE2PIC, // 31
|
||||
C_EPISODE3PIC, // 32
|
||||
C_EPISODE4PIC, // 33
|
||||
C_EPISODE5PIC, // 34
|
||||
C_EPISODE6PIC, // 35
|
||||
C_CODEPIC, // 36
|
||||
C_TIMECODEPIC, // 37
|
||||
C_LEVELPIC, // 38
|
||||
C_NAMEPIC, // 39
|
||||
C_SCOREPIC, // 40
|
||||
C_JOY1PIC, // 41
|
||||
C_JOY2PIC, // 42
|
||||
// Lump Start
|
||||
L_GUYPIC, // 43
|
||||
L_COLONPIC, // 44
|
||||
L_NUM0PIC, // 45
|
||||
L_NUM1PIC, // 46
|
||||
L_NUM2PIC, // 47
|
||||
L_NUM3PIC, // 48
|
||||
L_NUM4PIC, // 49
|
||||
L_NUM5PIC, // 50
|
||||
L_NUM6PIC, // 51
|
||||
L_NUM7PIC, // 52
|
||||
L_NUM8PIC, // 53
|
||||
L_NUM9PIC, // 54
|
||||
L_PERCENTPIC, // 55
|
||||
L_APIC, // 56
|
||||
L_BPIC, // 57
|
||||
L_CPIC, // 58
|
||||
L_DPIC, // 59
|
||||
L_EPIC, // 60
|
||||
L_FPIC, // 61
|
||||
L_GPIC, // 62
|
||||
L_HPIC, // 63
|
||||
L_IPIC, // 64
|
||||
L_JPIC, // 65
|
||||
L_KPIC, // 66
|
||||
L_LPIC, // 67
|
||||
L_MPIC, // 68
|
||||
L_NPIC, // 69
|
||||
L_OPIC, // 70
|
||||
L_PPIC, // 71
|
||||
L_QPIC, // 72
|
||||
L_RPIC, // 73
|
||||
L_SPIC, // 74
|
||||
L_TPIC, // 75
|
||||
L_UPIC, // 76
|
||||
L_VPIC, // 77
|
||||
L_WPIC, // 78
|
||||
L_XPIC, // 79
|
||||
L_YPIC, // 80
|
||||
L_ZPIC, // 81
|
||||
L_EXPOINTPIC, // 82
|
||||
L_APOSTROPHEPIC, // 83
|
||||
L_GUY2PIC, // 84
|
||||
L_BJWINSPIC, // 85
|
||||
STATUSBARPIC, // 86
|
||||
TITLEPIC, // 87
|
||||
PG13PIC, // 88
|
||||
CREDITSPIC, // 89
|
||||
HIGHSCORESPIC, // 90
|
||||
// Lump Start
|
||||
KNIFEPIC, // 91
|
||||
GUNPIC, // 92
|
||||
MACHINEGUNPIC, // 93
|
||||
GATLINGGUNPIC, // 94
|
||||
NOKEYPIC, // 95
|
||||
GOLDKEYPIC, // 96
|
||||
SILVERKEYPIC, // 97
|
||||
N_BLANKPIC, // 98
|
||||
N_0PIC, // 99
|
||||
N_1PIC, // 100
|
||||
N_2PIC, // 101
|
||||
N_3PIC, // 102
|
||||
N_4PIC, // 103
|
||||
N_5PIC, // 104
|
||||
N_6PIC, // 105
|
||||
N_7PIC, // 106
|
||||
N_8PIC, // 107
|
||||
N_9PIC, // 108
|
||||
FACE1APIC, // 109
|
||||
FACE1BPIC, // 110
|
||||
FACE1CPIC, // 111
|
||||
FACE2APIC, // 112
|
||||
FACE2BPIC, // 113
|
||||
FACE2CPIC, // 114
|
||||
FACE3APIC, // 115
|
||||
FACE3BPIC, // 116
|
||||
FACE3CPIC, // 117
|
||||
FACE4APIC, // 118
|
||||
FACE4BPIC, // 119
|
||||
FACE4CPIC, // 120
|
||||
FACE5APIC, // 121
|
||||
FACE5BPIC, // 122
|
||||
FACE5CPIC, // 123
|
||||
FACE6APIC, // 124
|
||||
FACE6BPIC, // 125
|
||||
FACE6CPIC, // 126
|
||||
FACE7APIC, // 127
|
||||
FACE7BPIC, // 128
|
||||
FACE7CPIC, // 129
|
||||
FACE8APIC, // 130
|
||||
GOTGATLINGPIC, // 131
|
||||
MUTANTBJPIC, // 132
|
||||
PAUSEDPIC, // 133
|
||||
GETPSYCHEDPIC, // 134
|
||||
|
||||
|
||||
|
||||
ORDERSCREEN=136,
|
||||
ERRORSCREEN, // 137
|
||||
T_HELPART, // 138
|
||||
T_DEMO0, // 139
|
||||
T_DEMO1, // 140
|
||||
T_DEMO2, // 141
|
||||
T_DEMO3, // 142
|
||||
T_ENDART1, // 143
|
||||
T_ENDART2, // 144
|
||||
T_ENDART3, // 145
|
||||
T_ENDART4, // 146
|
||||
T_ENDART5, // 147
|
||||
T_ENDART6, // 148
|
||||
ENUMEND
|
||||
};
|
||||
|
||||
//
|
||||
// Data LUMPs
|
||||
//
|
||||
#define README_LUMP_START 3
|
||||
#define README_LUMP_END 9
|
||||
|
||||
#define CONTROLS_LUMP_START 10
|
||||
#define CONTROLS_LUMP_END 42
|
||||
|
||||
#define LEVELEND_LUMP_START 43
|
||||
#define LEVELEND_LUMP_END 85
|
||||
|
||||
#define LATCHPICS_LUMP_START 91
|
||||
#define LATCHPICS_LUMP_END 134
|
||||
|
||||
|
||||
//
|
||||
// Amount of each data item
|
||||
//
|
||||
#define NUMCHUNKS 149
|
||||
#define NUMFONT 2
|
||||
#define NUMFONTM 0
|
||||
#define NUMPICS 132
|
||||
#define NUMPICM 0
|
||||
#define NUMSPRITES 0
|
||||
#define NUMTILE8 35
|
||||
#define NUMTILE8M 0
|
||||
#define NUMTILE16 0
|
||||
#define NUMTILE16M 0
|
||||
#define NUMTILE32 0
|
||||
#define NUMTILE32M 0
|
||||
#define NUMEXTERNS 13
|
||||
//
|
||||
// File offsets for data items
|
||||
//
|
||||
#define STRUCTPIC 0
|
||||
|
||||
#define STARTFONT 1
|
||||
#define STARTFONTM 3
|
||||
#define STARTPICS 3
|
||||
#define STARTPICM 135
|
||||
#define STARTSPRITES 135
|
||||
#define STARTTILE8 135
|
||||
#define STARTTILE8M 136
|
||||
#define STARTTILE16 136
|
||||
#define STARTTILE16M 136
|
||||
#define STARTTILE32 136
|
||||
#define STARTTILE32M 136
|
||||
#define STARTEXTERNS 136
|
||||
|
||||
//
|
||||
// Thank you for using IGRAB!
|
||||
//
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,345 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
@@ -0,0 +1,129 @@
|
||||
LIMITED USE SOFTWARE LICENSE AGREEMENT
|
||||
|
||||
This Limited Use Software License Agreement (the "Agreement")
|
||||
is a legal agreement between you, the end-user, and Id Software, Inc.
|
||||
("ID"). By continuing the downloading of this Wolfenstein 3D
|
||||
(the "Trademark") software material, which includes source code
|
||||
(the "Source Code"), artwork data, music and software tools
|
||||
(collectively, the "Software"), you are agreeing to be bound by the
|
||||
terms of this Agreement. If you do not agree to the terms of this
|
||||
Agreement, promptly destroy the Software you may have downloaded.
|
||||
|
||||
ID SOFTWARE LICENSE
|
||||
|
||||
Grant of License. ID grants to you the right to use one (1)
|
||||
copy of the Software on a single computer. You have no ownership or
|
||||
proprietary rights in or to the Software, or the Trademark. For purposes
|
||||
of this section, "use" means loading the Software into RAM, as well as
|
||||
installation on a hard disk or other storage device. The Software,
|
||||
together with any archive copy thereof, shall be destroyed when no longer
|
||||
used in accordance with this Agreement, or when the right to use the
|
||||
Software is terminated. You agree that the Software will not be shipped,
|
||||
transferred or exported into any country in violation of the U.S.
|
||||
Export Administration Act (or any other law governing such matters) and
|
||||
that you will not utilize, in any other manner, the Software in violation
|
||||
of any applicable law.
|
||||
|
||||
Permitted Uses. For educational purposes only, you, the end-user,
|
||||
may use portions of the Source Code, such as particular routines, to
|
||||
develop your own software, but may not duplicate the Source Code, except
|
||||
as noted in paragraph 4. The limited right referenced in the preceding
|
||||
sentence is hereinafter referred to as "Educational Use." By so exercising
|
||||
the Educational Use right you shall not obtain any ownership, copyright,
|
||||
proprietary or other interest in or to the Source Code, or any portion of
|
||||
the Source Code. You may dispose of your own software in your sole
|
||||
discretion. With the exception of the Educational Use right, you may not
|
||||
otherwise use the Software, or an portion of the Software, which includes
|
||||
the Source Code, for commercial gain.
|
||||
|
||||
Prohibited Uses: Under no circumstances shall you, the end-user,
|
||||
be permitted, allowed or authorized to commercially exploit the Software.
|
||||
Neither you nor anyone at your direction shall do any of the following acts
|
||||
with regard to the Software, or any portion thereof:
|
||||
|
||||
Rent;
|
||||
|
||||
Sell;
|
||||
|
||||
Lease;
|
||||
|
||||
Offer on a pay-per-play basis;
|
||||
|
||||
Distribute for money or any other consideration; or
|
||||
|
||||
In any other manner and through any medium whatsoever commercially
|
||||
exploit or use for any commercial purpose.
|
||||
|
||||
Notwithstanding the foregoing prohibitions, you may commercially exploit the
|
||||
software you develop by exercising the Educational Use right, referenced in
|
||||
paragraph 2. hereinabove.
|
||||
|
||||
Copyright. The Software and all copyrights related thereto
|
||||
(including all characters and other images generated by the Software
|
||||
or depicted in the Software) are owned by ID and is protected by
|
||||
United States copyright laws and international treaty provisions.
|
||||
Id shall retain exclusive ownership and copyright in and to the Software
|
||||
and all portions of the Software and you shall have no ownership or other
|
||||
proprietary interest in such materials. You must treat the Software like
|
||||
any other copyrighted material, except that you may either (a) make one
|
||||
copy of the Software solely for back-up or archival purposes, or (b)
|
||||
transfer the Software to a single hard disk provided you keep the original
|
||||
solely for back-up or archival purposes. You may not otherwise reproduce,
|
||||
copy or disclose to others, in whole or in any part, the Software. You
|
||||
may not copy the written materials accompanying the Software. You agree
|
||||
to use your best efforts to see that any user of the Software licensed
|
||||
hereunder complies with this Agreement.
|
||||
|
||||
NO WARRANTIES. ID DISCLAIMS ALL WARRANTIES, BOTH EXPRESS IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE WITH RESPECT TO THE SOFTWARE. THIS LIMITED
|
||||
WARRANTY GIVES YOU SPECIFIC LEGAL RIGHTS. YOU MAY HAVE OTHER RIGHTS WHICH
|
||||
VARY FROM JURISDICTION TO JURISDICTION. ID DOES NOT WARRANT THAT THE
|
||||
OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED, ERROR FREE OR MEET YOUR
|
||||
SPECIFIC REQUIREMENTS. THE WARRANTY SET FORTH ABOVE IS IN LIEU OF ALL OTHER
|
||||
EXPRESS WARRANTIES WHETHER ORAL OR WRITTEN. THE AGENTS, EMPLOYEES,
|
||||
DISTRIBUTORS, AND DEALERS OF ID ARE NOT AUTHORIZED TO MAKE MODIFICATIONS TO
|
||||
THIS WARRANTY, OR ADDITIONAL WARRANTIES ON BEHALF OF ID.
|
||||
|
||||
Exclusive Remedies. The Software is being offered to you free of any
|
||||
charge. You agree that you have no remedy against ID, its affiliates,
|
||||
contractors, suppliers, and agents for loss or damage caused by any defect
|
||||
or failure in the Software regardless of the form of action, whether in
|
||||
contract, tort, includinegligence, strict liability or otherwise, with
|
||||
regard to the Software. This Agreement shall be construed in accordance
|
||||
with and governed by the laws of the State of Texas. Copyright and other
|
||||
proprietary matters will be governed by United States laws and international
|
||||
treaties. IN ANY CASE, ID SHALL NOT BE LIABLE FOR LOSS OF DATA, LOSS OF
|
||||
PROFITS, LOST SAVINGS, SPECIAL, INCIDENTAL, CONSEQUENTIAL, INDIRECT OR OTHER
|
||||
SIMILAR DAMAGES ARISING FROM BREACH OF WARRANTY, BREACH OF CONTRACT,
|
||||
NEGLIGENCE, OR OTHER LEGAL THEORY EVEN IF ID OR ITS AGENT HAS BEEN ADVISED
|
||||
OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
|
||||
Some jurisdictions do not allow the exclusion or limitation of incidental or
|
||||
consequential damages, so the above limitation or exclusion may not apply to
|
||||
you.
|
||||
|
||||
General Provisions. Neither this Agreement nor any part or portion
|
||||
hereof shall be assigned, sublicensed or otherwise transferred by you.
|
||||
Should any provision of this Agreement be held to be void, invalid,
|
||||
unenforceable or illegal by a court, the validity and enforceability of the
|
||||
other provisions shall not be affected thereby. If any provision is
|
||||
determined to be unenforceable, you agree to a modification of such
|
||||
provision to provide for enforcement of the provision's intent, to the
|
||||
extent permitted by applicable law. Failure of a party to enforce any
|
||||
provision of this Agreement shall not constitute or be construed as a
|
||||
waiver of such provision or of the right to enforce such provision. If
|
||||
you fail to comply with any terms of this Agreement, YOUR LICENSE IS
|
||||
AUTOMATICALLY TERMINATED and you agree to the issuance of an injunction
|
||||
against you in favor of Id. You agree that Id shall not have to post
|
||||
bond or other security to obtain an injunction against you to prohibit
|
||||
you from violating Id's rights.
|
||||
|
||||
YOU ACKNOWLEDGE THAT YOU HAVE READ THIS AGREEMENT, THAT YOU
|
||||
UNDERSTAND THIS AGREEMENT, AND UNDERSTAND THAT BY CONTINUING THE
|
||||
DOWNLOADING OF THE SOFTWARE, YOU AGREE TO BE BOUND BY THIS AGREEMENT'S
|
||||
TERMS AND CONDITIONS. YOU FURTHER AGREE THAT, EXCEPT FOR WRITTEN SEPARATE
|
||||
AGREEMENTS BETWEEN ID AND YOU, THIS AGREEMENT IS A COMPLETE AND EXCLUSIVE
|
||||
STATEMENT OF THE RIGHTS AND LIABILITIES OF THE PARTIES. THIS AGREEMENT
|
||||
SUPERSEDES ALL PRIOR ORAL AGREEMENTS, PROPOSALS OR UNDERSTANDINGS, AND
|
||||
ANY OTHER COMMUNICATIONS BETWEEN ID AND YOU RELATING TO THE SUBJECT MATTER
|
||||
OF THIS AGREEMENT
|
||||
@@ -0,0 +1,52 @@
|
||||
RGB( 0, 0, 0),RGB( 0, 0, 42),RGB( 0, 42, 0),RGB( 0, 42, 42),RGB( 42, 0, 0),
|
||||
RGB( 42, 0, 42),RGB( 42, 21, 0),RGB( 42, 42, 42),RGB( 21, 21, 21),RGB( 21, 21, 63),
|
||||
RGB( 21, 63, 21),RGB( 21, 63, 63),RGB( 63, 21, 21),RGB( 63, 21, 63),RGB( 63, 63, 21),
|
||||
RGB( 63, 63, 63),RGB( 59, 59, 59),RGB( 55, 55, 55),RGB( 52, 52, 52),RGB( 48, 48, 48),
|
||||
RGB( 45, 45, 45),RGB( 42, 42, 42),RGB( 38, 38, 38),RGB( 35, 35, 35),RGB( 31, 31, 31),
|
||||
RGB( 28, 28, 28),RGB( 25, 25, 25),RGB( 21, 21, 21),RGB( 18, 18, 18),RGB( 14, 14, 14),
|
||||
RGB( 11, 11, 11),RGB( 8, 8, 8),RGB( 63, 0, 0),RGB( 59, 0, 0),RGB( 56, 0, 0),
|
||||
RGB( 53, 0, 0),RGB( 50, 0, 0),RGB( 47, 0, 0),RGB( 44, 0, 0),RGB( 41, 0, 0),
|
||||
RGB( 38, 0, 0),RGB( 34, 0, 0),RGB( 31, 0, 0),RGB( 28, 0, 0),RGB( 25, 0, 0),
|
||||
RGB( 22, 0, 0),RGB( 19, 0, 0),RGB( 16, 0, 0),RGB( 63, 54, 54),RGB( 63, 46, 46),
|
||||
RGB( 63, 39, 39),RGB( 63, 31, 31),RGB( 63, 23, 23),RGB( 63, 16, 16),RGB( 63, 8, 8),
|
||||
RGB( 63, 0, 0),RGB( 63, 42, 23),RGB( 63, 38, 16),RGB( 63, 34, 8),RGB( 63, 30, 0),
|
||||
RGB( 57, 27, 0),RGB( 51, 24, 0),RGB( 45, 21, 0),RGB( 39, 19, 0),RGB( 63, 63, 54),
|
||||
RGB( 63, 63, 46),RGB( 63, 63, 39),RGB( 63, 63, 31),RGB( 63, 62, 23),RGB( 63, 61, 16),
|
||||
RGB( 63, 61, 8),RGB( 63, 61, 0),RGB( 57, 54, 0),RGB( 51, 49, 0),RGB( 45, 43, 0),
|
||||
RGB( 39, 39, 0),RGB( 33, 33, 0),RGB( 28, 27, 0),RGB( 22, 21, 0),RGB( 16, 16, 0),
|
||||
RGB( 52, 63, 23),RGB( 49, 63, 16),RGB( 45, 63, 8),RGB( 40, 63, 0),RGB( 36, 57, 0),
|
||||
RGB( 32, 51, 0),RGB( 29, 45, 0),RGB( 24, 39, 0),RGB( 54, 63, 54),RGB( 47, 63, 46),
|
||||
RGB( 39, 63, 39),RGB( 32, 63, 31),RGB( 24, 63, 23),RGB( 16, 63, 16),RGB( 8, 63, 8),
|
||||
RGB( 0, 63, 0),RGB( 0, 63, 0),RGB( 0, 59, 0),RGB( 0, 56, 0),RGB( 0, 53, 0),
|
||||
RGB( 1, 50, 0),RGB( 1, 47, 0),RGB( 1, 44, 0),RGB( 1, 41, 0),RGB( 1, 38, 0),
|
||||
RGB( 1, 34, 0),RGB( 1, 31, 0),RGB( 1, 28, 0),RGB( 1, 25, 0),RGB( 1, 22, 0),
|
||||
RGB( 1, 19, 0),RGB( 1, 16, 0),RGB( 54, 63, 63),RGB( 46, 63, 63),RGB( 39, 63, 63),
|
||||
RGB( 31, 63, 62),RGB( 23, 63, 63),RGB( 16, 63, 63),RGB( 8, 63, 63),RGB( 0, 63, 63),
|
||||
RGB( 0, 57, 57),RGB( 0, 51, 51),RGB( 0, 45, 45),RGB( 0, 39, 39),RGB( 0, 33, 33),
|
||||
RGB( 0, 28, 28),RGB( 0, 22, 22),RGB( 0, 16, 16),RGB( 23, 47, 63),RGB( 16, 44, 63),
|
||||
RGB( 8, 42, 63),RGB( 0, 39, 63),RGB( 0, 35, 57),RGB( 0, 31, 51),RGB( 0, 27, 45),
|
||||
RGB( 0, 23, 39),RGB( 54, 54, 63),RGB( 46, 47, 63),RGB( 39, 39, 63),RGB( 31, 32, 63),
|
||||
RGB( 23, 24, 63),RGB( 16, 16, 63),RGB( 8, 9, 63),RGB( 0, 1, 63),RGB( 0, 0, 63),
|
||||
RGB( 0, 0, 59),RGB( 0, 0, 56),RGB( 0, 0, 53),RGB( 0, 0, 50),RGB( 0, 0, 47),
|
||||
RGB( 0, 0, 44),RGB( 0, 0, 41),RGB( 0, 0, 38),RGB( 0, 0, 34),RGB( 0, 0, 31),
|
||||
RGB( 0, 0, 28),RGB( 0, 0, 25),RGB( 0, 0, 22),RGB( 0, 0, 19),RGB( 0, 0, 16),
|
||||
RGB( 10, 10, 10),RGB( 63, 56, 13),RGB( 63, 53, 9),RGB( 63, 51, 6),RGB( 63, 48, 2),
|
||||
RGB( 63, 45, 0),RGB( 0, 14, 0),RGB( 0, 10, 0),RGB( 38, 0, 57),RGB( 32, 0, 51),
|
||||
RGB( 29, 0, 45),RGB( 24, 0, 39),RGB( 20, 0, 33),RGB( 17, 0, 28),RGB( 13, 0, 22),
|
||||
RGB( 10, 0, 16),RGB( 63, 54, 63),RGB( 63, 46, 63),RGB( 63, 39, 63),RGB( 63, 31, 63),
|
||||
RGB( 63, 23, 63),RGB( 63, 16, 63),RGB( 63, 8, 63),RGB( 63, 0, 63),RGB( 56, 0, 57),
|
||||
RGB( 50, 0, 51),RGB( 45, 0, 45),RGB( 39, 0, 39),RGB( 33, 0, 33),RGB( 27, 0, 28),
|
||||
RGB( 22, 0, 22),RGB( 16, 0, 16),RGB( 63, 58, 55),RGB( 63, 56, 52),RGB( 63, 54, 49),
|
||||
RGB( 63, 53, 47),RGB( 63, 51, 44),RGB( 63, 49, 41),RGB( 63, 47, 39),RGB( 63, 46, 36),
|
||||
RGB( 63, 44, 32),RGB( 63, 41, 28),RGB( 63, 39, 24),RGB( 60, 37, 23),RGB( 58, 35, 22),
|
||||
RGB( 55, 34, 21),RGB( 52, 32, 20),RGB( 50, 31, 19),RGB( 47, 30, 18),RGB( 45, 28, 17),
|
||||
RGB( 42, 26, 16),RGB( 40, 25, 15),RGB( 39, 24, 14),RGB( 36, 23, 13),RGB( 34, 22, 12),
|
||||
RGB( 32, 20, 11),RGB( 29, 19, 10),RGB( 27, 18, 9),RGB( 23, 16, 8),RGB( 21, 15, 7),
|
||||
RGB( 18, 14, 6),RGB( 16, 12, 6),RGB( 14, 11, 5),RGB( 10, 8, 3),RGB( 24, 0, 25),
|
||||
RGB( 0, 25, 25),RGB( 0, 24, 24),RGB( 0, 0, 7),RGB( 0, 0, 11),RGB( 12, 9, 4),
|
||||
RGB( 18, 0, 18),RGB( 20, 0, 20),RGB( 0, 0, 13),RGB( 7, 7, 7),RGB( 19, 19, 19),
|
||||
RGB( 23, 23, 23),RGB( 16, 16, 16),RGB( 12, 12, 12),RGB( 13, 13, 13),RGB( 54, 61, 61),
|
||||
RGB( 46, 58, 58),RGB( 39, 55, 55),RGB( 29, 50, 50),RGB( 18, 48, 48),RGB( 8, 45, 45),
|
||||
RGB( 8, 44, 44),RGB( 0, 41, 41),RGB( 0, 38, 38),RGB( 0, 35, 35),RGB( 0, 33, 33),
|
||||
RGB( 0, 31, 31),RGB( 0, 30, 30),RGB( 0, 29, 29),RGB( 0, 28, 28),RGB( 0, 27, 27),
|
||||
RGB( 38, 0, 34)
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef __VERSION_H_
|
||||
#define __VERSION_H_
|
||||
/* Paramix: one program for the shareware (.WL1) and the full version (.WL6) v1.4; the Studio's pack hides the
|
||||
* differences of the graphics files, the number of episodes comes from the pack. */
|
||||
#define CARMACIZED
|
||||
#define GOODTIMES
|
||||
#define ADDEDFIX
|
||||
#define FIXCALCROTATE
|
||||
#endif
|
||||
@@ -0,0 +1,857 @@
|
||||
// WL_ACT1.C
|
||||
|
||||
#include "wl_def.h"
|
||||
|
||||
/*
|
||||
=============================================================================
|
||||
|
||||
STATICS
|
||||
|
||||
=============================================================================
|
||||
*/
|
||||
|
||||
|
||||
statobj_t statobjlist[MAXSTATS];
|
||||
statobj_t *laststatobj;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short picnum;
|
||||
int16_t type;
|
||||
uint32_t specialFlags; // they are ORed to the statobj_t flags
|
||||
} statinfo_t;
|
||||
|
||||
statinfo_t statinfo[] =
|
||||
{
|
||||
{SPR_STAT_0}, // puddle spr1v
|
||||
{SPR_STAT_1,block}, // Green Barrel "
|
||||
{SPR_STAT_2,block}, // Table/chairs "
|
||||
{SPR_STAT_3,block,FL_FULLBRIGHT}, // Floor lamp "
|
||||
{SPR_STAT_4,none,FL_FULLBRIGHT}, // Chandelier "
|
||||
{SPR_STAT_5,block}, // Hanged man "
|
||||
{SPR_STAT_6,bo_alpo}, // Bad food "
|
||||
{SPR_STAT_7,block}, // Red pillar "
|
||||
//
|
||||
// NEW PAGE
|
||||
//
|
||||
{SPR_STAT_8,block}, // Tree spr2v
|
||||
{SPR_STAT_9}, // Skeleton flat "
|
||||
{SPR_STAT_10,block}, // Sink " (SOD:gibs)
|
||||
{SPR_STAT_11,block}, // Potted plant "
|
||||
{SPR_STAT_12,block}, // Urn "
|
||||
{SPR_STAT_13,block}, // Bare table "
|
||||
{SPR_STAT_14,none,FL_FULLBRIGHT}, // Ceiling light "
|
||||
#ifndef SPEAR
|
||||
{SPR_STAT_15}, // Kitchen stuff "
|
||||
#else
|
||||
{SPR_STAT_15,block}, // Gibs!
|
||||
#endif
|
||||
//
|
||||
// NEW PAGE
|
||||
//
|
||||
{SPR_STAT_16,block}, // suit of armor spr3v
|
||||
{SPR_STAT_17,block}, // Hanging cage "
|
||||
{SPR_STAT_18,block}, // SkeletoninCage "
|
||||
{SPR_STAT_19}, // Skeleton relax "
|
||||
{SPR_STAT_20,bo_key1}, // Key 1 "
|
||||
{SPR_STAT_21,bo_key2}, // Key 2 "
|
||||
{SPR_STAT_22,block}, // stuff (SOD:gibs)
|
||||
{SPR_STAT_23}, // stuff
|
||||
//
|
||||
// NEW PAGE
|
||||
//
|
||||
{SPR_STAT_24,bo_food}, // Good food spr4v
|
||||
{SPR_STAT_25,bo_firstaid}, // First aid "
|
||||
{SPR_STAT_26,bo_clip}, // Clip "
|
||||
{SPR_STAT_27,bo_machinegun}, // Machine gun "
|
||||
{SPR_STAT_28,bo_chaingun}, // Gatling gun "
|
||||
{SPR_STAT_29,bo_cross}, // Cross "
|
||||
{SPR_STAT_30,bo_chalice}, // Chalice "
|
||||
{SPR_STAT_31,bo_bible}, // Bible "
|
||||
//
|
||||
// NEW PAGE
|
||||
//
|
||||
{SPR_STAT_32,bo_crown}, // crown spr5v
|
||||
{SPR_STAT_33,bo_fullheal,FL_FULLBRIGHT},// one up "
|
||||
{SPR_STAT_34,bo_gibs}, // gibs "
|
||||
{SPR_STAT_35,block}, // barrel "
|
||||
{SPR_STAT_36,block}, // well "
|
||||
{SPR_STAT_37,block}, // Empty well "
|
||||
{SPR_STAT_38,bo_gibs}, // Gibs 2 "
|
||||
{SPR_STAT_39,block}, // flag "
|
||||
//
|
||||
// NEW PAGE
|
||||
//
|
||||
#ifndef SPEAR
|
||||
{SPR_STAT_40,block}, // Call Apogee spr7v
|
||||
#else
|
||||
{SPR_STAT_40}, // Red light
|
||||
#endif
|
||||
//
|
||||
// NEW PAGE
|
||||
//
|
||||
{SPR_STAT_41}, // junk "
|
||||
{SPR_STAT_42}, // junk "
|
||||
{SPR_STAT_43}, // junk "
|
||||
#ifndef SPEAR
|
||||
{SPR_STAT_44}, // pots "
|
||||
#else
|
||||
{SPR_STAT_44,block}, // Gibs!
|
||||
#endif
|
||||
{SPR_STAT_45,block}, // stove " (SOD:gibs)
|
||||
{SPR_STAT_46,block}, // spears " (SOD:gibs)
|
||||
{SPR_STAT_47}, // vines "
|
||||
//
|
||||
// NEW PAGE
|
||||
//
|
||||
#ifdef SPEAR
|
||||
{SPR_STAT_48,block}, // marble pillar
|
||||
{SPR_STAT_49,bo_25clip}, // bonus 25 clip
|
||||
{SPR_STAT_50,block}, // truck
|
||||
{SPR_STAT_51,bo_spear}, // SPEAR OF DESTINY!
|
||||
#endif
|
||||
|
||||
{SPR_STAT_26,bo_clip2}, // Clip "
|
||||
#ifdef USE_DIR3DSPR
|
||||
// These are just two examples showing the new way of using dir 3d sprites.
|
||||
// You can find the allowed values in the objflag_t enum in wl_def.h.
|
||||
{SPR_STAT_47,none,FL_DIR_VERT_MID},
|
||||
{SPR_STAT_47,block,FL_DIR_HORIZ_MID},
|
||||
#endif
|
||||
{-1} // terminator
|
||||
};
|
||||
|
||||
/*
|
||||
===============
|
||||
=
|
||||
= InitStaticList
|
||||
=
|
||||
===============
|
||||
*/
|
||||
|
||||
void InitStaticList (void)
|
||||
{
|
||||
laststatobj = &statobjlist[0];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
=
|
||||
= SpawnStatic
|
||||
=
|
||||
===============
|
||||
*/
|
||||
|
||||
void SpawnStatic (int tilex, int tiley, int type)
|
||||
{
|
||||
laststatobj->shapenum = statinfo[type].picnum;
|
||||
laststatobj->tilex = tilex;
|
||||
laststatobj->tiley = tiley;
|
||||
laststatobj->itemnumber = statinfo[type].type;
|
||||
|
||||
switch (statinfo[type].type)
|
||||
{
|
||||
case block:
|
||||
actorat[tilex][tiley] = (objtype *) BIT_WALL; // consider it a blocking tile
|
||||
case none:
|
||||
laststatobj->flags = 0;
|
||||
break;
|
||||
|
||||
case bo_cross:
|
||||
case bo_chalice:
|
||||
case bo_bible:
|
||||
case bo_crown:
|
||||
case bo_fullheal:
|
||||
if (!loadedgame)
|
||||
gamestate.treasuretotal++;
|
||||
|
||||
case bo_firstaid:
|
||||
case bo_key1:
|
||||
case bo_key2:
|
||||
case bo_key3:
|
||||
case bo_key4:
|
||||
case bo_clip:
|
||||
case bo_clip2:
|
||||
case bo_25clip:
|
||||
case bo_machinegun:
|
||||
case bo_chaingun:
|
||||
case bo_food:
|
||||
case bo_alpo:
|
||||
case bo_gibs:
|
||||
case bo_spear:
|
||||
laststatobj->flags = FL_BONUS;
|
||||
break;
|
||||
}
|
||||
|
||||
laststatobj->flags |= statinfo[type].specialFlags;
|
||||
|
||||
laststatobj++;
|
||||
|
||||
if (laststatobj == &statobjlist[MAXSTATS - 1])
|
||||
Quit ("Too many static objects!\n");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
=
|
||||
= PlaceItemType
|
||||
=
|
||||
= Called during game play to drop actors' items. It finds the proper
|
||||
= item number based on the item type (bo_???). If there are no free item
|
||||
= spots, nothing is done.
|
||||
=
|
||||
===============
|
||||
*/
|
||||
|
||||
void PlaceItemType (int itemtype, int tilex, int tiley)
|
||||
{
|
||||
int type;
|
||||
statobj_t *spot;
|
||||
|
||||
//
|
||||
// find the item number
|
||||
//
|
||||
for (type=0; ; type++)
|
||||
{
|
||||
if (statinfo[type].picnum == -1) // end of list
|
||||
Quit ("PlaceItemType: couldn't find type!");
|
||||
if (statinfo[type].type == itemtype)
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// find a spot in statobjlist to put it in
|
||||
//
|
||||
for (spot=&statobjlist[0]; ; spot++)
|
||||
{
|
||||
if (spot==laststatobj)
|
||||
{
|
||||
if (spot == &statobjlist[MAXSTATS - 1])
|
||||
return; // no free spots
|
||||
laststatobj++; // space at end
|
||||
break;
|
||||
}
|
||||
|
||||
if (spot->shapenum == -1) // -1 is a free spot
|
||||
break;
|
||||
}
|
||||
//
|
||||
// place it
|
||||
//
|
||||
spot->shapenum = statinfo[type].picnum;
|
||||
spot->tilex = tilex;
|
||||
spot->tiley = tiley;
|
||||
spot->flags = FL_BONUS | statinfo[type].specialFlags;
|
||||
spot->itemnumber = statinfo[type].type;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
=============================================================================
|
||||
|
||||
DOORS
|
||||
|
||||
doorobjlist[] holds most of the information for the doors
|
||||
|
||||
door->position holds the amount the door is open, ranging from 0 to 0xffff
|
||||
this is directly accessed by AsmRefresh during rendering
|
||||
|
||||
The number of doors is limited to 64 because a spot in tilemap holds the
|
||||
door number in the low 6 bits, with the high bit meaning a door center
|
||||
and bit 6 meaning a door side tile
|
||||
|
||||
Open doors conect two areas, so sounds will travel between them and sight
|
||||
will be checked when the player is in a connected area.
|
||||
|
||||
Areaconnect is incremented/decremented by each door. If >0 they connect
|
||||
|
||||
Every time a door opens or closes the areabyplayer matrix gets recalculated.
|
||||
An area is true if it connects with the player's current spor.
|
||||
|
||||
=============================================================================
|
||||
*/
|
||||
|
||||
#define DOORWIDTH 0x7800
|
||||
#define OPENTICS 300
|
||||
|
||||
doorobj_t doorobjlist[MAXDOORS],*lastdoorobj;
|
||||
short doornum;
|
||||
|
||||
byte areaconnect[NUMAREAS][NUMAREAS];
|
||||
|
||||
boolean areabyplayer[NUMAREAS];
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
=
|
||||
= ConnectAreas
|
||||
=
|
||||
= Scans outward from playerarea, marking all connected areas
|
||||
=
|
||||
==============
|
||||
*/
|
||||
|
||||
void RecursiveConnect (int areanumber)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0;i<NUMAREAS;i++)
|
||||
{
|
||||
if (areaconnect[areanumber][i] && !areabyplayer[i])
|
||||
{
|
||||
areabyplayer[i] = true;
|
||||
RecursiveConnect (i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ConnectAreas (void)
|
||||
{
|
||||
memset (areabyplayer,0,sizeof(areabyplayer));
|
||||
areabyplayer[player->areanumber] = true;
|
||||
RecursiveConnect (player->areanumber);
|
||||
}
|
||||
|
||||
|
||||
void InitAreas (void)
|
||||
{
|
||||
memset (areabyplayer,0,sizeof(areabyplayer));
|
||||
if (player->areanumber < NUMAREAS)
|
||||
areabyplayer[player->areanumber] = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
=
|
||||
= InitDoorList
|
||||
=
|
||||
===============
|
||||
*/
|
||||
|
||||
void InitDoorList (void)
|
||||
{
|
||||
memset (areabyplayer,0,sizeof(areabyplayer));
|
||||
memset (areaconnect,0,sizeof(areaconnect));
|
||||
|
||||
lastdoorobj = &doorobjlist[0];
|
||||
doornum = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
=
|
||||
= SpawnDoor
|
||||
=
|
||||
===============
|
||||
*/
|
||||
|
||||
void SpawnDoor (int tilex, int tiley, boolean vertical, int lock)
|
||||
{
|
||||
word *map;
|
||||
|
||||
if (doornum==MAXDOORS)
|
||||
Quit ("64+ doors on level!");
|
||||
|
||||
lastdoorobj->position = 0; // doors start out fully closed
|
||||
lastdoorobj->tilex = tilex;
|
||||
lastdoorobj->tiley = tiley;
|
||||
lastdoorobj->vertical = vertical;
|
||||
lastdoorobj->lock = lock;
|
||||
lastdoorobj->action = dr_closed;
|
||||
|
||||
actorat[tilex][tiley] = (objtype *)(uintptr_t)(doornum | BIT_DOOR); // consider it a solid wall
|
||||
|
||||
//
|
||||
// make the door tile a special tile, and mark the adjacent tiles
|
||||
// for door sides
|
||||
//
|
||||
tilemap[tilex][tiley] = doornum | BIT_DOOR;
|
||||
map = &MAPSPOT(tilex,tiley,0);
|
||||
if (vertical)
|
||||
{
|
||||
*map = *(map-1); // set area number
|
||||
tilemap[tilex][tiley-1] |= BIT_WALL;
|
||||
tilemap[tilex][tiley+1] |= BIT_WALL;
|
||||
}
|
||||
else
|
||||
{
|
||||
*map = *(map-mapwidth); // set area number
|
||||
tilemap[tilex-1][tiley] |= BIT_WALL;
|
||||
tilemap[tilex+1][tiley] |= BIT_WALL;
|
||||
}
|
||||
|
||||
doornum++;
|
||||
lastdoorobj++;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
||||
/*
|
||||
=====================
|
||||
=
|
||||
= OpenDoor
|
||||
=
|
||||
=====================
|
||||
*/
|
||||
|
||||
void OpenDoor (int door)
|
||||
{
|
||||
if (doorobjlist[door].action == dr_open)
|
||||
doorobjlist[door].ticcount = 0; // reset open time
|
||||
else
|
||||
doorobjlist[door].action = dr_opening; // start it opening
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=====================
|
||||
=
|
||||
= CloseDoor
|
||||
=
|
||||
=====================
|
||||
*/
|
||||
|
||||
void CloseDoor (int door)
|
||||
{
|
||||
int tilex,tiley,area;
|
||||
objtype *check;
|
||||
|
||||
//
|
||||
// don't close on anything solid
|
||||
//
|
||||
tilex = doorobjlist[door].tilex;
|
||||
tiley = doorobjlist[door].tiley;
|
||||
|
||||
if (actorat[tilex][tiley])
|
||||
return;
|
||||
|
||||
if (player->tilex == tilex && player->tiley == tiley)
|
||||
return;
|
||||
|
||||
if (doorobjlist[door].vertical)
|
||||
{
|
||||
if ( player->tiley == tiley )
|
||||
{
|
||||
if ( ((player->x+MINDIST) >>TILESHIFT) == tilex )
|
||||
return;
|
||||
if ( ((player->x-MINDIST) >>TILESHIFT) == tilex )
|
||||
return;
|
||||
}
|
||||
check = actorat[tilex-1][tiley];
|
||||
if (ISPOINTER(check) && ((check->x+MINDIST) >> TILESHIFT) == tilex )
|
||||
return;
|
||||
check = actorat[tilex+1][tiley];
|
||||
if (ISPOINTER(check) && ((check->x-MINDIST) >> TILESHIFT) == tilex )
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player->tilex == tilex)
|
||||
{
|
||||
if ( ((player->y+MINDIST) >>TILESHIFT) == tiley )
|
||||
return;
|
||||
if ( ((player->y-MINDIST) >>TILESHIFT) == tiley )
|
||||
return;
|
||||
}
|
||||
check = actorat[tilex][tiley-1];
|
||||
if (ISPOINTER(check) && ((check->y+MINDIST) >> TILESHIFT) == tiley )
|
||||
return;
|
||||
check = actorat[tilex][tiley+1];
|
||||
if (ISPOINTER(check) && ((check->y-MINDIST) >> TILESHIFT) == tiley )
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// play door sound if in a connected area
|
||||
//
|
||||
area = MAPSPOT(tilex,tiley,0) - AREATILE;
|
||||
|
||||
if (areabyplayer[area])
|
||||
{
|
||||
PlaySoundLocTile(CLOSEDOORSND,doorobjlist[door].tilex,doorobjlist[door].tiley); // JAB
|
||||
}
|
||||
|
||||
doorobjlist[door].action = dr_closing;
|
||||
//
|
||||
// make the door space solid
|
||||
//
|
||||
actorat[tilex][tiley] = (objtype *)(uintptr_t)(door | BIT_DOOR);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
=====================
|
||||
=
|
||||
= OperateDoor
|
||||
=
|
||||
= The player wants to change the door's direction
|
||||
=
|
||||
=====================
|
||||
*/
|
||||
|
||||
void OperateDoor (int door)
|
||||
{
|
||||
int lock;
|
||||
|
||||
lock = doorobjlist[door].lock;
|
||||
if (lock >= dr_lock1 && lock <= dr_lock4)
|
||||
{
|
||||
if ( ! (gamestate.keys & (1 << (lock-dr_lock1) ) ) )
|
||||
{
|
||||
if (!doorobjlist[door].position)
|
||||
SD_PlaySound (NOWAYSND); // ADDEDFIX 9 // locked
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch (doorobjlist[door].action)
|
||||
{
|
||||
case dr_closed:
|
||||
case dr_closing:
|
||||
OpenDoor (door);
|
||||
break;
|
||||
case dr_open:
|
||||
case dr_opening:
|
||||
CloseDoor (door);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
|
||||
/*
|
||||
===============
|
||||
=
|
||||
= DoorOpen
|
||||
=
|
||||
= Close the door after three seconds
|
||||
=
|
||||
===============
|
||||
*/
|
||||
|
||||
void DoorOpen (int door)
|
||||
{
|
||||
if ( (doorobjlist[door].ticcount += (short) tics) >= OPENTICS)
|
||||
CloseDoor (door);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
=
|
||||
= DoorOpening
|
||||
=
|
||||
===============
|
||||
*/
|
||||
|
||||
void DoorOpening (int door)
|
||||
{
|
||||
unsigned area1,area2;
|
||||
word *map;
|
||||
int32_t position;
|
||||
|
||||
position = doorobjlist[door].position;
|
||||
if (!position)
|
||||
{
|
||||
//
|
||||
// door is just starting to open, so connect the areas
|
||||
//
|
||||
map = &MAPSPOT(doorobjlist[door].tilex,doorobjlist[door].tiley,0);
|
||||
|
||||
if (doorobjlist[door].vertical)
|
||||
{
|
||||
area1 = *(map+1);
|
||||
area2 = *(map-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
area1 = *(map-mapwidth);
|
||||
area2 = *(map+mapwidth);
|
||||
}
|
||||
area1 -= AREATILE;
|
||||
area2 -= AREATILE;
|
||||
|
||||
if (area1 < NUMAREAS && area2 < NUMAREAS)
|
||||
{
|
||||
areaconnect[area1][area2]++;
|
||||
areaconnect[area2][area1]++;
|
||||
|
||||
if (player->areanumber < NUMAREAS)
|
||||
ConnectAreas ();
|
||||
|
||||
if (areabyplayer[area1])
|
||||
PlaySoundLocTile(OPENDOORSND,doorobjlist[door].tilex,doorobjlist[door].tiley); // JAB
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// slide the door by an adaptive amount
|
||||
//
|
||||
position += tics<<10;
|
||||
if (position >= 0xffff)
|
||||
{
|
||||
//
|
||||
// door is all the way open
|
||||
//
|
||||
position = 0xffff;
|
||||
doorobjlist[door].ticcount = 0;
|
||||
doorobjlist[door].action = dr_open;
|
||||
actorat[doorobjlist[door].tilex][doorobjlist[door].tiley] = 0;
|
||||
}
|
||||
|
||||
doorobjlist[door].position = (word) position;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
=
|
||||
= DoorClosing
|
||||
=
|
||||
===============
|
||||
*/
|
||||
|
||||
void DoorClosing (int door)
|
||||
{
|
||||
unsigned area1,area2;
|
||||
word *map;
|
||||
int32_t position;
|
||||
int tilex,tiley;
|
||||
|
||||
tilex = doorobjlist[door].tilex;
|
||||
tiley = doorobjlist[door].tiley;
|
||||
|
||||
if ( ((int)(uintptr_t)actorat[tilex][tiley] != (door | BIT_DOOR))
|
||||
|| (player->tilex == tilex && player->tiley == tiley) )
|
||||
{ // something got inside the door
|
||||
OpenDoor (door);
|
||||
return;
|
||||
};
|
||||
|
||||
position = doorobjlist[door].position;
|
||||
|
||||
//
|
||||
// slide the door by an adaptive amount
|
||||
//
|
||||
position -= tics<<10;
|
||||
if (position <= 0)
|
||||
{
|
||||
//
|
||||
// door is closed all the way, so disconnect the areas
|
||||
//
|
||||
position = 0;
|
||||
|
||||
doorobjlist[door].action = dr_closed;
|
||||
|
||||
map = &MAPSPOT(tilex,tiley,0);
|
||||
|
||||
if (doorobjlist[door].vertical)
|
||||
{
|
||||
area1 = *(map+1);
|
||||
area2 = *(map-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
area1 = *(map-mapwidth);
|
||||
area2 = *(map+mapwidth);
|
||||
}
|
||||
area1 -= AREATILE;
|
||||
area2 -= AREATILE;
|
||||
|
||||
if (area1 < NUMAREAS && area2 < NUMAREAS)
|
||||
{
|
||||
areaconnect[area1][area2]--;
|
||||
areaconnect[area2][area1]--;
|
||||
|
||||
if (player->areanumber < NUMAREAS)
|
||||
ConnectAreas ();
|
||||
}
|
||||
}
|
||||
|
||||
doorobjlist[door].position = (word) position;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
=====================
|
||||
=
|
||||
= MoveDoors
|
||||
=
|
||||
= Called from PlayLoop
|
||||
=
|
||||
=====================
|
||||
*/
|
||||
|
||||
void MoveDoors (void)
|
||||
{
|
||||
int door;
|
||||
|
||||
if (gamestate.victoryflag) // don't move door during victory sequence
|
||||
return;
|
||||
|
||||
for (door = 0; door < doornum; door++)
|
||||
{
|
||||
switch (doorobjlist[door].action)
|
||||
{
|
||||
case dr_open:
|
||||
DoorOpen (door);
|
||||
break;
|
||||
|
||||
case dr_opening:
|
||||
DoorOpening(door);
|
||||
break;
|
||||
|
||||
case dr_closing:
|
||||
DoorClosing(door);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=============================================================================
|
||||
|
||||
PUSHABLE WALLS
|
||||
|
||||
=============================================================================
|
||||
*/
|
||||
|
||||
word pwallstate;
|
||||
word pwallpos; // amount a pushable wall has been moved (0-63)
|
||||
word pwallx,pwally;
|
||||
byte pwalldir;
|
||||
tiletype pwalltile;
|
||||
int dirs[4][2]={{0,-1},{1,0},{0,1},{-1,0}};
|
||||
|
||||
/*
|
||||
===============
|
||||
=
|
||||
= PushWall
|
||||
=
|
||||
===============
|
||||
*/
|
||||
|
||||
void PushWall (int checkx, int checky, int dir)
|
||||
{
|
||||
int oldtile, dx, dy;
|
||||
|
||||
if (pwallstate)
|
||||
return;
|
||||
|
||||
oldtile = tilemap[checkx][checky];
|
||||
if (!oldtile)
|
||||
return;
|
||||
|
||||
dx = dirs[dir][0];
|
||||
dy = dirs[dir][1];
|
||||
|
||||
if (actorat[checkx+dx][checky+dy])
|
||||
{
|
||||
SD_PlaySound (NOWAYSND);
|
||||
return;
|
||||
}
|
||||
actorat[checkx+dx][checky+dy] = (objtype *)(uintptr_t) (tilemap[checkx+dx][checky+dy] = oldtile);
|
||||
|
||||
gamestate.secretcount++;
|
||||
pwallx = checkx;
|
||||
pwally = checky;
|
||||
pwalldir = dir;
|
||||
pwallstate = 1;
|
||||
pwallpos = 0;
|
||||
pwalltile = tilemap[pwallx][pwally];
|
||||
tilemap[pwallx][pwally] = BIT_WALL;
|
||||
tilemap[pwallx+dx][pwally+dy] = BIT_WALL;
|
||||
MAPSPOT(pwallx,pwally,1) = 0; // remove P tile info
|
||||
MAPSPOT(pwallx,pwally,0) = MAPSPOT(player->tilex,player->tiley,0); // set correct floorcode (BrotherTank's fix) TODO: use a better method...
|
||||
|
||||
SD_PlaySound (PUSHWALLSND);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
=
|
||||
= MovePWalls
|
||||
=
|
||||
=================
|
||||
*/
|
||||
|
||||
void MovePWalls (void)
|
||||
{
|
||||
int oldblock,oldtile;
|
||||
|
||||
if (!pwallstate)
|
||||
return;
|
||||
|
||||
oldblock = pwallstate/128;
|
||||
|
||||
pwallstate += (word)tics;
|
||||
|
||||
if (pwallstate/128 != oldblock)
|
||||
{
|
||||
// block crossed into a new block
|
||||
oldtile = pwalltile;
|
||||
|
||||
//
|
||||
// the tile can now be walked into
|
||||
//
|
||||
tilemap[pwallx][pwally] = 0;
|
||||
actorat[pwallx][pwally] = 0;
|
||||
MAPSPOT(pwallx,pwally,0) = player->areanumber+AREATILE; // TODO: this is unnecessary, and makes a mess of mapsegs
|
||||
|
||||
int dx=dirs[pwalldir][0], dy=dirs[pwalldir][1];
|
||||
//
|
||||
// see if it should be pushed farther
|
||||
//
|
||||
if (pwallstate>=256) // only move two tiles fix
|
||||
{
|
||||
//
|
||||
// the block has been pushed two tiles
|
||||
//
|
||||
pwallstate = 0;
|
||||
tilemap[pwallx+dx][pwally+dy] = oldtile;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
int xl,yl,xh,yh;
|
||||
xl = (player->x-PLAYERSIZE) >> TILESHIFT;
|
||||
yl = (player->y-PLAYERSIZE) >> TILESHIFT;
|
||||
xh = (player->x+PLAYERSIZE) >> TILESHIFT;
|
||||
yh = (player->y+PLAYERSIZE) >> TILESHIFT;
|
||||
|
||||
pwallx += dx;
|
||||
pwally += dy;
|
||||
|
||||
if (actorat[pwallx+dx][pwally+dy]
|
||||
|| (xl<=pwallx+dx && pwallx+dx<=xh && yl<=pwally+dy && pwally+dy<=yh))
|
||||
{
|
||||
pwallstate = 0;
|
||||
tilemap[pwallx][pwally] = oldtile;
|
||||
return;
|
||||
}
|
||||
actorat[pwallx+dx][pwally+dy] = (objtype *)(uintptr_t) (tilemap[pwallx+dx][pwally+dy] = oldtile);
|
||||
tilemap[pwallx+dx][pwally+dy] = BIT_WALL;
|
||||
}
|
||||
}
|
||||
|
||||
pwallpos = (pwallstate/2)&63;
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,22 @@
|
||||
// WL_ATMOS.H
|
||||
|
||||
#ifndef _WL_ATMOS_H_
|
||||
#define _WL_ATMOS_H_
|
||||
|
||||
#if defined(USE_STARSKY) || defined(USE_RAIN) || defined(USE_SNOW)
|
||||
void Init3DPoints (void);
|
||||
#endif
|
||||
|
||||
#ifdef USE_STARSKY
|
||||
void DrawStarSky (void);
|
||||
#endif
|
||||
|
||||
#ifdef USE_RAIN
|
||||
void DrawRain (void);
|
||||
#endif
|
||||
|
||||
#ifdef USE_SNOW
|
||||
void DrawSnow (void);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
// WL_CLOUDSKY.H
|
||||
|
||||
#if defined(USE_CLOUDSKY) && !defined(_WL_CLOUDSKY_H_)
|
||||
#define _WL_CLOUDSKY_H_
|
||||
|
||||
typedef struct
|
||||
{
|
||||
byte length;
|
||||
int16_t startAndDir;
|
||||
} colormapentry_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
byte numColors;
|
||||
colormapentry_t *entries;
|
||||
} colormap_t;
|
||||
|
||||
|
||||
/*
|
||||
=============================================================================
|
||||
|
||||
CLOUDSKY_T DATA STRUCTURE
|
||||
|
||||
=============================================================================
|
||||
=
|
||||
= The seed defines the look of the sky and every value (0-4294967295)
|
||||
= describes an unique sky. You can play around with these inside the game
|
||||
= when pressing <TAB>+Z in debug mode. There you'll be able to change the
|
||||
= active seed to find a value which is suitable for your needs.
|
||||
=
|
||||
= The speed defines how fast the clouds will move (0-65535)
|
||||
=
|
||||
= The angle defines the move direction (0-359)
|
||||
=
|
||||
= The colorMapIndex selects the color map to be used for this sky definition.
|
||||
= This value can also be chosen with <TAB>+Z
|
||||
=
|
||||
=============================================================================
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t seed;
|
||||
uint16_t speed;
|
||||
uint16_t angle;
|
||||
byte colorMapIndex;
|
||||
} cloudsky_t;
|
||||
|
||||
extern cloudsky_t *curSky;
|
||||
extern colormap_t colorMaps[];
|
||||
extern const int numColorMaps;
|
||||
|
||||
void InitSky (void);
|
||||
void DrawCloudPlanes (void);
|
||||
|
||||
#ifndef USE_FEATUREFLAGS
|
||||
int GetCloudSkyDefID (void);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,444 @@
|
||||
// WL_SCALE.C
|
||||
|
||||
#include "wl_def.h"
|
||||
|
||||
#ifdef USE_SHADING
|
||||
#include "wl_shade.h"
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
=============================================================================
|
||||
|
||||
SPRITE DRAWING ROUTINES
|
||||
|
||||
=============================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
===================
|
||||
=
|
||||
= ScaleLine
|
||||
=
|
||||
= Reconstruct a sprite and draw it
|
||||
=
|
||||
= each vertical line of the shape has a pointer to segment data:
|
||||
= end of segment pixel*2 (0 terminates line)
|
||||
= top of virtual line with segment in proper place
|
||||
= start of segment pixel*2
|
||||
= <repeat>
|
||||
=
|
||||
===================
|
||||
*/
|
||||
|
||||
void ScaleLine (int16_t x, int16_t toppix, fixed fracstep, byte *linesrc, byte *linecmds, byte *curshades)
|
||||
{
|
||||
byte *src,*dest;
|
||||
byte col;
|
||||
int16_t start,end,top;
|
||||
int16_t startpix,endpix;
|
||||
fixed frac;
|
||||
|
||||
for (end = ReadShort(linecmds) >> 1; end; end = ReadShort(linecmds) >> 1)
|
||||
{
|
||||
top = ReadShort(linecmds + 2);
|
||||
start = ReadShort(linecmds + 4) >> 1;
|
||||
|
||||
frac = start * fracstep;
|
||||
|
||||
endpix = (frac >> FRACBITS) + toppix;
|
||||
|
||||
for (src = &linesrc[top + start]; start != end; start++, src++)
|
||||
{
|
||||
startpix = endpix;
|
||||
|
||||
if (startpix >= viewheight)
|
||||
break; // off the bottom of the view area
|
||||
|
||||
frac += fracstep;
|
||||
endpix = (frac >> FRACBITS) + toppix;
|
||||
|
||||
if (endpix < 0)
|
||||
continue; // not into the view area
|
||||
|
||||
if (startpix < 0)
|
||||
startpix = 0; // clip upper boundary
|
||||
|
||||
if (endpix > viewheight)
|
||||
endpix = viewheight; // clip lower boundary
|
||||
|
||||
#ifdef USE_SHADING
|
||||
if (curshades)
|
||||
col = curshades[*src];
|
||||
else
|
||||
#endif
|
||||
col = *src;
|
||||
|
||||
dest = vbuf + ylookup[startpix] + x;
|
||||
|
||||
while (startpix < endpix)
|
||||
{
|
||||
*dest = col;
|
||||
dest += bufferPitch;
|
||||
startpix++;
|
||||
}
|
||||
}
|
||||
|
||||
linecmds += 6; // next segment list
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===================
|
||||
=
|
||||
= ScaleShape
|
||||
=
|
||||
= Draws a compiled shape at [scale] pixels high
|
||||
=
|
||||
===================
|
||||
*/
|
||||
|
||||
void ScaleShape (int xcenter, int shapenum, int height, uint32_t flags)
|
||||
{
|
||||
int i;
|
||||
compshape_t *shape;
|
||||
byte *linesrc,*linecmds;
|
||||
byte *curshades = NULL;
|
||||
int16_t scale,toppix;
|
||||
int16_t x1,x2,actx;
|
||||
fixed frac,fracstep;
|
||||
|
||||
scale = height >> 3; // low three bits are fractional
|
||||
|
||||
if (!scale)
|
||||
return; // too close or far away
|
||||
|
||||
linesrc = PM_GetSpritePage(shapenum);
|
||||
shape = (compshape_t *)linesrc;
|
||||
|
||||
#ifdef USE_SHADING
|
||||
if (flags & FL_FULLBRIGHT)
|
||||
curshades = shadetable[0];
|
||||
else
|
||||
curshades = shadetable[GetShade(height)];
|
||||
#endif
|
||||
|
||||
fracstep = FixedDiv(scale,TEXTURESIZE/2);
|
||||
frac = shape->leftpix * fracstep;
|
||||
|
||||
actx = xcenter - scale;
|
||||
toppix = centery - scale;
|
||||
|
||||
x2 = (frac >> FRACBITS) + actx;
|
||||
|
||||
for (i = shape->leftpix; i <= shape->rightpix; i++)
|
||||
{
|
||||
//
|
||||
// calculate edges of the shape
|
||||
//
|
||||
x1 = x2;
|
||||
|
||||
if (x1 >= viewwidth)
|
||||
break; // off the right side of the view area
|
||||
|
||||
frac += fracstep;
|
||||
x2 = (frac >> FRACBITS) + actx;
|
||||
|
||||
if (x2 < 0)
|
||||
continue; // not into the view area
|
||||
|
||||
if (x1 < 0)
|
||||
x1 = 0; // clip left boundary
|
||||
|
||||
if (x2 > viewwidth)
|
||||
x2 = viewwidth; // clip right boundary
|
||||
|
||||
while (x1 < x2)
|
||||
{
|
||||
if (wallheight[x1] < height)
|
||||
{
|
||||
linecmds = &linesrc[shape->dataofs[i - shape->leftpix]];
|
||||
|
||||
ScaleLine (x1,toppix,fracstep,linesrc,linecmds,curshades);
|
||||
}
|
||||
|
||||
x1++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===================
|
||||
=
|
||||
= SimpleScaleShape
|
||||
=
|
||||
= NO CLIPPING, height in pixels
|
||||
=
|
||||
= Draws a compiled shape at [scale] pixels high
|
||||
=
|
||||
===================
|
||||
*/
|
||||
|
||||
void SimpleScaleShape (int xcenter, int shapenum, int height)
|
||||
{
|
||||
int i;
|
||||
compshape_t *shape;
|
||||
byte *linesrc,*linecmds;
|
||||
int16_t scale,toppix;
|
||||
int16_t x1,x2,actx;
|
||||
fixed frac,fracstep;
|
||||
|
||||
scale = height >> 1;
|
||||
|
||||
linesrc = PM_GetSpritePage(shapenum);
|
||||
shape = (compshape_t *)linesrc;
|
||||
|
||||
fracstep = FixedDiv(scale,TEXTURESIZE/2);
|
||||
frac = shape->leftpix * fracstep;
|
||||
|
||||
actx = xcenter - scale;
|
||||
toppix = centery - scale;
|
||||
|
||||
x2 = (frac >> FRACBITS) + actx;
|
||||
|
||||
for (i = shape->leftpix; i <= shape->rightpix; i++)
|
||||
{
|
||||
//
|
||||
// calculate edges of the shape
|
||||
//
|
||||
x1 = x2;
|
||||
|
||||
frac += fracstep;
|
||||
x2 = (frac >> FRACBITS) + actx;
|
||||
|
||||
while (x1 < x2)
|
||||
{
|
||||
linecmds = &linesrc[shape->dataofs[i - shape->leftpix]];
|
||||
|
||||
ScaleLine (x1,toppix,fracstep,linesrc,linecmds,NULL);
|
||||
|
||||
x1++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_DIR3DSPR
|
||||
|
||||
/*
|
||||
===================
|
||||
=
|
||||
= Scale3DShape
|
||||
=
|
||||
= Draws a compiled 3D shape at [scale1] pixels high
|
||||
=
|
||||
===================
|
||||
*/
|
||||
|
||||
void Scale3DShape (visobj_t *sprite, int x1, int x2, fixed ny1, fixed ny2, fixed nx1, fixed nx2)
|
||||
{
|
||||
int i;
|
||||
compshape_t *shape;
|
||||
byte *linesrc,*linecmds;
|
||||
byte *curshades;
|
||||
int16_t scale1,toppix;
|
||||
int16_t dx,len,slinex;
|
||||
int16_t xpos[TEXTURESIZE + 1];
|
||||
fixed height,dheight,height1,height2;
|
||||
fixed fracstep;
|
||||
fixed dxx,dzz;
|
||||
fixed dxa,dza;
|
||||
|
||||
linesrc = PM_GetSpritePage(sprite->shapenum);
|
||||
shape = (compshape_t *)linesrc;
|
||||
|
||||
len = shape->rightpix - shape->leftpix + 1;
|
||||
|
||||
if (!len)
|
||||
return;
|
||||
|
||||
dxx = (ny2 - ny1) << 8;
|
||||
dzz = (nx2 - nx1) << 8;
|
||||
|
||||
ny1 += dxx >> 9;
|
||||
nx1 += dzz >> 9;
|
||||
|
||||
dxa = -(dxx >> 1);
|
||||
dza = -(dzz >> 1);
|
||||
dxx >>= TEXTURESHIFT;
|
||||
dzz >>= TEXTURESHIFT;
|
||||
dxa += shape->leftpix * dxx;
|
||||
dza += shape->leftpix * dzz;
|
||||
|
||||
xpos[0] = (ny1 + (dxa >> 8)) * scale / (nx1 + (dza >> 8)) + centerx;
|
||||
height1 = heightnumerator / ((nx1 + (dza >> 8)) >> 8);
|
||||
height = (((fixed)height1) << 12) + 2048;
|
||||
|
||||
for (i = 1; i <= len; i++)
|
||||
{
|
||||
dxa += dxx;
|
||||
dza += dzz;
|
||||
xpos[i] = (ny1 + (dxa >> 8)) * scale / (nx1 + (dza >> 8)) + centerx;
|
||||
|
||||
if (xpos[i - 1] > viewwidth)
|
||||
break;
|
||||
}
|
||||
|
||||
len = i - 1;
|
||||
dx = xpos[len] - xpos[0];
|
||||
|
||||
if (!dx)
|
||||
return;
|
||||
|
||||
height2 = heightnumerator / ((nx1 + (dza >> 8)) >> 8);
|
||||
dheight = (((fixed)height2 - (fixed)height1) << 12) / (fixed)dx;
|
||||
|
||||
if (x2 > viewwidth)
|
||||
x2 = viewwidth;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
for (slinex = xpos[i]; slinex < xpos[i + 1] && slinex < x2; slinex++)
|
||||
{
|
||||
height += dheight;
|
||||
|
||||
if (slinex < 0)
|
||||
continue;
|
||||
|
||||
scale1 = height >> 15;
|
||||
|
||||
if (!scale1)
|
||||
continue;
|
||||
|
||||
if (wallheight[slinex] < (height >> 12))
|
||||
{
|
||||
#ifdef USE_SHADING
|
||||
if (sprite->flags & FL_FULLBRIGHT)
|
||||
curshades = shadetable[0];
|
||||
else
|
||||
curshades = shadetable[GetShade(scale1 << 3)];
|
||||
#endif
|
||||
fracstep = FixedDiv(scale1,TEXTURESIZE/2);
|
||||
toppix = centery - scale1;
|
||||
|
||||
linecmds = &linesrc[shape->dataofs[i]];
|
||||
|
||||
ScaleLine (slinex,toppix,fracstep,linesrc,linecmds,curshades);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================
|
||||
=
|
||||
= Transform3DShape
|
||||
=
|
||||
========================
|
||||
*/
|
||||
|
||||
void Transform3DShape (visobj_t *sprite)
|
||||
{
|
||||
#define SIZEADD 1024
|
||||
|
||||
fixed nx1,nx2,ny1,ny2;
|
||||
int viewx1,viewx2;
|
||||
fixed diradd;
|
||||
fixed gy1,gy2,gx,gyt1,gyt2,gxt;
|
||||
fixed gx1,gx2,gy,gxt1,gxt2,gyt;
|
||||
|
||||
//
|
||||
// the following values for "diradd" aren't optimized yet
|
||||
// if you have problems with sprites being visible through wall edges
|
||||
// where they shouldn't, you can try to adjust these values and SIZEADD
|
||||
//
|
||||
switch (sprite->flags & FL_DIR_POS_MASK)
|
||||
{
|
||||
case FL_DIR_POS_FW: diradd = 0x7ff0 + 0x8000; break;
|
||||
case FL_DIR_POS_BW: diradd = -0x7ff0 + 0x8000; break;
|
||||
case FL_DIR_POS_MID: diradd = 0x8000; break;
|
||||
|
||||
default:
|
||||
Quit ("Bad 3D sprite dir at %dx%d (shapenum = %d)",sprite->tilex,sprite->tiley,sprite->shapenum);
|
||||
}
|
||||
|
||||
if (sprite->flags & FL_DIR_VERT_FLAG)
|
||||
{
|
||||
//
|
||||
// translate point to view centered coordinates
|
||||
//
|
||||
gy1 = (((fixed)sprite->tiley) << TILESHIFT) + 0x8000 - viewy - 0x8000L - SIZEADD;
|
||||
gy2 = gy1 + 0x10000L + (2 * SIZEADD);
|
||||
gx = (((fixed)sprite->tilex) << TILESHIFT) + diradd - viewx;
|
||||
|
||||
//
|
||||
// calculate nx
|
||||
//
|
||||
gxt = FixedMul(gx,viewcos);
|
||||
gyt1 = FixedMul(gy1,viewsin);
|
||||
gyt2 = FixedMul(gy2,viewsin);
|
||||
nx1 = gxt - gyt1;
|
||||
nx2 = gxt - gyt2;
|
||||
|
||||
//
|
||||
// calculate ny
|
||||
//
|
||||
gxt = FixedMul(gx,viewsin);
|
||||
gyt1 = FixedMul(gy1,viewcos);
|
||||
gyt2 = FixedMul(gy2,viewcos);
|
||||
ny1 = gyt1 + gxt;
|
||||
ny2 = gyt2 + gxt;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
//
|
||||
// translate point to view centered coordinates
|
||||
//
|
||||
gx1 = (((fixed)sprite->tilex) << TILESHIFT) + 0x8000 - viewx - 0x8000L - SIZEADD;
|
||||
gx2 = gx1 + 0x10000L + (2 * SIZEADD);
|
||||
gy = (((fixed)sprite->tiley) << TILESHIFT) + diradd - viewy;
|
||||
|
||||
//
|
||||
// calculate nx
|
||||
//
|
||||
gxt1 = FixedMul(gx1,viewcos);
|
||||
gxt2 = FixedMul(gx2,viewcos);
|
||||
gyt = FixedMul(gy,viewsin);
|
||||
nx1 = gxt1 - gyt;
|
||||
nx2 = gxt2 - gyt;
|
||||
|
||||
//
|
||||
// calculate ny
|
||||
//
|
||||
gxt1 = FixedMul(gx1,viewsin);
|
||||
gxt2 = FixedMul(gx2,viewsin);
|
||||
gyt = FixedMul(gy,viewcos);
|
||||
ny1 = gyt + gxt1;
|
||||
ny2 = gyt + gxt2;
|
||||
}
|
||||
|
||||
if (nx1 < 0 || nx2 < 0)
|
||||
return; // TODO: Clip on viewplane
|
||||
|
||||
//
|
||||
// calculate perspective ratio
|
||||
//
|
||||
if (nx1 >= 0 && nx1 <= 1792) nx1 = 1792;
|
||||
if (nx1 < 0 && nx1 >= -1792) nx1 = -1792;
|
||||
if (nx2 >= 0 && nx2 <= 1792) nx2 = 1792;
|
||||
if (nx2 < 0 && nx2 >= -1792) nx2 = -1792;
|
||||
|
||||
viewx1 = (int)(centerx + ny1 * scale / nx1);
|
||||
viewx2 = (int)(centerx + ny2 * scale / nx2);
|
||||
|
||||
if (viewx2 < viewx1)
|
||||
Scale3DShape (sprite,viewx2,viewx1,ny2,ny1,nx2,nx1);
|
||||
else
|
||||
Scale3DShape (sprite,viewx1,viewx2,ny1,ny2,nx1,nx2);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,15 @@
|
||||
#if defined(USE_SHADING) && !defined(_WL_SHADE_H_)
|
||||
#define _WL_SHADE_H_
|
||||
|
||||
#define SHADE_COUNT 32
|
||||
|
||||
#define LSHADE_NOSHADING 0xff
|
||||
#define LSHADE_NORMAL 0
|
||||
#define LSHADE_FOG 5
|
||||
|
||||
extern uint8_t shadetable[SHADE_COUNT][256];
|
||||
|
||||
void InitLevelShadeTable();
|
||||
int GetShade(int scale);
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,72 @@
|
||||
// WL_UTILS.C
|
||||
|
||||
#include "wl_utils.h"
|
||||
|
||||
|
||||
/*
|
||||
===================
|
||||
=
|
||||
= safe_malloc
|
||||
=
|
||||
= Wrapper for malloc with a NULL check
|
||||
=
|
||||
===================
|
||||
*/
|
||||
|
||||
void *safe_malloc (size_t size, const char *fname, uint32_t line)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = malloc(size);
|
||||
|
||||
if (!ptr)
|
||||
Quit ("SafeMalloc: Out of memory at %s: line %u",fname,line);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
fixed FixedMul (fixed a, fixed b)
|
||||
{
|
||||
return (fixed)(((int64_t)a * b + 0x8000) >> FRACBITS);
|
||||
}
|
||||
|
||||
fixed FixedDiv (fixed a, fixed b)
|
||||
{
|
||||
int64_t c = ((int64_t)a << FRACBITS) / (int64_t)b;
|
||||
|
||||
return (fixed)c;
|
||||
}
|
||||
|
||||
uint16_t ReadShort (void *ptr)
|
||||
{
|
||||
unsigned value;
|
||||
byte *work;
|
||||
|
||||
work = ptr;
|
||||
value = work[0] | (work[1] << 8);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
uint32_t ReadLong (void *ptr)
|
||||
{
|
||||
uint32_t value;
|
||||
byte *work;
|
||||
|
||||
work = ptr;
|
||||
value = work[0] | (work[1] << 8) | (work[2] << 16) | (work[3] << 24);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
void Error (const char *string)
|
||||
{
|
||||
pmx_error (string); /* Paramix */
|
||||
}
|
||||
|
||||
void Help (const char *string)
|
||||
{
|
||||
pmx_error (string); /* Paramix */
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// WL_UTILS.H
|
||||
|
||||
#ifndef __WL_UTILS_H_
|
||||
#define __WL_UTILS_H_
|
||||
|
||||
#include "wl_def.h"
|
||||
|
||||
#define SafeMalloc(s) safe_malloc ((s),__FILE__,__LINE__)
|
||||
#define FRACBITS 16
|
||||
|
||||
void *safe_malloc (size_t size, const char *fname, uint32_t line);
|
||||
fixed FixedMul (fixed a, fixed b);
|
||||
fixed FixedDiv (fixed a, fixed b);
|
||||
|
||||
uint16_t ReadShort (void *ptr);
|
||||
uint32_t ReadLong (void *ptr);
|
||||
|
||||
void Error (const char *string);
|
||||
void Help (const char *string);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,52 @@
|
||||
RGB( 0, 0, 0),RGB( 0, 0, 42),RGB( 0, 42, 0),RGB( 0, 42, 42),RGB( 42, 0, 0),
|
||||
RGB( 42, 0, 42),RGB( 42, 21, 0),RGB( 42, 42, 42),RGB( 21, 21, 21),RGB( 21, 21, 63),
|
||||
RGB( 21, 63, 21),RGB( 21, 63, 63),RGB( 63, 21, 21),RGB( 63, 21, 63),RGB( 63, 63, 21),
|
||||
RGB( 63, 63, 63),RGB( 59, 59, 59),RGB( 55, 55, 55),RGB( 52, 52, 52),RGB( 48, 48, 48),
|
||||
RGB( 45, 45, 45),RGB( 42, 42, 42),RGB( 38, 38, 38),RGB( 35, 35, 35),RGB( 31, 31, 31),
|
||||
RGB( 28, 28, 28),RGB( 25, 25, 25),RGB( 21, 21, 21),RGB( 18, 18, 18),RGB( 14, 14, 14),
|
||||
RGB( 11, 11, 11),RGB( 8, 8, 8),RGB( 63, 0, 0),RGB( 59, 0, 0),RGB( 56, 0, 0),
|
||||
RGB( 53, 0, 0),RGB( 50, 0, 0),RGB( 47, 0, 0),RGB( 44, 0, 0),RGB( 41, 0, 0),
|
||||
RGB( 38, 0, 0),RGB( 34, 0, 0),RGB( 31, 0, 0),RGB( 28, 0, 0),RGB( 25, 0, 0),
|
||||
RGB( 22, 0, 0),RGB( 19, 0, 0),RGB( 16, 0, 0),RGB( 63, 54, 54),RGB( 63, 46, 46),
|
||||
RGB( 63, 39, 39),RGB( 63, 31, 31),RGB( 63, 23, 23),RGB( 63, 16, 16),RGB( 63, 8, 8),
|
||||
RGB( 63, 0, 0),RGB( 63, 42, 23),RGB( 63, 38, 16),RGB( 63, 34, 8),RGB( 63, 30, 0),
|
||||
RGB( 57, 27, 0),RGB( 51, 24, 0),RGB( 45, 21, 0),RGB( 39, 19, 0),RGB( 63, 63, 54),
|
||||
RGB( 63, 63, 46),RGB( 63, 63, 39),RGB( 63, 63, 31),RGB( 63, 62, 23),RGB( 63, 61, 16),
|
||||
RGB( 63, 61, 8),RGB( 63, 61, 0),RGB( 57, 54, 0),RGB( 51, 49, 0),RGB( 45, 43, 0),
|
||||
RGB( 39, 39, 0),RGB( 33, 33, 0),RGB( 28, 27, 0),RGB( 22, 21, 0),RGB( 16, 16, 0),
|
||||
RGB( 52, 63, 23),RGB( 49, 63, 16),RGB( 45, 63, 8),RGB( 40, 63, 0),RGB( 36, 57, 0),
|
||||
RGB( 32, 51, 0),RGB( 29, 45, 0),RGB( 24, 39, 0),RGB( 54, 63, 54),RGB( 47, 63, 46),
|
||||
RGB( 39, 63, 39),RGB( 32, 63, 31),RGB( 24, 63, 23),RGB( 16, 63, 16),RGB( 8, 63, 8),
|
||||
RGB( 0, 63, 0),RGB( 0, 63, 0),RGB( 0, 59, 0),RGB( 0, 56, 0),RGB( 0, 53, 0),
|
||||
RGB( 1, 50, 0),RGB( 1, 47, 0),RGB( 1, 44, 0),RGB( 1, 41, 0),RGB( 1, 38, 0),
|
||||
RGB( 1, 34, 0),RGB( 1, 31, 0),RGB( 1, 28, 0),RGB( 1, 25, 0),RGB( 1, 22, 0),
|
||||
RGB( 1, 19, 0),RGB( 1, 16, 0),RGB( 54, 63, 63),RGB( 46, 63, 63),RGB( 39, 63, 63),
|
||||
RGB( 31, 63, 62),RGB( 23, 63, 63),RGB( 16, 63, 63),RGB( 8, 63, 63),RGB( 0, 63, 63),
|
||||
RGB( 0, 57, 57),RGB( 0, 51, 51),RGB( 0, 45, 45),RGB( 0, 39, 39),RGB( 0, 33, 33),
|
||||
RGB( 0, 28, 28),RGB( 0, 22, 22),RGB( 0, 16, 16),RGB( 23, 47, 63),RGB( 16, 44, 63),
|
||||
RGB( 8, 42, 63),RGB( 0, 39, 63),RGB( 0, 35, 57),RGB( 0, 31, 51),RGB( 0, 27, 45),
|
||||
RGB( 0, 23, 39),RGB( 54, 54, 63),RGB( 46, 47, 63),RGB( 39, 39, 63),RGB( 31, 32, 63),
|
||||
RGB( 23, 24, 63),RGB( 16, 16, 63),RGB( 8, 9, 63),RGB( 0, 1, 63),RGB( 0, 0, 63),
|
||||
RGB( 0, 0, 59),RGB( 0, 0, 56),RGB( 0, 0, 53),RGB( 0, 0, 50),RGB( 0, 0, 47),
|
||||
RGB( 0, 0, 44),RGB( 0, 0, 41),RGB( 0, 0, 38),RGB( 0, 0, 34),RGB( 0, 0, 31),
|
||||
RGB( 0, 0, 28),RGB( 0, 0, 25),RGB( 0, 0, 22),RGB( 0, 0, 19),RGB( 0, 0, 16),
|
||||
RGB( 10, 10, 10),RGB( 63, 56, 13),RGB( 63, 53, 9),RGB( 63, 51, 6),RGB( 63, 48, 2),
|
||||
RGB( 63, 45, 0),RGB( 45, 8, 63),RGB( 42, 0, 63),RGB( 38, 0, 57),RGB( 32, 0, 51),
|
||||
RGB( 29, 0, 45),RGB( 24, 0, 39),RGB( 20, 0, 33),RGB( 17, 0, 28),RGB( 13, 0, 22),
|
||||
RGB( 10, 0, 16),RGB( 63, 54, 63),RGB( 63, 46, 63),RGB( 63, 39, 63),RGB( 63, 31, 63),
|
||||
RGB( 63, 23, 63),RGB( 63, 16, 63),RGB( 63, 8, 63),RGB( 63, 0, 63),RGB( 56, 0, 57),
|
||||
RGB( 50, 0, 51),RGB( 45, 0, 45),RGB( 39, 0, 39),RGB( 33, 0, 33),RGB( 27, 0, 28),
|
||||
RGB( 22, 0, 22),RGB( 16, 0, 16),RGB( 63, 58, 55),RGB( 63, 56, 52),RGB( 63, 54, 49),
|
||||
RGB( 63, 53, 47),RGB( 63, 51, 44),RGB( 63, 49, 41),RGB( 63, 47, 39),RGB( 63, 46, 36),
|
||||
RGB( 63, 44, 32),RGB( 63, 41, 28),RGB( 63, 39, 24),RGB( 60, 37, 23),RGB( 58, 35, 22),
|
||||
RGB( 55, 34, 21),RGB( 52, 32, 20),RGB( 50, 31, 19),RGB( 47, 30, 18),RGB( 45, 28, 17),
|
||||
RGB( 42, 26, 16),RGB( 40, 25, 15),RGB( 39, 24, 14),RGB( 36, 23, 13),RGB( 34, 22, 12),
|
||||
RGB( 32, 20, 11),RGB( 29, 19, 10),RGB( 27, 18, 9),RGB( 23, 16, 8),RGB( 21, 15, 7),
|
||||
RGB( 18, 14, 6),RGB( 16, 12, 6),RGB( 14, 11, 5),RGB( 10, 8, 3),RGB( 24, 0, 25),
|
||||
RGB( 0, 25, 25),RGB( 0, 24, 24),RGB( 0, 0, 7),RGB( 0, 0, 11),RGB( 12, 9, 4),
|
||||
RGB( 18, 0, 18),RGB( 20, 0, 20),RGB( 0, 0, 13),RGB( 7, 7, 7),RGB( 19, 19, 19),
|
||||
RGB( 23, 23, 23),RGB( 16, 16, 16),RGB( 12, 12, 12),RGB( 13, 13, 13),RGB( 54, 61, 61),
|
||||
RGB( 46, 58, 58),RGB( 39, 55, 55),RGB( 29, 50, 50),RGB( 18, 48, 48),RGB( 8, 45, 45),
|
||||
RGB( 8, 44, 44),RGB( 0, 41, 41),RGB( 0, 38, 38),RGB( 0, 35, 35),RGB( 0, 33, 33),
|
||||
RGB( 0, 31, 31),RGB( 0, 30, 30),RGB( 0, 29, 29),RGB( 0, 28, 28),RGB( 0, 27, 27),
|
||||
RGB( 38, 0, 34)
|
||||
Reference in new issue
Block a user