Subversion Repositories eduke32

Compare Revisions

Ignore whitespace Rev 1204 → Rev 1205

/polymer/eduke32/build/include/a.h
6,91 → 6,93
#ifndef __a_h__
#define __a_h__
 
#include "compat.h"
 
#if defined(__WATCOMC__) && !defined(NOASM)
 
extern int mmxoverlay();
extern int32_t mmxoverlay();
#pragma aux mmxoverlay modify [eax ebx ecx edx];
extern int sethlinesizes(int,int,int);
extern int32_t sethlinesizes(int32_t,int32_t,int32_t);
#pragma aux sethlinesizes parm [eax][ebx][ecx];
extern int setpalookupaddress(char *);
extern int32_t setpalookupaddress(char *);
#pragma aux setpalookupaddress parm [eax];
extern int setuphlineasm4(int,int);
extern int32_t setuphlineasm4(int32_t,int32_t);
#pragma aux setuphlineasm4 parm [eax][ebx];
extern int hlineasm4(int,int,int,int,int,int);
extern int32_t hlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux hlineasm4 parm [eax][ebx][ecx][edx][esi][edi];
extern int setuprhlineasm4(int,int,int,int,int,int);
extern int32_t setuprhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux setuprhlineasm4 parm [eax][ebx][ecx][edx][esi][edi];
extern int rhlineasm4(int,int,int,int,int,int);
extern int32_t rhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux rhlineasm4 parm [eax][ebx][ecx][edx][esi][edi];
extern int setuprmhlineasm4(int,int,int,int,int,int);
extern int32_t setuprmhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux setuprmhlineasm4 parm [eax][ebx][ecx][edx][esi][edi];
extern int rmhlineasm4(int,int,int,int,int,int);
extern int32_t rmhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux rmhlineasm4 parm [eax][ebx][ecx][edx][esi][edi];
extern int setupqrhlineasm4(int,int,int,int,int,int);
extern int32_t setupqrhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux setupqrhlineasm4 parm [eax][ebx][ecx][edx][esi][edi];
extern int qrhlineasm4(int,int,int,int,int,int);
extern int32_t qrhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux qrhlineasm4 parm [eax][ebx][ecx][edx][esi][edi];
extern int setvlinebpl(int);
extern int32_t setvlinebpl(int32_t);
#pragma aux setvlinebpl parm [eax];
extern int fixtransluscence(int);
extern int32_t fixtransluscence(int32_t);
#pragma aux fixtransluscence parm [eax];
extern int prevlineasm1(int,int,int,int,int,int);
extern int32_t prevlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux prevlineasm1 parm [eax][ebx][ecx][edx][esi][edi];
extern int vlineasm1(int,int,int,int,int,int);
extern int32_t vlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux vlineasm1 parm [eax][ebx][ecx][edx][esi][edi];
extern int setuptvlineasm(int);
extern int32_t setuptvlineasm(int32_t);
#pragma aux setuptvlineasm parm [eax];
extern int tvlineasm1(int,int,int,int,int,int);
extern int32_t tvlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tvlineasm1 parm [eax][ebx][ecx][edx][esi][edi];
extern int setuptvlineasm2(int,int,int);
extern int32_t setuptvlineasm2(int32_t,int32_t,int32_t);
#pragma aux setuptvlineasm2 parm [eax][ebx][ecx];
extern int tvlineasm2(int,int,int,int,int,int);
extern int32_t tvlineasm2(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tvlineasm2 parm [eax][ebx][ecx][edx][esi][edi];
extern int mvlineasm1(int,int,int,int,int,int);
extern int32_t mvlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux mvlineasm1 parm [eax][ebx][ecx][edx][esi][edi];
extern int setupvlineasm(int);
extern int32_t setupvlineasm(int32_t);
#pragma aux setupvlineasm parm [eax];
extern int vlineasm4(int,int);
extern int32_t vlineasm4(int32_t,int32_t);
#pragma aux vlineasm4 parm [ecx][edi] modify [eax ebx ecx edx esi edi];
extern int setupmvlineasm(int);
extern int32_t setupmvlineasm(int32_t);
#pragma aux setupmvlineasm parm [eax];
extern int mvlineasm4(int,int);
extern int32_t mvlineasm4(int32_t,int32_t);
#pragma aux mvlineasm4 parm [ecx][edi] modify [eax ebx ecx edx esi edi];
extern void setupspritevline(int,int,int,int,int,int);
extern void setupspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux setupspritevline parm [eax][ebx][ecx][edx][esi][edi];
extern void spritevline(int,int,int,int,int,int);
extern void spritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux spritevline parm [eax][ebx][ecx][edx][esi][edi];
extern void msetupspritevline(int,int,int,int,int,int);
extern void msetupspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux msetupspritevline parm [eax][ebx][ecx][edx][esi][edi];
extern void mspritevline(int,int,int,int,int,int);
extern void mspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux mspritevline parm [eax][ebx][ecx][edx][esi][edi];
extern void tsetupspritevline(int,int,int,int,int,int);
extern void tsetupspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tsetupspritevline parm [eax][ebx][ecx][edx][esi][edi];
extern void tspritevline(int,int,int,int,int,int);
extern void tspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tspritevline parm [eax][ebx][ecx][edx][esi][edi];
extern int mhline(int,int,int,int,int,int);
extern int32_t mhline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux mhline parm [eax][ebx][ecx][edx][esi][edi];
extern int mhlineskipmodify(int,int,int,int,int,int);
extern int32_t mhlineskipmodify(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux mhlineskipmodify parm [eax][ebx][ecx][edx][esi][edi];
extern int msethlineshift(int,int);
extern int32_t msethlineshift(int32_t,int32_t);
#pragma aux msethlineshift parm [eax][ebx];
extern int thline(int,int,int,int,int,int);
extern int32_t thline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux thline parm [eax][ebx][ecx][edx][esi][edi];
extern int thlineskipmodify(int,int,int,int,int,int);
extern int32_t thlineskipmodify(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux thlineskipmodify parm [eax][ebx][ecx][edx][esi][edi];
extern int tsethlineshift(int,int);
extern int32_t tsethlineshift(int32_t,int32_t);
#pragma aux tsethlineshift parm [eax][ebx];
extern int setupslopevlin(int,int,int);
extern int32_t setupslopevlin(int32_t,int32_t,int32_t);
#pragma aux setupslopevlin parm [eax][ebx][ecx] modify [edx];
extern int slopevlin(int,int,int,int,int,int);
extern int32_t slopevlin(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux slopevlin parm [eax][ebx][ecx][edx][esi][edi];
extern int settransnormal();
extern int32_t settransnormal();
#pragma aux settransnormal parm;
extern int settransreverse();
extern int32_t settransreverse();
#pragma aux settransreverse parm;
extern int setupdrawslab(int,int);
extern int32_t setupdrawslab(int32_t,int32_t);
#pragma aux setupdrawslab parm [eax][ebx];
extern int drawslab(int,int,int,int,int,int);
extern int32_t drawslab(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux drawslab parm [eax][ebx][ecx][edx][esi][edi];
 
#elif defined(__GNUC__) && defined(__i386__) && !defined(NOASM) // __WATCOMC__
99,95 → 101,95
#define __cdecl
#endif
 
extern int __cdecl mmxoverlay();
extern int __cdecl sethlinesizes(int,int,int);
extern int __cdecl setpalookupaddress(char *);
extern int __cdecl setuphlineasm4(int,int);
extern int __cdecl hlineasm4(int,int,int,int,int,int);
extern int __cdecl setuprhlineasm4(int,int,int,int,int,int);
extern int __cdecl rhlineasm4(int,int,int,int,int,int);
extern int __cdecl setuprmhlineasm4(int,int,int,int,int,int);
extern int __cdecl rmhlineasm4(int,int,int,int,int,int);
extern int __cdecl setupqrhlineasm4(int,int,int,int,int,int);
extern int __cdecl qrhlineasm4(int,int,int,int,int,int);
extern int __cdecl setvlinebpl(int);
extern int __cdecl fixtransluscence(int);
extern int __cdecl prevlineasm1(int,int,int,int,int,int);
extern int __cdecl vlineasm1(int,int,int,int,int,int);
extern int __cdecl setuptvlineasm(int);
extern int __cdecl tvlineasm1(int,int,int,int,int,int);
extern int __cdecl setuptvlineasm2(int,int,int);
extern int __cdecl tvlineasm2(int,int,int,int,int,int);
extern int __cdecl mvlineasm1(int,int,int,int,int,int);
extern int __cdecl setupvlineasm(int);
extern int __cdecl vlineasm4(int,int);
extern int __cdecl setupmvlineasm(int);
extern int __cdecl mvlineasm4(int,int);
extern int __cdecl setupspritevline(int,int,int,int,int,int);
extern int __cdecl spritevline(int,int,int,int,int,int);
extern int __cdecl msetupspritevline(int,int,int,int,int,int);
extern int __cdecl mspritevline(int,int,int,int,int,int);
extern int __cdecl tsetupspritevline(int,int,int,int,int,int);
extern int __cdecl tspritevline(int,int,int,int,int,int);
extern int __cdecl mhline(int,int,int,int,int,int);
extern int __cdecl mhlineskipmodify(int,int,int,int,int,int);
extern int __cdecl msethlineshift(int,int);
extern int __cdecl thline(int,int,int,int,int,int);
extern int __cdecl thlineskipmodify(int,int,int,int,int,int);
extern int __cdecl tsethlineshift(int,int);
extern int __cdecl setupslopevlin(int,int,int);
extern int __cdecl slopevlin(int,int,int,int,int,int);
extern int __cdecl settransnormal();
extern int __cdecl settransreverse();
extern int __cdecl setupdrawslab(int,int);
extern int __cdecl drawslab(int,int,int,int,int,int);
extern void __cdecl stretchhline(int,int,int,int,int,int);
extern int32_t __cdecl mmxoverlay();
extern int32_t __cdecl sethlinesizes(int32_t,int32_t,int32_t);
extern int32_t __cdecl setpalookupaddress(char *);
extern int32_t __cdecl setuphlineasm4(int32_t,int32_t);
extern int32_t __cdecl hlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl setuprhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl rhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl setuprmhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl rmhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl setupqrhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl qrhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl setvlinebpl(int32_t);
extern int32_t __cdecl fixtransluscence(int32_t);
extern int32_t __cdecl prevlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl vlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl setuptvlineasm(int32_t);
extern int32_t __cdecl tvlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl setuptvlineasm2(int32_t,int32_t,int32_t);
extern int32_t __cdecl tvlineasm2(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl mvlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl setupvlineasm(int32_t);
extern int32_t __cdecl vlineasm4(int32_t,int32_t);
extern int32_t __cdecl setupmvlineasm(int32_t);
extern int32_t __cdecl mvlineasm4(int32_t,int32_t);
extern int32_t __cdecl setupspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl spritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl msetupspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl mspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl tsetupspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl tspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl mhline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl mhlineskipmodify(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl msethlineshift(int32_t,int32_t);
extern int32_t __cdecl thline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl thlineskipmodify(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl tsethlineshift(int32_t,int32_t);
extern int32_t __cdecl setupslopevlin(int32_t,int32_t,int32_t);
extern int32_t __cdecl slopevlin(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t __cdecl settransnormal();
extern int32_t __cdecl settransreverse();
extern int32_t __cdecl setupdrawslab(int32_t,int32_t);
extern int32_t __cdecl drawslab(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern void __cdecl stretchhline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
 
#elif defined(_MSC_VER) && !defined(NOASM) // __GNUC__ && __i386__
 
extern int _cdecl mmxoverlay();
extern int _cdecl sethlinesizes(int,int,int);
extern int _cdecl setpalookupaddress(char *);
extern int _cdecl setuphlineasm4(int,int);
extern int _cdecl hlineasm4(int,int,int,int,int,int);
extern int _cdecl setuprhlineasm4(int,int,int,int,int,int);
extern int _cdecl rhlineasm4(int,int,int,int,int,int);
extern int _cdecl setuprmhlineasm4(int,int,int,int,int,int);
extern int _cdecl rmhlineasm4(int,int,int,int,int,int);
extern int _cdecl setupqrhlineasm4(int,int,int,int,int,int);
extern int _cdecl qrhlineasm4(int,int,int,int,int,int);
extern int _cdecl setvlinebpl(int);
extern int _cdecl fixtransluscence(int);
extern int _cdecl prevlineasm1(int,int,int,int,int,int);
extern int _cdecl vlineasm1(int,int,int,int,int,int);
extern int _cdecl setuptvlineasm(int);
extern int _cdecl tvlineasm1(int,int,int,int,int,int);
extern int _cdecl setuptvlineasm2(int,int,int);
extern int _cdecl tvlineasm2(int,int,int,int,int,int);
extern int _cdecl mvlineasm1(int,int,int,int,int,int);
extern int _cdecl setupvlineasm(int);
extern int _cdecl vlineasm4(int,int);
extern int _cdecl setupmvlineasm(int);
extern int _cdecl mvlineasm4(int,int);
extern int _cdecl setupspritevline(int,int,int,int,int,int);
extern int _cdecl spritevline(int,int,int,int,int,int);
extern int _cdecl msetupspritevline(int,int,int,int,int,int);
extern int _cdecl mspritevline(int,int,int,int,int,int);
extern int _cdecl tsetupspritevline(int,int,int,int,int,int);
extern int _cdecl tspritevline(int,int,int,int,int,int);
extern int _cdecl mhline(int,int,int,int,int,int);
extern int _cdecl mhlineskipmodify(int,int,int,int,int,int);
extern int _cdecl msethlineshift(int,int);
extern int _cdecl thline(int,int,int,int,int,int);
extern int _cdecl thlineskipmodify(int,int,int,int,int,int);
extern int _cdecl tsethlineshift(int,int);
extern int _cdecl setupslopevlin(int,int,int);
extern int _cdecl slopevlin(int,int,int,int,int,int);
extern int _cdecl settransnormal();
extern int _cdecl settransreverse();
extern int _cdecl setupdrawslab(int,int);
extern int _cdecl drawslab(int,int,int,int,int,int);
extern void _cdecl stretchhline(int,int,int,int,int,int);
extern int32_t _cdecl mmxoverlay();
extern int32_t _cdecl sethlinesizes(int32_t,int32_t,int32_t);
extern int32_t _cdecl setpalookupaddress(char *);
extern int32_t _cdecl setuphlineasm4(int32_t,int32_t);
extern int32_t _cdecl hlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t _cdecl setuprhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t _cdecl rhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t _cdecl setuprmhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t _cdecl rmhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t _cdecl setupqrhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t _cdecl qrhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t _cdecl setvlinebpl(int32_t);
extern int32_t _cdecl fixtransluscence(int32_t);
extern int32_t _cdecl prevlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t _cdecl vlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t _cdecl setuptvlineasm(int32_t);
extern int32_t _cdecl tvlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t _cdecl setuptvlineasm2(int32_t,int32_t,int32_t);
extern int32_t _cdecl tvlineasm2(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t _cdecl mvlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t _cdecl setupvlineasm(int32_t);
extern int32_t _cdecl vlineasm4(int32_t,int32_t);
extern int32_t _cdecl setupmvlineasm(int32_t);
extern int32_t _cdecl mvlineasm4(int32_t,int32_t);
extern int32_t _cdecl setupspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t _cdecl spritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t _cdecl msetupspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t _cdecl mspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t _cdecl tsetupspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t _cdecl tspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t _cdecl mhline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t _cdecl mhlineskipmodify(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t _cdecl msethlineshift(int32_t,int32_t);
extern int32_t _cdecl thline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t _cdecl thlineskipmodify(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t _cdecl tsethlineshift(int32_t,int32_t);
extern int32_t _cdecl setupslopevlin(int32_t,int32_t,int32_t);
extern int32_t _cdecl slopevlin(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern int32_t _cdecl settransnormal();
extern int32_t _cdecl settransreverse();
extern int32_t _cdecl setupdrawslab(int32_t,int32_t);
extern int32_t _cdecl drawslab(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
extern void _cdecl stretchhline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
 
#else // _MSC_VER
 
194,46 → 196,46
#define ENGINE_USING_A_C
#include <stdint.h>
 
void setvlinebpl(int dabpl);
void setvlinebpl(int32_t dabpl);
void fixtransluscence(intptr_t datransoff);
void settransnormal(void);
void settransreverse(void);
 
void sethlinesizes(int logx, int logy, intptr_t bufplc);
void sethlinesizes(int32_t logx, int32_t logy, intptr_t bufplc);
void setpalookupaddress(char *paladdr);
void setuphlineasm4(int bxinc, int byinc);
void hlineasm4(int cnt, int skiploadincs, int paloffs, unsigned int by, unsigned int bx, intptr_t p);
void setuphlineasm4(int32_t bxinc, int32_t byinc);
void hlineasm4(int32_t cnt, int32_t skiploadincs, int32_t paloffs, uint32_t by, uint32_t bx, intptr_t p);
 
void setupslopevlin(int logylogx, intptr_t bufplc, int pinc);
void slopevlin(intptr_t p, int i, intptr_t slopaloffs, int cnt, int bx, int by);
void setupslopevlin(int32_t logylogx, intptr_t bufplc, int32_t pinc);
void slopevlin(intptr_t p, int32_t i, intptr_t slopaloffs, int32_t cnt, int32_t bx, int32_t by);
 
void setupvlineasm(int neglogy);
void vlineasm1(int vinc, intptr_t paloffs, int cnt, unsigned int vplc, intptr_t bufplc, intptr_t p);
void setupvlineasm(int32_t neglogy);
void vlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p);
 
void setupmvlineasm(int neglogy);
void mvlineasm1(int vinc, intptr_t paloffs, int cnt, unsigned int vplc, intptr_t bufplc, intptr_t p);
void setupmvlineasm(int32_t neglogy);
void mvlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p);
 
void setuptvlineasm(int neglogy);
void tvlineasm1(int vinc, intptr_t paloffs, int cnt, unsigned int vplc, intptr_t bufplc, intptr_t p);
void setuptvlineasm(int32_t neglogy);
void tvlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p);
 
void msethlineshift(int logx, int logy);
void mhline(intptr_t bufplc, unsigned int bx, int cntup16, int junk, unsigned int by, intptr_t p);
void msethlineshift(int32_t logx, int32_t logy);
void mhline(intptr_t bufplc, uint32_t bx, int32_t cntup16, int32_t junk, uint32_t by, intptr_t p);
 
void tsethlineshift(int logx, int logy);
void thline(intptr_t bufplc, unsigned int bx, int cntup16, int junk, unsigned int by, intptr_t p);
void tsethlineshift(int32_t logx, int32_t logy);
void thline(intptr_t bufplc, uint32_t bx, int32_t cntup16, int32_t junk, uint32_t by, intptr_t p);
 
void setupspritevline(intptr_t paloffs, int bxinc, int byinc, int ysiz);
void spritevline(int bx, int by, int cnt, intptr_t bufplc, intptr_t p);
void setupspritevline(intptr_t paloffs, int32_t bxinc, int32_t byinc, int32_t ysiz);
void spritevline(int32_t bx, int32_t by, int32_t cnt, intptr_t bufplc, intptr_t p);
 
void msetupspritevline(intptr_t paloffs, int bxinc, int byinc, int ysiz);
void mspritevline(int bx, int by, int cnt, intptr_t bufplc, intptr_t p);
void msetupspritevline(intptr_t paloffs, int32_t bxinc, int32_t byinc, int32_t ysiz);
void mspritevline(int32_t bx, int32_t by, int32_t cnt, intptr_t bufplc, intptr_t p);
 
void tsetupspritevline(intptr_t paloffs, int bxinc, int byinc, int ysiz);
void tspritevline(int bx, int by, int cnt, intptr_t bufplc, intptr_t p);
void tsetupspritevline(intptr_t paloffs, int32_t bxinc, int32_t byinc, int32_t ysiz);
void tspritevline(int32_t bx, int32_t by, int32_t cnt, intptr_t bufplc, intptr_t p);
 
void setupdrawslab (int dabpl, intptr_t pal);
void drawslab (int dx, int v, int dy, int vi, intptr_t vptr, intptr_t p);
void stretchhline (intptr_t p0, int u, int cnt, int uinc, intptr_t rptr, intptr_t p);
void setupdrawslab (int32_t dabpl, intptr_t pal);
void drawslab (int32_t dx, int32_t v, int32_t dy, int32_t vi, intptr_t vptr, intptr_t p);
void stretchhline (intptr_t p0, int32_t u, int32_t cnt, int32_t uinc, intptr_t rptr, intptr_t p);
 
void mmxoverlay();
 
/polymer/eduke32/build/include/baselayer.h
12,29 → 12,29
extern "C" {
#endif
 
extern int _buildargc;
extern int32_t _buildargc;
extern const char **_buildargv;
 
extern char quitevent, appactive;
 
extern int vsync;
extern int32_t vsync;
 
// NOTE: these are implemented in game-land so they may be overridden in game specific ways
extern int startwin_open(void);
extern int startwin_close(void);
extern int startwin_puts(const char *);
extern int startwin_settitle(const char *);
extern int startwin_idle(void *);
extern int32_t startwin_open(void);
extern int32_t startwin_close(void);
extern int32_t startwin_puts(const char *);
extern int32_t startwin_settitle(const char *);
extern int32_t startwin_idle(void *);
 
// video
extern int xres, yres, bpp, fullscreen, bytesperline, imageSize;
extern int32_t xres, yres, bpp, fullscreen, bytesperline, imageSize;
extern intptr_t frameplace;
extern char offscreenrendering;
 
extern void (*baselayer_onvideomodechange)(int);
extern void (*baselayer_onvideomodechange)(int32_t);
 
#ifdef USE_OPENGL
extern int osdcmd_glinfo(const osdfuncparm_t *parm);
extern int32_t osdcmd_glinfo(const osdfuncparm_t *parm);
 
struct glinfo {
const char *vendor;
61,7 → 61,7
char dumped;
};
extern struct glinfo glinfo;
extern void setvsync(int sync);
extern void setvsync(int32_t sync);
#endif
 
extern char inputdevices;
69,73 → 69,73
// keys
#define KEYFIFOSIZ 64
extern char keystatus[256], keyfifo[KEYFIFOSIZ], keyfifoplc, keyfifoend;
extern unsigned char keyasciififo[KEYFIFOSIZ], keyasciififoplc, keyasciififoend;
extern char keyasciififo[KEYFIFOSIZ], keyasciififoplc, keyasciififoend;
extern char scantoasc[128];
 
// mouse
extern volatile int mousex, mousey, mouseb;
extern volatile int32_t mousex, mousey, mouseb;
 
// joystick
extern int *joyaxis, *joyhat, joyb;
extern int32_t *joyaxis, *joyhat, joyb;
extern char joyisgamepad, joynumaxes, joynumbuttons, joynumhats;
extern int joyaxespresent;
extern int32_t joyaxespresent;
 
extern int qsetmode;
extern int32_t qsetmode;
 
int initsystem(void);
int32_t initsystem(void);
void uninitsystem(void);
 
extern int flushlogwindow;
extern int32_t flushlogwindow;
void initprintf(const char *, ...);
void debugprintf(const char *,...);
 
int handleevents(void);
int32_t handleevents(void);
extern inline void idle(void);
 
typedef void (*KeyPressCallback)(int,int);
typedef void (*MousePressCallback)(int,int);
typedef void (*JoyPressCallback)(int,int);
int initinput(void);
typedef void (*KeyPressCallback)(int32_t,int32_t);
typedef void (*MousePressCallback)(int32_t,int32_t);
typedef void (*JoyPressCallback)(int32_t,int32_t);
int32_t initinput(void);
void uninitinput(void);
void releaseallbuttons(void);
void setkeypresscallback(void (*callback)(int,int));
void setmousepresscallback(void (*callback)(int,int));
void setjoypresscallback(void (*callback)(int,int));
const unsigned char *getkeyname(int num);
const unsigned char *getjoyname(int what, int num); // what: 0=axis, 1=button, 2=hat
char *strtolower(char *str, int len);
void setkeypresscallback(void (*callback)(int32_t,int32_t));
void setmousepresscallback(void (*callback)(int32_t,int32_t));
void setjoypresscallback(void (*callback)(int32_t,int32_t));
const char *getkeyname(int32_t num);
const char *getjoyname(int32_t what, int32_t num); // what: 0=axis, 1=button, 2=hat
char *strtolower(char *str, int32_t len);
 
unsigned char bgetchar(void);
int bkbhit(void);
char bgetchar(void);
int32_t bkbhit(void);
void bflushchars(void);
 
int initmouse(void);
int32_t initmouse(void);
void uninitmouse(void);
void grabmouse(char a);
void readmousexy(int *x, int *y);
void readmousebstatus(int *b);
void setjoydeadzone(int axis, unsigned short dead, unsigned short satur);
void getjoydeadzone(int axis, unsigned short *dead, unsigned short *satur);
void readmousexy(int32_t *x, int32_t *y);
void readmousebstatus(int32_t *b);
void setjoydeadzone(int32_t axis, uint16_t dead, uint16_t satur);
void getjoydeadzone(int32_t axis, uint16_t *dead, uint16_t *satur);
 
int inittimer(int);
int32_t inittimer(int32_t);
void uninittimer(void);
void sampletimer(void);
unsigned int getticks(void);
int gettimerfreq(void);
uint32_t getticks(void);
int32_t gettimerfreq(void);
void (*installusertimercallback(void (*callback)(void)))(void);
 
int checkvideomode(int *x, int *y, int c, int fs, int forced);
int setvideomode(int x, int y, int c, int fs);
int32_t checkvideomode(int32_t *x, int32_t *y, int32_t c, int32_t fs, int32_t forced);
int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs);
void getvalidmodes(void);
void resetvideomode(void);
 
void begindrawing(void);
void enddrawing(void);
void showframe(int);
void showframe(int32_t);
 
int setpalette(int start, int num);
//int getpalette(int start, int num, char *dapal);
int setgamma(void);
int32_t setpalette(int32_t start, int32_t num);
//int32_t getpalette(int32_t start, int32_t num, char *dapal);
int32_t setgamma(void);
double vid_gamma, vid_contrast, vid_brightness;
 
#define DEFAULT_GAMMA 1.0
142,14 → 142,14
#define DEFAULT_CONTRAST 1.0
#define DEFAULT_BRIGHTNESS 0.0
 
int switchrendermethod(int,int); // 0 = software, 1 = opengl | bool = reinit
int32_t switchrendermethod(int32_t,int32_t); // 0 = software, 1 = opengl | bool = reinit
 
int wm_msgbox(char *name, char *fmt, ...);
int wm_ynbox(char *name, char *fmt, ...);
int32_t wm_msgbox(char *name, char *fmt, ...);
int32_t wm_ynbox(char *name, char *fmt, ...);
void wm_setapptitle(char *name);
 
// baselayer.c
int baselayer_init();
int32_t baselayer_init();
 
void makeasmwriteable(void);
 
/polymer/eduke32/build/include/build.h
95,17 → 95,17
//40 bytes
typedef struct BPACK
{
short wallptr, wallnum;
int ceilingz, floorz;
short ceilingstat, floorstat;
short ceilingpicnum, ceilingheinum;
signed char ceilingshade;
int16_t wallptr, wallnum;
int32_t ceilingz, floorz;
int16_t ceilingstat, floorstat;
int16_t ceilingpicnum, ceilingheinum;
int8_t ceilingshade;
char ceilingpal, ceilingxpanning, ceilingypanning;
short floorpicnum, floorheinum;
signed char floorshade;
int16_t floorpicnum, floorheinum;
int8_t floorshade;
char floorpal, floorxpanning, floorypanning;
char visibility, filler;
short lotag, hitag, extra;
int16_t lotag, hitag, extra;
} sectortype;
 
//cstat:
124,12 → 124,12
//32 bytes
typedef struct BPACK
{
int x, y;
short point2, nextwall, nextsector, cstat;
short picnum, overpicnum;
signed char shade;
int32_t x, y;
int16_t point2, nextwall, nextsector, cstat;
int16_t picnum, overpicnum;
int8_t shade;
char pal, xrepeat, yrepeat, xpanning, ypanning;
short lotag, hitag, extra;
int16_t lotag, hitag, extra;
} walltype;
 
//cstat:
150,25 → 150,25
//44 bytes
typedef struct BPACK
{
int x, y, z;
short cstat, picnum;
signed char shade;
int32_t x, y, z;
int16_t cstat, picnum;
int8_t shade;
char pal, clipdist, filler;
unsigned char xrepeat, yrepeat;
signed char xoffset, yoffset;
short sectnum, statnum;
short ang, owner, xvel, yvel, zvel;
short lotag, hitag, extra;
char xrepeat, yrepeat;
int8_t xoffset, yoffset;
int16_t sectnum, statnum;
int16_t ang, owner, xvel, yvel, zvel;
int16_t lotag, hitag, extra;
} spritetype;
 
typedef struct BPACK {
unsigned int mdanimtims;
short mdanimcur;
short angoff;
short pitch, roll;
int xoff, yoff, zoff;
unsigned char flags;
unsigned char xpanning, ypanning;
uint32_t mdanimtims;
int16_t mdanimcur;
int16_t angoff;
int16_t pitch, roll;
int32_t xoff, yoff, zoff;
char flags;
char xpanning, ypanning;
char filler[1];
spritetype *tspr;
} spriteexttype;
175,8 → 175,8
 
typedef struct BPACK {
float smoothduration;
short mdcurframe, mdoldframe;
short mdsmooth;
int16_t mdcurframe, mdoldframe;
int16_t mdsmooth;
char filler[2];
} spritesmoothtype;
 
188,62 → 188,62
 
EXTERN spriteexttype *spriteext;
EXTERN spritesmoothtype *spritesmooth;
EXTERN int guniqhudid;
EXTERN int32_t guniqhudid;
 
EXTERN sectortype *sector;
EXTERN walltype *wall;
EXTERN short maskwall[MAXWALLSB], maskwallcnt;
EXTERN short thewall[MAXWALLSB];
EXTERN int16_t maskwall[MAXWALLSB], maskwallcnt;
EXTERN int16_t thewall[MAXWALLSB];
EXTERN spritetype *sprite;
EXTERN spritetype *tspriteptr[MAXSPRITESONSCREEN];
 
EXTERN int spritesortcnt;
EXTERN int32_t spritesortcnt;
EXTERN spritetype *tsprite;
 
EXTERN int xdim, ydim, numpages;
EXTERN int yxaspect, viewingrange;
EXTERN int32_t xdim, ydim, numpages;
EXTERN int32_t yxaspect, viewingrange;
EXTERN intptr_t ylookup[MAXYDIM+1];
 
#define MAXVALIDMODES 256
EXTERN int validmodecnt;
EXTERN int32_t validmodecnt;
struct validmode_t {
int xdim,ydim;
int32_t xdim,ydim;
char bpp;
char fs; // bit 0 = fullscreen flag
char filler[2];
int extra; // internal use
int32_t extra; // internal use
};
EXTERN struct validmode_t validmode[MAXVALIDMODES];
 
EXTERN short numsectors, numwalls;
EXTERN int16_t numsectors, numwalls;
EXTERN char display_mirror;
EXTERN /*volatile*/ int totalclock;
EXTERN int numframes, randomseed;
EXTERN short sintable[2048];
EXTERN /*volatile*/ int32_t totalclock;
EXTERN int32_t numframes, randomseed;
EXTERN int16_t sintable[2048];
EXTERN char palette[768];
EXTERN short numpalookups;
EXTERN int16_t numpalookups;
EXTERN char *palookup[MAXPALOOKUPS];
EXTERN char parallaxtype, showinvisibility;
EXTERN int parallaxyoffs, parallaxyscale;
EXTERN int visibility, parallaxvisibility;
EXTERN int32_t parallaxyoffs, parallaxyscale;
EXTERN int32_t visibility, parallaxvisibility;
 
EXTERN int windowx1, windowy1, windowx2, windowy2;
EXTERN short startumost[MAXXDIM], startdmost[MAXXDIM];
EXTERN int32_t windowx1, windowy1, windowx2, windowy2;
EXTERN int16_t startumost[MAXXDIM], startdmost[MAXXDIM];
 
EXTERN short pskyoff[MAXPSKYTILES], pskybits;
EXTERN int16_t pskyoff[MAXPSKYTILES], pskybits;
 
EXTERN short headspritesect[MAXSECTORS+1], headspritestat[MAXSTATUS+1];
EXTERN short prevspritesect[MAXSPRITES], prevspritestat[MAXSPRITES];
EXTERN short nextspritesect[MAXSPRITES], nextspritestat[MAXSPRITES];
EXTERN int16_t headspritesect[MAXSECTORS+1], headspritestat[MAXSTATUS+1];
EXTERN int16_t prevspritesect[MAXSPRITES], prevspritestat[MAXSPRITES];
EXTERN int16_t nextspritesect[MAXSPRITES], nextspritestat[MAXSPRITES];
 
EXTERN short tilesizx[MAXTILES], tilesizy[MAXTILES];
EXTERN int16_t tilesizx[MAXTILES], tilesizy[MAXTILES];
EXTERN char picsiz[MAXTILES];
EXTERN char walock[MAXTILES];
EXTERN int pow2long[32];
EXTERN int numtiles, picanm[MAXTILES];
EXTERN int32_t pow2long[32];
EXTERN int32_t numtiles, picanm[MAXTILES];
EXTERN intptr_t waloff[MAXTILES]; // stores pointers to cache -- SA
 
EXTERN int windowpos, windowx, windowy;
EXTERN int32_t windowpos, windowx, windowy;
 
//These variables are for auto-mapping with the draw2dscreen function.
//When you load a new board, these bits are all set to 0 - since
271,34 → 271,34
EXTERN char editorcolors[256];
 
extern char vgapalette[5*256];
extern unsigned int drawlinepat;
extern uint32_t drawlinepat;
 
extern void faketimerhandler(void);
 
extern char apptitle[256];
typedef struct {
unsigned char r,g,b,f;
char r,g,b,f;
} palette_t;
extern palette_t curpalette[256], curpalettefaded[256], palfadergb;
extern char palfadedelta;
 
extern int dommxoverlay, novoxmips;
extern int32_t dommxoverlay, novoxmips;
 
#ifdef SUPERBUILD
extern int tiletovox[MAXTILES];
extern int usevoxels, voxscale[MAXVOXELS];
extern int32_t tiletovox[MAXTILES];
extern int32_t usevoxels, voxscale[MAXVOXELS];
#endif
#ifdef POLYMOST
extern int usemodels, usehightile;
extern int rendmode;
extern int32_t usemodels, usehightile;
extern int32_t rendmode;
#endif
EXTERN int h_xsize[MAXTILES], h_ysize[MAXTILES];
EXTERN signed char h_xoffs[MAXTILES], h_yoffs[MAXTILES];
EXTERN int32_t h_xsize[MAXTILES], h_ysize[MAXTILES];
EXTERN int8_t h_xoffs[MAXTILES], h_yoffs[MAXTILES];
 
extern char *engineerrstr;
extern char noclip;
 
EXTERN int editorzrange[2];
EXTERN int32_t editorzrange[2];
 
/*************************************************************************
POSITION VARIABLES:
402,83 → 402,83
you call the loadboard function.
***************************************************************************/
 
int preinitengine(void); // a partial setup of the engine used for launch windows
int initengine(void);
int32_t preinitengine(void); // a partial setup of the engine used for launch windows
int32_t initengine(void);
void uninitengine(void);
void initspritelists(void);
int loadboard(char *filename, char fromwhere, int *daposx, int *daposy, int *daposz, short *daang, short *dacursectnum);
int loadmaphack(char *filename);
int saveboard(char *filename, int *daposx, int *daposy, int *daposz, short *daang, short *dacursectnum);
int loadpics(char *filename, int askedsize);
void loadtile(short tilenume);
int qloadkvx(int voxindex, char *filename);
int allocatepermanenttile(short tilenume, int xsiz, int ysiz);
void copytilepiece(int tilenume1, int sx1, int sy1, int xsiz, int ysiz, int tilenume2, int sx2, int sy2);
void makepalookup(int palnum, char *remapbuf, signed char r, signed char g, signed char b, char dastat);
int32_t loadboard(char *filename, char fromwhere, int32_t *daposx, int32_t *daposy, int32_t *daposz, int16_t *daang, int16_t *dacursectnum);
int32_t loadmaphack(char *filename);
int32_t saveboard(char *filename, int32_t *daposx, int32_t *daposy, int32_t *daposz, int16_t *daang, int16_t *dacursectnum);
int32_t loadpics(char *filename, int32_t askedsize);
void loadtile(int16_t tilenume);
int32_t qloadkvx(int32_t voxindex, char *filename);
int32_t allocatepermanenttile(int16_t tilenume, int32_t xsiz, int32_t ysiz);
void copytilepiece(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz, int32_t tilenume2, int32_t sx2, int32_t sy2);
void makepalookup(int32_t palnum, char *remapbuf, int8_t r, int8_t g, int8_t b, char dastat);
void setvgapalette(void);
void setbrightness(char dabrightness, char *dapal, char noapply);
void setpalettefade(char r, char g, char b, char offset);
void squarerotatetile(short tilenume);
void squarerotatetile(int16_t tilenume);
 
int setgamemode(char davidoption, int daxdim, int daydim, int dabpp);
int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t dabpp);
void nextpage(void);
void setview(int x1, int y1, int x2, int y2);
void setaspect(int daxrange, int daaspect);
void setview(int32_t x1, int32_t y1, int32_t x2, int32_t y2);
void setaspect(int32_t daxrange, int32_t daaspect);
void flushperms(void);
 
void plotpixel(int x, int y, char col);
char getpixel(int x, int y);
void setviewtotile(short tilenume, int xsiz, int ysiz);
void plotpixel(int32_t x, int32_t y, char col);
char getpixel(int32_t x, int32_t y);
void setviewtotile(int16_t tilenume, int32_t xsiz, int32_t ysiz);
void setviewback(void);
void preparemirror(int dax, int day, int daz, short daang, int dahoriz, short dawall, short dasector, int *tposx, int *tposy, short *tang);
void preparemirror(int32_t dax, int32_t day, int32_t daz, int16_t daang, int32_t dahoriz, int16_t dawall, int16_t dasector, int32_t *tposx, int32_t *tposy, int16_t *tang);
void completemirror(void);
 
void drawrooms(int daposx, int daposy, int daposz, short daang, int dahoriz, short dacursectnum);
void drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, int16_t daang, int32_t dahoriz, int16_t dacursectnum);
void drawmasks(void);
void clearview(int dacol);
void clearallviews(int dacol);
void drawmapview(int dax, int day, int zoome, short ang);
void rotatesprite(int sx, int sy, int z, short a, short picnum, signed char dashade, char dapalnum, char dastat, int cx1, int cy1, int cx2, int cy2);
void drawline256(int x1, int y1, int x2, int y2, char col);
int printext16(int xpos, int ypos, short col, short backcol, char *name, char fontsize);
void printext256(int xpos, int ypos, short col, short backcol, char *name, char fontsize);
void clearview(int32_t dacol);
void clearallviews(int32_t dacol);
void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang);
void rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, int8_t dashade, char dapalnum, char dastat, int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2);
void drawline256(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col);
int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, char *name, char fontsize);
void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, char *name, char fontsize);
 
int clipmove(int *x, int *y, int *z, short *sectnum, int xvect, int yvect, int walldist, int ceildist, int flordist, unsigned int cliptype);
int clipinsidebox(int x, int y, short wallnum, int walldist);
int clipinsideboxline(int x, int y, int x1, int y1, int x2, int y2, int walldist);
int pushmove(int *x, int *y, int *z, short *sectnum, int walldist, int ceildist, int flordist, unsigned int cliptype);
void getzrange(int x, int y, int z, short sectnum, int *ceilz, int *ceilhit, int *florz, int *florhit, int walldist, unsigned int cliptype);
int hitscan(int xs, int ys, int zs, short sectnum, int vx, int vy, int vz, short *hitsect, short *hitwall, short *hitsprite, int *hitx, int *hity, int *hitz, unsigned int cliptype);
int neartag(int xs, int ys, int zs, short sectnum, short ange, short *neartagsector, short *neartagwall, short *neartagsprite, int *neartaghitdist, int neartagrange, char tagsearch);
int cansee(int x1, int y1, int z1, short sect1, int x2, int y2, int z2, short sect2);
void updatesector(int x, int y, short *sectnum);
void updatesectorz(int x, int y, int z, short *sectnum);
int inside(int x, int y, short sectnum);
void dragpoint(short pointhighlight, int dax, int day);
void setfirstwall(short sectnum, short newfirstwall);
int32_t clipmove(int32_t *x, int32_t *y, int32_t *z, int16_t *sectnum, int32_t xvect, int32_t yvect, int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype);
int32_t clipinsidebox(int32_t x, int32_t y, int16_t wallnum, int32_t walldist);
int32_t clipinsideboxline(int32_t x, int32_t y, int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t walldist);
int32_t pushmove(int32_t *x, int32_t *y, int32_t *z, int16_t *sectnum, int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype);
void getzrange(int32_t x, int32_t y, int32_t z, int16_t sectnum, int32_t *ceilz, int32_t *ceilhit, int32_t *florz, int32_t *florhit, int32_t walldist, uint32_t cliptype);
int32_t hitscan(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int32_t vx, int32_t vy, int32_t vz, int16_t *hitsect, int16_t *hitwall, int16_t *hitsprite, int32_t *hitx, int32_t *hity, int32_t *hitz, uint32_t cliptype);
int32_t neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, int16_t *neartagsector, int16_t *neartagwall, int16_t *neartagsprite, int32_t *neartaghitdist, int32_t neartagrange, char tagsearch);
int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1, int32_t x2, int32_t y2, int32_t z2, int16_t sect2);
void updatesector(int32_t x, int32_t y, int16_t *sectnum);
void updatesectorz(int32_t x, int32_t y, int32_t z, int16_t *sectnum);
int32_t inside(int32_t x, int32_t y, int16_t sectnum);
void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day);
void setfirstwall(int16_t sectnum, int16_t newfirstwall);
 
void getmousevalues(int *mousx, int *mousy, int *bstatus);
int krand(void);
int ksqrt(int num);
int getangle(int xvect, int yvect);
void rotatepoint(int xpivot, int ypivot, int x, int y, short daang, int *x2, int *y2);
int lastwall(short point);
int nextsectorneighborz(short sectnum, int thez, short topbottom, short direction);
int getceilzofslope(short sectnum, int dax, int day);
int getflorzofslope(short sectnum, int dax, int day);
void getzsofslope(short sectnum, int dax, int day, int *ceilz, int *florz);
void alignceilslope(short dasect, int x, int y, int z);
void alignflorslope(short dasect, int x, int y, int z);
int sectorofwall(short theline);
int loopnumofsector(short sectnum, short wallnum);
void getmousevalues(int32_t *mousx, int32_t *mousy, int32_t *bstatus);
int32_t krand(void);
int32_t ksqrt(int32_t num);
int32_t getangle(int32_t xvect, int32_t yvect);
void rotatepoint(int32_t xpivot, int32_t ypivot, int32_t x, int32_t y, int16_t daang, int32_t *x2, int32_t *y2);
int32_t lastwall(int16_t point);
int32_t nextsectorneighborz(int16_t sectnum, int32_t thez, int16_t topbottom, int16_t direction);
int32_t getceilzofslope(int16_t sectnum, int32_t dax, int32_t day);
int32_t getflorzofslope(int16_t sectnum, int32_t dax, int32_t day);
void getzsofslope(int16_t sectnum, int32_t dax, int32_t day, int32_t *ceilz, int32_t *florz);
void alignceilslope(int16_t dasect, int32_t x, int32_t y, int32_t z);
void alignflorslope(int16_t dasect, int32_t x, int32_t y, int32_t z);
int32_t sectorofwall(int16_t theline);
int32_t loopnumofsector(int16_t sectnum, int16_t wallnum);
 
int insertsprite(short sectnum, short statnum);
int deletesprite(short spritenum);
int changespritesect(short spritenum, short newsectnum);
int changespritestat(short spritenum, short newstatnum);
int setsprite(short spritenum, int newx, int newy, int newz);
int32_t insertsprite(int16_t sectnum, int16_t statnum);
int32_t deletesprite(int16_t spritenum);
int32_t changespritesect(int16_t spritenum, int16_t newsectnum);
int32_t changespritestat(int16_t spritenum, int16_t newstatnum);
int32_t setsprite(int16_t spritenum, int32_t newx, int32_t newy, int32_t newz);
 
int screencapture(char *filename, char inverseit);
int32_t screencapture(char *filename, char inverseit);
 
// PLAG: line utility functions
typedef struct s_equation {
488,30 → 488,30
float x, y;
} _point2d;
_equation equation(float x1, float y1, float x2, float y2);
int sameside(_equation* eq, _point2d* p1, _point2d* p2);
int wallvisible(short wallnum);
int32_t sameside(_equation* eq, _point2d* p1, _point2d* p2);
int32_t wallvisible(int16_t wallnum);
 
#ifdef POLYMER
// polymer stuff for the game to provide it with the animatessprites ptr
typedef void (*animatespritesptr)(int, int, int, int);
EXTERN void polymer_setanimatesprites(animatespritesptr, int, int, int, int);
typedef void (*animatespritesptr)(int32_t, int32_t, int32_t, int32_t);
EXTERN void polymer_setanimatesprites(animatespritesptr, int32_t, int32_t, int32_t, int32_t);
#endif
 
#define STATUS2DSIZ 144
void qsetmode640350(void);
void qsetmode640480(void);
void qsetmodeany(int,int);
void qsetmodeany(int32_t,int32_t);
void clear2dscreen(void);
void draw2dgrid(int posxe, int posye, short ange, int zoome, short gride);
void draw2dscreen(int posxe, int posye, short ange, int zoome, short gride);
void drawline16(int x1, int y1, int x2, int y2, char col);
void drawcircle16(int x1, int y1, int r, char col);
void draw2dgrid(int32_t posxe, int32_t posye, int16_t ange, int32_t zoome, int16_t gride);
void draw2dscreen(int32_t posxe, int32_t posye, int16_t ange, int32_t zoome, int16_t gride);
void drawline16(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col);
void drawcircle16(int32_t x1, int32_t y1, int32_t r, char col);
 
int setrendermode(int renderer);
int getrendermode(void);
int32_t setrendermode(int32_t renderer);
int32_t getrendermode(void);
 
#ifdef POLYMOST
void setrollangle(int rolla);
void setrollangle(int32_t rolla);
#endif
 
// pal: pass -1 to invalidate all palettes for the tile, or >=0 for a particular palette
525,73 → 525,73
// bit 6: 33% translucence, using clamping
// bit 7: 67% translucence, using clamping
// clamping is for sprites, repeating is for walls
void invalidatetile(short tilenume, int pal, int how);
void invalidatetile(int16_t tilenume, int32_t pal, int32_t how);
 
int animateoffs(short tilenum, short fakevar);
int32_t animateoffs(int16_t tilenum, int16_t fakevar);
 
void setpolymost2dview(void); // sets up GL for 2D drawing
 
int polymost_drawtilescreen(int tilex, int tiley, int wallnum, int dimen, int tilezoom);
int32_t polymost_drawtilescreen(int32_t tilex, int32_t tiley, int32_t wallnum, int32_t dimen, int32_t tilezoom);
void polymost_glreset(void);
void polymost_precache(int dapicnum, int dapalnum, int datype);
void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype);
 
#if defined(POLYMOST) && defined(USE_OPENGL)
extern int glanisotropy;
extern int glusetexcompr;
extern int gltexfiltermode;
extern int glredbluemode;
extern int glusetexcache, glusetexcachecompression;
extern int glmultisample, glnvmultisamplehint;
extern int glwidescreen, glprojectionhacks;
extern int gltexmaxsize;
extern int32_t glanisotropy;
extern int32_t glusetexcompr;
extern int32_t gltexfiltermode;
extern int32_t glredbluemode;
extern int32_t glusetexcache, glusetexcachecompression;
extern int32_t glmultisample, glnvmultisamplehint;
extern int32_t glwidescreen, glprojectionhacks;
extern int32_t gltexmaxsize;
void gltexapplyprops (void);
void invalidatecache(void);
 
extern int r_depthpeeling, r_peelscount;
extern int r_detailmapping;
extern int r_glowmapping;
extern int r_vertexarrays;
extern int r_vbos;
extern int r_vbocount;
extern int r_animsmoothing;
extern int r_parallaxskyclamping;
extern int r_parallaxskypanning;
extern int r_modelocclusionchecking;
extern int r_fullbrights;
extern int r_downsize;
extern int mdtims, omdtims;
extern int32_t r_depthpeeling, r_peelscount;
extern int32_t r_detailmapping;
extern int32_t r_glowmapping;
extern int32_t r_vertexarrays;
extern int32_t r_vbos;
extern int32_t r_vbocount;
extern int32_t r_animsmoothing;
extern int32_t r_parallaxskyclamping;
extern int32_t r_parallaxskypanning;
extern int32_t r_modelocclusionchecking;
extern int32_t r_fullbrights;
extern int32_t r_downsize;
extern int32_t mdtims, omdtims;
#endif
 
void hicinit(void);
// effect bitset: 1 = greyscale, 2 = invert
void hicsetpalettetint(int palnum, unsigned char r, unsigned char g, unsigned char b, unsigned char effect);
void hicsetpalettetint(int32_t palnum, char r, char g, char b, char effect);
// flags bitset: 1 = don't compress
int hicsetsubsttex(int picnum, int palnum, char *filen, float alphacut, float xscale, float yscale, char flags);
int hicsetskybox(int picnum, int palnum, char *faces[6]);
int hicclearsubst(int picnum, int palnum);
int32_t hicsetsubsttex(int32_t picnum, int32_t palnum, char *filen, float alphacut, float xscale, float yscale, char flags);
int32_t hicsetskybox(int32_t picnum, int32_t palnum, char *faces[6]);
int32_t hicclearsubst(int32_t picnum, int32_t palnum);
 
int Ptile2tile(int tile, int pallet);
int md_loadmodel(const char *fn);
int md_setmisc(int modelid, float scale, int shadeoff, float zadd, int flags);
int md_tilehasmodel(int tilenume, int pal);
int md_defineframe(int modelid, const char *framename, int tilenume, int skinnum, float smoothduration, int pal);
int md_defineanimation(int modelid, const char *framestart, const char *frameend, int fps, int flags);
int md_defineskin(int modelid, const char *skinfn, int palnum, int skinnum, int surfnum, float param);
int md_definehud (int modelid, int tilex, double xadd, double yadd, double zadd, double angadd, int flags);
int md_undefinetile(int tile);
int md_undefinemodel(int modelid);
int32_t Ptile2tile(int32_t tile, int32_t pallet);
int32_t md_loadmodel(const char *fn);
int32_t md_setmisc(int32_t modelid, float scale, int32_t shadeoff, float zadd, int32_t flags);
int32_t md_tilehasmodel(int32_t tilenume, int32_t pal);
int32_t md_defineframe(int32_t modelid, const char *framename, int32_t tilenume, int32_t skinnum, float smoothduration, int32_t pal);
int32_t md_defineanimation(int32_t modelid, const char *framestart, const char *frameend, int32_t fps, int32_t flags);
int32_t md_defineskin(int32_t modelid, const char *skinfn, int32_t palnum, int32_t skinnum, int32_t surfnum, float param);
int32_t md_definehud (int32_t modelid, int32_t tilex, double xadd, double yadd, double zadd, double angadd, int32_t flags);
int32_t md_undefinetile(int32_t tile);
int32_t md_undefinemodel(int32_t modelid);
 
#define MAXPALCONV 200
void clearconv();
void setpalconv(int pal,int pal1,int pal2);
void getpalmap(int *stage,int *pal1,int *pal2);
int checkpalmaps(int pal);
void applypalmap(char *pic, char *palmap, int size, int pal);
void setpalconv(int32_t pal,int32_t pal1,int32_t pal2);
void getpalmap(int32_t *stage,int32_t *pal1,int32_t *pal2);
int32_t checkpalmaps(int32_t pal);
void applypalmap(char *pic, char *palmap, int32_t size, int32_t pal);
 
int loaddefinitionsfile(char *fn);
int32_t loaddefinitionsfile(char *fn);
 
extern int mapversion; // if loadboard() fails with -2 return, try loadoldboard(). if it fails with -2, board is dodgy
int loadoldboard(char *filename, char fromwhere, int *daposx, int *daposy, int *daposz, short *daang, short *dacursectnum);
extern int32_t mapversion; // if loadboard() fails with -2 return, try loadoldboard(). if it fails with -2, board is dodgy
int32_t loadoldboard(char *filename, char fromwhere, int32_t *daposx, int32_t *daposy, int32_t *daposz, int16_t *daang, int16_t *dacursectnum);
 
// Hash functions
 
598,22 → 598,22
typedef struct _hashitem // size is 12/24 bits.
{
char *string;
int key;
int32_t key;
struct _hashitem *next;
} HASH_item;
 
typedef struct
{
int size;
int32_t size;
HASH_item **items;
} HASH_table;
 
void HASH_init(HASH_table *t);
void HASH_free(HASH_table *t);
int HASH_findcase(HASH_table *t, const char *s);
int HASH_find(HASH_table *t, const char *s);
void HASH_replace(HASH_table *t, const char *s, int key);
void HASH_add(HASH_table *t, const char *s, int key);
int32_t HASH_findcase(HASH_table *t, const char *s);
int32_t HASH_find(HASH_table *t, const char *s);
void HASH_replace(HASH_table *t, const char *s, int32_t key);
void HASH_add(HASH_table *t, const char *s, int32_t key);
 
#ifdef _MSC_VER
#pragma pack()
/polymer/eduke32/build/include/cache1d.h
9,26 → 9,26
extern "C" {
#endif
 
void initcache(intptr_t dacachestart, int dacachesize);
void allocache(intptr_t *newhandle, int newbytes, char *newlockptr);
void initcache(intptr_t dacachestart, int32_t dacachesize);
void allocache(intptr_t *newhandle, int32_t newbytes, char *newlockptr);
void suckcache(intptr_t *suckptr);
void agecache(void);
 
extern int pathsearchmode; // 0 = gamefs mode (default), 1 = localfs mode (editor's mode)
int addsearchpath(const char *p);
int findfrompath(const char *fn, char **where);
int openfrompath(const char *fn, int flags, int mode);
extern int32_t pathsearchmode; // 0 = gamefs mode (default), 1 = localfs mode (editor's mode)
int32_t addsearchpath(const char *p);
int32_t findfrompath(const char *fn, char **where);
int32_t openfrompath(const char *fn, int32_t flags, int32_t mode);
BFILE *fopenfrompath(const char *fn, const char *mode);
 
int initgroupfile(char *filename);
void uninitsinglegroupfile(int grphandle);
int32_t initgroupfile(char *filename);
void uninitsinglegroupfile(int32_t grphandle);
void uninitgroupfile(void);
int kopen4load(char *filename, char searchfirst); // searchfirst: 0 = anywhere, 1 = first group, 2 = any group
int kread(int handle, void *buffer, int leng);
int klseek(int handle, int offset, int whence);
int kfilelength(int handle);
int ktell(int handle);
void kclose(int handle);
int32_t kopen4load(char *filename, char searchfirst); // searchfirst: 0 = anywhere, 1 = first group, 2 = any group
int32_t kread(int32_t handle, void *buffer, int32_t leng);
int32_t klseek(int32_t handle, int32_t offset, int32_t whence);
int32_t kfilelength(int32_t handle);
int32_t ktell(int32_t handle);
void kclose(int32_t handle);
 
enum {
CACHE1D_FIND_FILE = 1,
46,15 → 46,15
};
typedef struct _CACHE1D_FIND_REC {
char *name;
int type, source;
int32_t type, source;
struct _CACHE1D_FIND_REC *next, *prev, *usera, *userb;
} CACHE1D_FIND_REC;
void klistfree(CACHE1D_FIND_REC *rec);
CACHE1D_FIND_REC *klistpath(const char *path, const char *mask, int type);
CACHE1D_FIND_REC *klistpath(const char *path, const char *mask, int32_t type);
 
int kdfread(void *buffer, bsize_t dasizeof, bsize_t count, int fil);
int dfread(void *buffer, bsize_t dasizeof, bsize_t count, BFILE *fil);
void kdfwrite(void *buffer, bsize_t dasizeof, bsize_t count, int fil);
int32_t kdfread(void *buffer, bsize_t dasizeof, bsize_t count, int32_t fil);
int32_t dfread(void *buffer, bsize_t dasizeof, bsize_t count, BFILE *fil);
void kdfwrite(void *buffer, bsize_t dasizeof, bsize_t count, int32_t fil);
void dfwrite(void *buffer, bsize_t dasizeof, bsize_t count, BFILE *fil);
 
#ifdef __cplusplus
/polymer/eduke32/build/include/compat.h
197,8 → 197,8
// inline asm using bswap/xchg
# endif
#elif defined B_ENDIAN_C_INLINE
static inline unsigned short B_SWAP16(unsigned short s) { return (s>>8)|(s<<8); }
static inline unsigned int B_SWAP32(unsigned int l) { return ((l>>8)&0xff00)|((l&0xff00)<<8)|(l<<24)|(l>>24); }
static inline uint16_t B_SWAP16(uint16_t s) { return (s>>8)|(s<<8); }
static inline uint32_t B_SWAP32(uint32_t l) { return ((l>>8)&0xff00)|((l&0xff00)<<8)|(l<<24)|(l>>24); }
static inline uint64 B_SWAP64(uint64 l) { return (l>>56)|((l>>40)&0xff00)|((l>>24)&0xff0000)|((l>>8)&0xff000000)|((l&255)<<56)|((l&0xff00)<<40)|((l&0xff0000)<<24)|((l&0xff000000)<<8); }
#endif
 
299,7 → 299,7
 
 
struct Bdirent {
unsigned short namlen;
uint16_t namlen;
char *name;
unsigned mode;
unsigned size;
309,7 → 309,7
 
BDIR* Bopendir(const char *name);
struct Bdirent* Breaddir(BDIR *dir);
int Bclosedir(BDIR *dir);
int32_t Bclosedir(BDIR *dir);
 
 
#ifdef __compat_h_macrodef__
318,8 → 318,8
# define bssize_t ssize_t
#else
typedef void BFILE;
typedef unsigned int bsize_t;
typedef signed int bssize_t;
typedef uint32_t bsize_t;
typedef signed int32_t bssize_t;
#endif
 
 
404,62 → 404,62
 
#else
 
int Brand(void);
int32_t Brand(void);
void *Bmalloc(bsize_t size);
void Bfree(void *ptr);
int Bopen(const char *pathname, int flags, unsigned mode);
int Bclose(int fd);
bssize_t Bwrite(int fd, const void *buf, bsize_t count);
bssize_t Bread(int fd, void *buf, bsize_t count);
int Blseek(int fildes, int offset, int whence);
int32_t Bopen(const char *pathname, int32_t flags, unsigned mode);
int32_t Bclose(int32_t fd);
bssize_t Bwrite(int32_t fd, const void *buf, bsize_t count);
bssize_t Bread(int32_t fd, void *buf, bsize_t count);
int32_t Blseek(int32_t fildes, int32_t offset, int32_t whence);
BFILE *Bfopen(const char *path, const char *mode);
int Bfclose(BFILE *stream);
int Bfeof(BFILE *stream);
int Bfgetc(BFILE *stream);
int32_t Bfclose(BFILE *stream);
int32_t Bfeof(BFILE *stream);
int32_t Bfgetc(BFILE *stream);
void Brewind(BFILE *stream);
char *Bfgets(char *s, int size, BFILE *stream);
int Bfputc(int c, BFILE *stream);
int Bfputs(const char *s, BFILE *stream);
char *Bfgets(char *s, int32_t size, BFILE *stream);
int32_t Bfputc(int32_t c, BFILE *stream);
int32_t Bfputs(const char *s, BFILE *stream);
bsize_t Bfread(void *ptr, bsize_t size, bsize_t nmemb, BFILE *stream);
bsize_t Bfwrite(const void *ptr, bsize_t size, bsize_t nmemb, BFILE *stream);
char *Bstrdup(const char *s);
char *Bstrcpy(char *dest, const char *src);
char *Bstrncpy(char *dest, const char *src, bsize_t n);
int Bstrcmp(const char *s1, const char *s2);
int Bstrncmp(const char *s1, const char *s2, bsize_t n);
int Bstrcasecmp(const char *s1, const char *s2);
int Bstrncasecmp(const char *s1, const char *s2, bsize_t n);
int32_t Bstrcmp(const char *s1, const char *s2);
int32_t Bstrncmp(const char *s1, const char *s2, bsize_t n);
int32_t Bstrcasecmp(const char *s1, const char *s2);
int32_t Bstrncasecmp(const char *s1, const char *s2, bsize_t n);
char *Bstrcat(char *dest, const char *src);
char *Bstrncat(char *dest, const char *src, bsize_t n);
bsize_t Bstrlen(const char *s);
char *Bstrchr(const char *s, int c);
char *Bstrrchr(const char *s, int c);
int Batoi(const char *nptr);
int Batol(const char *nptr);
int int Bstrtol(const char *nptr, char **endptr, int base);
unsigned int int Bstrtoul(const char *nptr, char **endptr, int base);
char *Bstrchr(const char *s, int32_t c);
char *Bstrrchr(const char *s, int32_t c);
int32_t Batoi(const char *nptr);
int32_t Batol(const char *nptr);
int32_t int32_t Bstrtol(const char *nptr, char **endptr, int32_t base);
uint32_t int32_t Bstrtoul(const char *nptr, char **endptr, int32_t base);
void *Bmemcpy(void *dest, const void *src, bsize_t n);
void *Bmemmove(void *dest, const void *src, bsize_t n);
void *Bmemchr(const void *s, int c, bsize_t n);
void *Bmemset(void *s, int c, bsize_t n);
int Bmemcmp(const void *s1, const void *s2, bsize_t n);
int Bprintf(const char *format, ...);
int Bsprintf(char *str, const char *format, ...);
int Bsnprintf(char *str, bsize_t size, const char *format, ...);
int Bvsnprintf(char *str, bsize_t size, const char *format, va_list ap);
void *Bmemchr(const void *s, int32_t c, bsize_t n);
void *Bmemset(void *s, int32_t c, bsize_t n);
int32_t Bmemcmp(const void *s1, const void *s2, bsize_t n);
int32_t Bprintf(const char *format, ...);
int32_t Bsprintf(char *str, const char *format, ...);
int32_t Bsnprintf(char *str, bsize_t size, const char *format, ...);
int32_t Bvsnprintf(char *str, bsize_t size, const char *format, va_list ap);
char *Bgetcwd(char *buf, bsize_t size);
char *Bgetenv(const char *name);
#endif
 
char *Bgethomedir(void);
char *Bgetsupportdir(int global);
unsigned int Bgetsysmemsize(void);
int Bcorrectfilename(char *filename, int removefn);
int Bcanonicalisefilename(char *filename, int removefn);
char *Bgetsupportdir(int32_t global);
uint32_t Bgetsysmemsize(void);
int32_t Bcorrectfilename(char *filename, int32_t removefn);
int32_t Bcanonicalisefilename(char *filename, int32_t removefn);
char *Bgetsystemdrives(void);
int Bfilelength(int fd);
char *Bstrtoken(char *s, char *delim, char **ptrptr, int chop);
int Bwildmatch (const char *i, const char *j);
int32_t Bfilelength(int32_t fd);
char *Bstrtoken(char *s, char *delim, char **ptrptr, int32_t chop);
int32_t Bwildmatch (const char *i, const char *j);
 
#if !defined(_WIN32)
char *Bstrlwr(char *);
/polymer/eduke32/build/include/crc32.h
1,6 → 1,8
#ifndef __crc32_h__
#define __crc32_h__
 
#include "compat.h"
 
#ifdef __cplusplus
extern "C" {
#endif
7,11 → 9,11
 
void initcrc32table(void);
 
unsigned int crc32once(unsigned char *blk, unsigned int len);
uint32_t crc32once(uint8_t *blk, uint32_t len);
 
void crc32init(unsigned int *crcvar);
void crc32block(unsigned int *crcvar, unsigned char *blk, unsigned int len);
unsigned int crc32finish(unsigned int *crcvar);
void crc32init(uint32_t *crcvar);
void crc32block(uint32_t *crcvar, uint8_t *blk, uint32_t len);
uint32_t crc32finish(uint32_t *crcvar);
 
#ifdef __cplusplus
}
/polymer/eduke32/build/include/dynamicgtk.h
6,6 → 6,8
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
 
#include "compat.h"
 
#if !GTK_CHECK_VERSION(2,4,0)
#error You need at least 2.4.0 version of GTK+
#endif
68,9 → 70,9
GdkPixbuf *(*gdk_pixbuf_new_from_data) (const guchar *data,
GdkColorspace colorspace,
gboolean has_alpha,
int bits_per_sample,
int width, int height,
int rowstride,
int32_t bits_per_sample,
int32_t width, int32_t height,
int32_t rowstride,
GdkPixbufDestroyNotify destroy_fn,
gpointer destroy_fn_data);
 
159,7 → 161,7
GtkIconSize size);
 
// gtkmain.h
gboolean (*gtk_init_check) (int *argc,
gboolean (*gtk_init_check) (int32_t *argc,
char ***argv);
 
// gtklabel.h
375,7 → 377,7
};
extern struct _dynamicgtksyms dynamicgtksyms;
 
int dynamicgtk_init(void);
int32_t dynamicgtk_init(void);
void dynamicgtk_uninit(void);
 
#ifndef __dynamicgtkfoo__
/polymer/eduke32/build/include/editor.h
32,28 → 32,28
#define BK_CONSOLE 19
#define NUMBUILDKEYS 20
 
extern int qsetmode;
extern short searchsector, searchwall, searchstat;
extern int zmode, kensplayerheight;
extern short defaultspritecstat;
extern int32_t qsetmode;
extern int16_t searchsector, searchwall, searchstat;
extern int32_t zmode, kensplayerheight;
extern int16_t defaultspritecstat;
 
extern int temppicnum, tempcstat, templotag, temphitag, tempextra;
extern unsigned int temppal, tempvis, tempxrepeat, tempyrepeat;
extern int tempshade, tempxvel, tempyvel, tempzvel;
extern unsigned char somethingintab;
extern int32_t temppicnum, tempcstat, templotag, temphitag, tempextra;
extern uint32_t temppal, tempvis, tempxrepeat, tempyrepeat;
extern int32_t tempshade, tempxvel, tempyvel, tempzvel;
extern char somethingintab;
 
extern unsigned char buildkeys[NUMBUILDKEYS];
extern uint8_t buildkeys[NUMBUILDKEYS];
 
extern int ydim16, xdimgame, ydimgame, bppgame, xdim2d, ydim2d, forcesetup;
extern int unrealedlook, quickmapcycling;
extern int pk_turnaccel,pk_turndecel,pk_uedaccel;
extern int revertCTRL,scrollamount;
extern int autosave;
extern int mlook;
extern short prefixtiles[16];
extern int32_t ydim16, xdimgame, ydimgame, bppgame, xdim2d, ydim2d, forcesetup;
extern int32_t unrealedlook, quickmapcycling;
extern int32_t pk_turnaccel,pk_turndecel,pk_uedaccel;
extern int32_t revertCTRL,scrollamount;
extern int32_t autosave;
extern int32_t mlook;
extern int16_t prefixtiles[16];
 
extern int ExtInit(void);
extern int ExtPreInit(int argc,const char **argv);
extern int32_t ExtInit(void);
extern int32_t ExtPreInit(int32_t argc,const char **argv);
extern void ExtUnInit(void);
extern void ExtPreCheckKeys(void);
#ifdef SUPERBUILD
64,36 → 64,36
extern void ExtLoadMap(const char *mapname);
extern void ExtPreSaveMap(void);
extern void ExtSaveMap(const char *mapname);
extern const char *ExtGetSectorCaption(short sectnum);
extern const char *ExtGetWallCaption(short wallnum);
extern const char *ExtGetSpriteCaption(short spritenum);
extern void ExtShowSectorData(short sectnum);
extern void ExtShowWallData(short wallnum);
extern void ExtShowSpriteData(short spritenum);
extern void ExtEditSectorData(short sectnum);
extern void ExtEditWallData(short wallnum);
extern void ExtEditSpriteData(short spritenum);
extern const char *ExtGetSectorType(int lotag);
extern const char *ExtGetSectorCaption(int16_t sectnum);
extern const char *ExtGetWallCaption(int16_t wallnum);
extern const char *ExtGetSpriteCaption(int16_t spritenum);
extern void ExtShowSectorData(int16_t sectnum);
extern void ExtShowWallData(int16_t wallnum);
extern void ExtShowSpriteData(int16_t spritenum);
extern void ExtEditSectorData(int16_t sectnum);
extern void ExtEditWallData(int16_t wallnum);
extern void ExtEditSpriteData(int16_t spritenum);
extern const char *ExtGetSectorType(int32_t lotag);
 
extern int circlewall;
extern int32_t circlewall;
 
int loadsetup(const char *fn); // from config.c
int writesetup(const char *fn); // from config.c
int32_t loadsetup(const char *fn); // from config.c
int32_t writesetup(const char *fn); // from config.c
 
void editinput(void);
void clearmidstatbar16(void);
 
int _getnumber256(char *namestart, int num, int maxnumber, char sign, void *(func)(int));
int32_t _getnumber256(char *namestart, int32_t num, int32_t maxnumber, char sign, void *(func)(int32_t));
#define getnumber256(namestart, num, maxnumber, sign) _getnumber256(namestart, num, maxnumber, sign, NULL)
int _getnumber16(char *namestart, int num, int maxnumber, char sign, void *(func)(int));
int32_t _getnumber16(char *namestart, int32_t num, int32_t maxnumber, char sign, void *(func)(int32_t));
#define getnumber16(namestart, num, maxnumber, sign) _getnumber16(namestart, num, maxnumber, sign, NULL)
void printmessage256(int x, int y, char *name);
void printmessage256(int32_t x, int32_t y, char *name);
void _printmessage16(const char *fmt, ...);
 
#define printmessage16(fmt, ...) lastpm16time = totalclock, _printmessage16(fmt, ## __VA_ARGS__)
 
void getpoint(int searchxe, int searchye, int *x, int *y);
int getpointhighlight(int xplc, int yplc, int point);
void getpoint(int32_t searchxe, int32_t searchye, int32_t *x, int32_t *y);
int32_t getpointhighlight(int32_t xplc, int32_t yplc, int32_t point);
 
#ifdef _WIN32
#define DEFAULT_GAME_EXEC "eduke32.exe"
/polymer/eduke32/build/include/glbuild.h
307,11 → 307,11
extern BOOL (WINAPI * bwglMakeCurrent)(HDC,HGLRC);
 
extern BOOL (WINAPI * bwglSwapBuffers)(HDC);
extern int (WINAPI * bwglChoosePixelFormat)(HDC,CONST PIXELFORMATDESCRIPTOR*);
extern int (WINAPI * bwglDescribePixelFormat)(HDC,int,UINT,LPPIXELFORMATDESCRIPTOR);
extern int (WINAPI * bwglGetPixelFormat)(HDC);
extern BOOL (WINAPI * bwglSetPixelFormat)(HDC,int,const PIXELFORMATDESCRIPTOR*);
extern BOOL (WINAPI * bwglSwapIntervalEXT)(int);
extern int32_t (WINAPI * bwglChoosePixelFormat)(HDC,CONST PIXELFORMATDESCRIPTOR*);
extern int32_t (WINAPI * bwglDescribePixelFormat)(HDC,int32_t,UINT,LPPIXELFORMATDESCRIPTOR);
extern int32_t (WINAPI * bwglGetPixelFormat)(HDC);
extern BOOL (WINAPI * bwglSetPixelFormat)(HDC,int32_t,const PIXELFORMATDESCRIPTOR*);
extern BOOL (WINAPI * bwglSwapIntervalEXT)(int32_t);
#endif
 
#endif //USE_OPENGL
318,9 → 318,9
 
extern char *gldriver;
 
int loadgldriver(const char *driver);
int loadglextensions(void);
int unloadgldriver(void);
int32_t loadgldriver(const char *driver);
int32_t loadglextensions(void);
int32_t unloadgldriver(void);
 
int loadglulibrary(const char *driver);
int unloadglulibrary(void);
int32_t loadglulibrary(const char *driver);
int32_t unloadglulibrary(void);
/polymer/eduke32/build/include/gtkbits.h
1,9 → 1,9
#ifndef __gtkbits_h__
#define __gtkbits_h__
 
extern void gtkbuild_init(int *argc, char ***argv);
extern void gtkbuild_exit(int r);
extern int gtkbuild_msgbox(char *name, char *msg);
extern int gtkbuild_ynbox(char *name, char *msg);
extern void gtkbuild_init(int32_t *argc, char ***argv);
extern void gtkbuild_exit(int32_t r);
extern int32_t gtkbuild_msgbox(char *name, char *msg);
extern int32_t gtkbuild_ynbox(char *name, char *msg);
 
#endif
/polymer/eduke32/build/include/kplib.h
1,21 → 1,21
//High-level (easy) picture loading function:
extern void kpzload (const char *, intptr_t *, int *, int *, int *);
extern void kpzload (const char *, intptr_t *, int32_t *, int32_t *, int32_t *);
//Low-level PNG/JPG functions:
extern void kpgetdim (const char *, int, int *, int *);
extern int kprender (const char *, int, intptr_t, int, int, int, int, int);
extern void kpgetdim (const char *, int32_t, int32_t *, int32_t *);
extern int32_t kprender (const char *, int32_t, intptr_t, int32_t, int32_t, int32_t, int32_t, int32_t);
 
//ZIP functions:
extern int kzaddstack (const char *);
extern int32_t kzaddstack (const char *);
extern void kzuninit ();
extern int kzopen (const char *);
extern int kzread (void *, int);
extern int kzfilelength ();
extern int kzseek (int, int);
extern int kztell ();
extern int kzgetc ();
extern int kzeof ();
extern int32_t kzopen (const char *);
extern int32_t kzread (void *, int32_t);
extern int32_t kzfilelength ();
extern int32_t kzseek (int32_t, int32_t);
extern int32_t kztell ();
extern int32_t kzgetc ();
extern int32_t kzeof ();
extern void kzclose ();
 
extern void kzfindfilestart (const char *); //pass wildcard string
extern int kzfindfile (char *); //you alloc buf, returns 1:found,0:~found
extern int32_t kzfindfile (char *); //you alloc buf, returns 1:found,0:~found
 
/polymer/eduke32/build/include/lzf.h
72,9 → 72,9
* and lzf_c.c.
*
*/
unsigned int
lzf_compress (const void *const in_data, unsigned int in_len,
void *out_data, unsigned int out_len);
uint32_t
lzf_compress (const void *const in_data, uint32_t in_len,
void *out_data, uint32_t out_len);
 
/*
* Decompress data compressed with some version of the lzf_compress
91,9 → 91,9
*
* This function is very fast, about as fast as a copying loop.
*/
unsigned int
lzf_decompress (const void *const in_data, unsigned int in_len,
void *out_data, unsigned int out_len);
uint32_t
lzf_decompress (const void *const in_data, uint32_t in_len,
void *out_data, uint32_t out_len);
 
#endif
 
/polymer/eduke32/build/include/lzwnew.h
1,2 → 1,2
int lzwcompress (unsigned char *ucompbuf, int ucompleng, unsigned char *compbuf);
int lzwuncompress (unsigned char *compbuf, int compleng, unsigned char *ucompbuf, int ucompleng);
int32_t lzwcompress (char *ucompbuf, int32_t ucompleng, char *compbuf);
int32_t lzwuncompress (char *compbuf, int32_t compleng, char *ucompbuf, int32_t ucompleng);
/polymer/eduke32/build/include/mmulti.h
5,30 → 5,30
 
#define MAXMULTIPLAYERS 16
 
extern int myconnectindex, numplayers;
extern int connecthead, connectpoint2[MAXMULTIPLAYERS];
extern int32_t myconnectindex, numplayers;
extern int32_t connecthead, connectpoint2[MAXMULTIPLAYERS];
extern char syncstate;
extern int natfree; //Addfaz NatFree
extern int32_t natfree; //Addfaz NatFree
 
int initmultiplayersparms(int argc, char **argv);
int initmultiplayerscycle(void);
int32_t initmultiplayersparms(int32_t argc, char **argv);
int32_t initmultiplayerscycle(void);
 
void initmultiplayers(int argc, char **argv);
void setpackettimeout(int datimeoutcount, int daresendagaincount);
void uninitmultiplayers(void);
void mmulti_initmultiplayers(int32_t argc, char **argv);
void mmulti_setpackettimeout(int32_t datimeoutcount, int32_t daresendagaincount);
void mmulti_uninitmultiplayers(void);
void sendlogon(void);
void sendlogoff(void);
int getoutputcirclesize(void);
void setsocket(short newsocket);
void sendpacket(int other, char *bufptr, int messleng);
int getpacket(int *other, char *bufptr);
void flushpackets(void);
void genericmultifunction(int other, char *bufptr, int messleng, int command);
int isvalidipaddress(char *st);
int32_t getoutputcirclesize(void);
void setsocket(int16_t newsocket);
void mmulti_sendpacket(int32_t other, char *bufptr, int32_t messleng);
int32_t mmulti_getpacket(int32_t *other, char *bufptr);
void mmulti_flushpackets(void);
void genericmultifunction(int32_t other, char *bufptr, int32_t messleng, int32_t command);
int32_t isvalidipaddress(char *st);
 
void nfIncCP(void); //Addfaz NatFree
int nfCheckHF (int other); //Addfaz NatFree
int nfCheckCP(int other); //Addfaz NatFree
int32_t nfCheckHF (int32_t other); //Addfaz NatFree
int32_t nfCheckCP(int32_t other); //Addfaz NatFree
 
#endif // __mmulti_h__
 
/polymer/eduke32/build/include/mmulti_unstable.h
1,22 → 1,24
#ifndef _MMULTI_UNSTABLE_H_
#define _MMULTI_UNSTABLE_H_
 
#include "compat.h"
 
void callcommit(void);
void initcrc(void);
int getcrc(char *buffer, int bufleng);
void initmultiplayers(int argc, char **argv);
void sendpacket(int other, char *bufptr, int messleng);
void setpackettimeout(int datimeoutcount, int daresendagaincount);
void uninitmultiplayers(void);
int32_t getcrc(char *buffer, int32_t bufleng);
void mmulti_initmultiplayers(int32_t argc, char **argv);
void mmulti_sendpacket(int32_t other, char *bufptr, int32_t messleng);
void mmulti_setpackettimeout(int32_t datimeoutcount, int32_t daresendagaincount);
void mmulti_uninitmultiplayers(void);
void sendlogon(void);
void sendlogoff(void);
int getoutputcirclesize(void);
void setsocket(int newsocket);
int getpacket(int *other, char *bufptr);
void flushpackets(void);
void genericmultifunction(int other, char *bufptr, int messleng, int command);
int32_t getoutputcirclesize(void);
void setsocket(int32_t newsocket);
int32_t mmulti_getpacket(int32_t *other, char *bufptr);
void mmulti_flushpackets(void);
void genericmultifunction(int32_t other, char *bufptr, int32_t messleng, int32_t command);
 
extern int natfree;
extern int32_t natfree;
 
#endif
 
/polymer/eduke32/build/include/msvc/stdint.h
90,8 → 90,8
typedef __int64 intptr_t;
typedef unsigned __int64 uintptr_t;
#else // _WIN64 ][
typedef int intptr_t;
typedef unsigned int uintptr_t;
typedef int32_t intptr_t;
typedef uint32_t uintptr_t;
#endif // _WIN64 ]
 
// 7.18.1.5 Greatest-width integer types
/polymer/eduke32/build/include/osd.h
7,7 → 7,7
 
 
typedef struct {
int numparms;
int32_t numparms;
const char *name;
const char **parms;
const char *raw;
19,7 → 19,7
struct _symbol *next;
 
const char *help;
int (*func)(const osdfuncparm_t *);
int32_t (*func)(const osdfuncparm_t *);
} symbol_t;
 
symbol_t *symbols;
31,19 → 31,19
#define OSDCMD_OK 0
#define OSDCMD_SHOWHELP 1
 
int OSD_ParsingScript(void);
int32_t OSD_ParsingScript(void);
 
int OSD_OSDKey(void);
int OSD_GetTextMode(void);
void OSD_SetTextMode(int mode);
int32_t OSD_OSDKey(void);
int32_t OSD_GetTextMode(void);
void OSD_SetTextMode(int32_t mode);
 
int OSD_Exec(const char *szScript);
int32_t OSD_Exec(const char *szScript);
 
char *OSD_GetFmt(char *ptr);
char *OSD_GetTextPtr(void);
char *OSD_GetFmtPtr(void);
 
int OSD_GetCols(void);
int32_t OSD_GetCols(void);
 
// initializes things
void OSD_Init(void);
53,42 → 53,42
 
// sets the functions the OSD will call to interrogate the environment
void OSD_SetFunctions(
void (*drawchar)(int,int,char,int,int),
void (*drawstr)(int,int,char*,int,int,int),
void (*drawcursor)(int,int,int,int),
int (*colwidth)(int),
int (*rowheight)(int),
void (*clearbg)(int,int),
int (*gettime)(void),
void (*onshow)(int)
void (*drawchar)(int32_t,int32_t,char,int32_t,int32_t),
void (*drawstr)(int32_t,int32_t,char*,int32_t,int32_t,int32_t),
void (*drawcursor)(int32_t,int32_t,int32_t,int32_t),
int32_t (*colwidth)(int32_t),
int32_t (*rowheight)(int32_t),
void (*clearbg)(int32_t,int32_t),
int32_t (*gettime)(void),
void (*onshow)(int32_t)
);
 
// sets the parameters for presenting the text
void OSD_SetParameters(
int promptshade, int promptpal,
int editshade, int editpal,
int textshade, int textpal
int32_t promptshade, int32_t promptpal,
int32_t editshade, int32_t editpal,
int32_t textshade, int32_t textpal
);
 
// sets the scancode for the key which activates the onscreen display
void OSD_CaptureKey(int sc);
void OSD_CaptureKey(int32_t sc);
 
// handles keyboard input when capturing input. returns 0 if key was handled
// or the scancode if it should be handled by the game.
int OSD_HandleScanCode(int sc, int press);
int OSD_HandleChar(char ch);
int32_t OSD_HandleScanCode(int32_t sc, int32_t press);
int32_t OSD_HandleChar(char ch);
 
// handles the readjustment when screen resolution changes
void OSD_ResizeDisplay(int w,int h);
void OSD_ResizeDisplay(int32_t w,int32_t h);
 
// captures and frees osd input
void OSD_CaptureInput(int cap);
void OSD_CaptureInput(int32_t cap);
 
// sets the console version string
void OSD_SetVersionString(const char *version, int shade, int pal);
void OSD_SetVersionString(const char *version, int32_t shade, int32_t pal);
 
// shows or hides the onscreen display
void OSD_ShowDisplay(int onf);
void OSD_ShowDisplay(int32_t onf);
 
// draw the osd to the screen
void OSD_Draw(void);
101,13 → 101,13
void OSD_DispatchQueued(void);
 
// executes a string
int OSD_Dispatch(const char *cmd);
int32_t OSD_Dispatch(const char *cmd);
 
// registers a function
// name = name of the function
// help = a short help string
// func = the entry point to the function
int OSD_RegisterFunction(const char *name, const char *help, int (*func)(const osdfuncparm_t*));
int32_t OSD_RegisterFunction(const char *name, const char *help, int32_t (*func)(const osdfuncparm_t*));
 
// these correspond to the Duke palettes, so they shouldn't really be here
// ...but I don't care
/polymer/eduke32/build/include/osxbits.h
1,7 → 1,7
#ifndef __osxbits_h__
#define __osxbits_h__
 
int osx_msgbox(char *name, char *msg);
int osx_ynbox(char *name, char *msg);
int32_t osx_msgbox(char *name, char *msg);
int32_t osx_ynbox(char *name, char *msg);
 
#endif
/polymer/eduke32/build/include/polymer.h
33,15 → 33,15
# include <math.h>
 
// CVARS
extern int pr_occlusionculling;
extern int pr_fov;
extern int pr_billboardingmode;
extern int pr_verbosity;
extern int pr_wireframe;
extern int pr_vbos;
extern int pr_gpusmoothing;
extern int32_t pr_occlusionculling;
extern int32_t pr_fov;
extern int32_t pr_billboardingmode;
extern int32_t pr_verbosity;
extern int32_t pr_wireframe;
extern int32_t pr_vbos;
extern int32_t pr_gpusmoothing;
 
extern int glerror;
extern int32_t glerror;
 
// MATERIAL
typedef enum {
94,7 → 94,7
#define PR_INFO_LOG_BUFFER_SIZE 16384
 
typedef struct s_prprogrambit {
int bit;
int32_t bit;
char* vert_def;
char* vert_prog;
char* frag_def;
119,24 → 119,24
GLdouble* verts;
_prplane floor;
_prplane ceil;
short curindice;
int indicescount;
int oldindicescount;
int16_t curindice;
int32_t indicescount;
int32_t oldindicescount;
// stuff
float wallsproffset;
float floorsproffset;
// build sector data
int ceilingz, floorz;
short ceilingstat, floorstat;
short ceilingpicnum, ceilingheinum;
signed char ceilingshade;
int32_t ceilingz, floorz;
int16_t ceilingstat, floorstat;
int16_t ceilingpicnum, ceilingheinum;
int8_t ceilingshade;
char ceilingpal, ceilingxpanning, ceilingypanning;
short floorpicnum, floorheinum;
signed char floorshade;
int16_t floorpicnum, floorheinum;
int8_t floorshade;
char floorpal, floorxpanning, floorypanning;
 
char controlstate; // 1: up to date, 2: just allocated
unsigned int invalidid;
uint32_t invalidid;
} _prsector;
 
typedef struct s_prwall {
148,21 → 148,21
GLfloat* cap;
GLuint stuffvbo;
// build wall data
short cstat, nwallcstat;
short picnum, overpicnum, nwallpicnum;
signed char shade;
int16_t cstat, nwallcstat;
int16_t picnum, overpicnum, nwallpicnum;
int8_t shade;
char pal, xrepeat, yrepeat, xpanning, ypanning;
char nwallxpanning, nwallypanning;
 
 
char underover;
unsigned int invalidid;
uint32_t invalidid;
char controlstate;
} _prwall;
 
typedef struct s_pranimatespritesinfo {
animatespritesptr animatesprites;
int x, y, a, smoothratio;
int32_t x, y, a, smoothratio;
} _pranimatespritesinfo;
 
// LIGHTS
175,8 → 175,8
} prlighttype;
 
typedef struct s_prlight {
int x, y, z, horiz, faderange, range;
short angle, sector;
int32_t x, y, z, horiz, faderange, range;
int16_t angle, sector;
prlighttype type;
} _prlight;
 
183,17 → 183,17
// PROGRAMS
 
// CONTROL
extern int updatesectors;
extern int32_t updatesectors;
 
// EXTERNAL FUNCTIONS
int polymer_init(void);
int32_t polymer_init(void);
void polymer_glinit(void);
void polymer_loadboard(void);
void polymer_drawrooms(int daposx, int daposy, int daposz, short daang, int dahoriz, short dacursectnum);
void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, int16_t daang, int32_t dahoriz, int16_t dacursectnum);
void polymer_drawmasks(void);
void polymer_rotatesprite(int sx, int sy, int z, short a, short picnum, signed char dashade, char dapalnum, char dastat, int cx1, int cy1, int cx2, int cy2);
void polymer_drawmaskwall(int damaskwallcnt);
void polymer_drawsprite(int snum);
void polymer_rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, int8_t dashade, char dapalnum, char dastat, int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2);
void polymer_drawmaskwall(int32_t damaskwallcnt);
void polymer_drawsprite(int32_t snum);
void polymer_resetlights(void);
void polymer_addlight(_prlight light);
 
200,45 → 200,45
# ifdef POLYMER_C
 
// CORE
static void polymer_displayrooms(short sectnum);
static void polymer_drawplane(short sectnum, short wallnum, _prplane* plane, int indicecount);
static void polymer_displayrooms(int16_t sectnum);
static void polymer_drawplane(int16_t sectnum, int16_t wallnum, _prplane* plane, int32_t indicecount);
static void polymer_inb4mirror(GLfloat* buffer, GLdouble* plane);
static void polymer_animatesprites(void);
// SECTORS
static int polymer_initsector(short sectnum);
static int polymer_updatesector(short sectnum);
static int32_t polymer_initsector(int16_t sectnum);
static int32_t polymer_updatesector(int16_t sectnum);
void PR_CALLBACK polymer_tesserror(GLenum error);
void PR_CALLBACK polymer_tessedgeflag(GLenum error);
void PR_CALLBACK polymer_tessvertex(void* vertex, void* sector);
static int polymer_buildfloor(short sectnum);
static void polymer_drawsector(short sectnum);
static int32_t polymer_buildfloor(int16_t sectnum);
static void polymer_drawsector(int16_t sectnum);
// WALLS
static int polymer_initwall(short wallnum);
static void polymer_updatewall(short wallnum);
static void polymer_drawwall(short sectnum, short wallnum);
static int32_t polymer_initwall(int16_t wallnum);
static void polymer_updatewall(int16_t wallnum);
static void polymer_drawwall(int16_t sectnum, int16_t wallnum);
// HSR
static void polymer_buffertoplane(GLfloat* buffer, GLushort* indices, int indicecount, GLdouble* plane);
static void polymer_buffertoplane(GLfloat* buffer, GLushort* indices, int32_t indicecount, GLdouble* plane);
static void polymer_crossproduct(GLfloat* in_a, GLfloat* in_b, GLdouble* out);
static void polymer_pokesector(short sectnum);
static void polymer_pokesector(int16_t sectnum);
static void polymer_extractfrustum(GLdouble* modelview, GLdouble* projection, float* frustum);
static int polymer_portalinfrustum(short wallnum, float* frustum);
static void polymer_scansprites(short sectnum, spritetype* tsprite, int* spritesortcnt);
static int32_t polymer_portalinfrustum(int16_t wallnum, float* frustum);
static void polymer_scansprites(int16_t sectnum, spritetype* tsprite, int32_t* spritesortcnt);
// SKIES
static void polymer_getsky(void);
static void polymer_drawsky(short tilenum);
static void polymer_drawsky(int16_t tilenum);
static void polymer_initartsky(void);
static void polymer_drawartsky(short tilenum);
static void polymer_drawartskyquad(int p1, int p2, GLfloat height);
static void polymer_drawskybox(short tilenum);
static void polymer_drawartsky(int16_t tilenum);
static void polymer_drawartskyquad(int32_t p1, int32_t p2, GLfloat height);
static void polymer_drawskybox(int16_t tilenum);
// MDSPRITES
static void polymer_drawmdsprite(spritetype *tspr);
static void polymer_loadmodelvbos(md3model* m);
// MATERIALS
static void polymer_getscratchmaterial(_prmaterial* material);
static void polymer_getbuildmaterial(_prmaterial* material, short tilenum, char pal, signed char shade);
static int polymer_bindmaterial(_prmaterial material);
static void polymer_unbindmaterial(int programbits);
static void polymer_compileprogram(int programbits);
static void polymer_getbuildmaterial(_prmaterial* material, int16_t tilenum, char pal, int8_t shade);
static int32_t polymer_bindmaterial(_prmaterial material);
static void polymer_unbindmaterial(int32_t programbits);
static void polymer_compileprogram(int32_t programbits);
 
# endif // !POLYMER_C
 
/polymer/eduke32/build/include/polymost.h
7,15 → 7,15
#define CULL_DELAY 2
#define MAXCULLCHECKS 1024
 
extern int lastcullcheck;
extern int32_t lastcullcheck;
extern char cullmodel[MAXSPRITES];
extern int cullcheckcnt;
extern int32_t cullcheckcnt;
 
#define PI 3.14159265358979323
 
typedef struct { unsigned char r, g, b, a; } coltype;
typedef struct { char r, g, b, a; } coltype;
 
extern int rendmode;
extern int32_t rendmode;
extern float gtang;
extern float glox1, gloy1;
extern double gxyaspect, grhalfxdown10x;
24,19 → 24,19
 
struct glfiltermodes {
char *name;
int min,mag;
int32_t min,mag;
};
#define numglfiltermodes 6
extern struct glfiltermodes glfiltermodes[numglfiltermodes];
 
extern const char *TEXCACHEDIR;
void phex(unsigned char v, char *s);
void uploadtexture(int doalloc, int xsiz, int ysiz, int intexfmt, int texfmt, coltype *pic, int tsizx, int tsizy, int dameth);
void polymost_drawsprite(int snum);
void polymost_drawmaskwall(int damaskwallcnt);
void polymost_dorotatesprite(int sx, int sy, int z, short a, short picnum,
signed char dashade, char dapalnum, char dastat, int cx1, int cy1, int cx2, int cy2, int uniqid);
void polymost_fillpolygon(int npoints);
void phex(char v, char *s);
void uploadtexture(int32_t doalloc, int32_t xsiz, int32_t ysiz, int32_t intexfmt, int32_t texfmt, coltype *pic, int32_t tsizx, int32_t tsizy, int32_t dameth);
void polymost_drawsprite(int32_t snum);
void polymost_drawmaskwall(int32_t damaskwallcnt);
void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
int8_t dashade, char dapalnum, char dastat, int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2, int32_t uniqid);
void polymost_fillpolygon(int32_t npoints);
void polymost_initosdfuncs(void);
void polymost_drawrooms(void);
 
43,15 → 43,15
void polymost_glinit(void);
void polymost_glreset(void);
 
void gltexinvalidate(int dapicnum, int dapalnum, int dameth);
void gltexinvalidate(int32_t dapicnum, int32_t dapalnum, int32_t dameth);
void gltexinvalidateall(void);
void gltexinvalidate8(void);
int polymost_printext256(int xpos, int ypos, short col, short backcol, char *name, char fontsize);
int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, char *name, char fontsize);
 
// Depth peeling control
extern int r_curpeel;
extern int32_t r_curpeel;
extern float curpolygonoffset;
extern int peelcompiling;
extern int32_t peelcompiling;
 
// Depth peeling data
extern GLuint ztexture[3];
59,7 → 59,7
extern GLuint *peelfbos;
extern GLuint peelprogram[2];
 
extern int cachefilehandle;
extern int32_t cachefilehandle;
extern FILE *cacheindexptr;
extern HASH_table cacheH;
 
66,8 → 66,8
struct cacheitem_t
{
char name[BMAX_PATH];
int offset;
int len;
int32_t offset;
int32_t len;
struct cacheitem_t *next;
};
 
76,12 → 76,12
extern texcacheindex firstcacheindex;
extern texcacheindex *curcacheindex;
extern texcacheindex *cacheptrs[MAXTILES<<2];
extern int numcacheentries;
extern int32_t numcacheentries;
 
int dxtfilter(int fil, texcachepicture *pict, char *pic, void *midbuf, char *packbuf, unsigned int miplen);
int dedxtfilter(int fil, texcachepicture *pict, char *pic, void *midbuf, char *packbuf, int ispacked);
int32_t dxtfilter(int32_t fil, texcachepicture *pict, char *pic, void *midbuf, char *packbuf, uint32_t miplen);
int32_t dedxtfilter(int32_t fil, texcachepicture *pict, char *pic, void *midbuf, char *packbuf, int32_t ispacked);
 
void writexcache(char *fn, int len, int dameth, char effect, texcacheheader *head);
void writexcache(char *fn, int32_t len, int32_t dameth, char effect, texcacheheader *head);
 
extern float shadescale;
extern float alphahackarray[MAXTILES];
89,8 → 89,8
typedef struct pthtyp_t
{
struct pthtyp_t *next;
unsigned int glpic;
short picnum;
uint32_t glpic;
int16_t picnum;
char palnum;
char effects;
char flags; // 1 = clamped (dameth&4), 2 = hightile, 4 = skybox face, 8 = hasalpha, 16 = hasfullbright, 128 = invalidated
97,24 → 97,24
char skyface;
hicreplctyp *hicr;
 
unsigned short sizx, sizy;
uint16_t sizx, sizy;
float scalex, scaley;
struct pthtyp_t *ofb; // only fullbright
 
char *palmap;int size;
char *palmap;int32_t size;
} pthtyp;
 
pthtyp * gltexcache (int dapicnum, int dapalnum, int dameth);
pthtyp * gltexcache (int32_t dapicnum, int32_t dapalnum, int32_t dameth);
 
extern palette_t hictinting[MAXPALOOKUPS];
extern float gtang;
extern int globalposx, globalposy, globalposz, globalhoriz;
extern short globalang, globalcursectnum;
extern int globalpal, cosglobalang, singlobalang;
extern int cosviewingrangeglobalang, sinviewingrangeglobalang;
extern int32_t globalposx, globalposy, globalposz, globalhoriz;
extern int16_t globalang, globalcursectnum;
extern int32_t globalpal, cosglobalang, singlobalang;
extern int32_t cosviewingrangeglobalang, sinviewingrangeglobalang;
extern float shadescale;
extern int globalnoeffect;
extern int drawingskybox;
extern int32_t globalnoeffect;
extern int32_t drawingskybox;
 
#endif
 
/polymer/eduke32/build/include/pragmas.h
9,7 → 9,7
extern "C" {
#endif
 
extern int dmval;
extern int32_t dmval;
 
#if defined(__GNUC__) && defined(__i386__) && !defined(NOASM)
 
27,15 → 27,15
 
 
// maybe one day I'll make these into macros
int boundmulscale(int a, int b, int c);
void clearbufbyte(void *D, int c, int a);
void copybufbyte(void *S, void *D, int c);
void copybufreverse(void *S, void *D, int c);
int32_t boundmulscale(int32_t a, int32_t b, int32_t c);
void clearbufbyte(void *D, int32_t c, int32_t a);
void copybufbyte(void *S, void *D, int32_t c);
void copybufreverse(void *S, void *D, int32_t c);
 
 
#ifdef NO_GCC_BUILTINS
#define sqr(a) \
({ int __a=(a); \
({ int32_t __a=(a); \
__asm__ __volatile__ ("imull %0, %0" \
: "=q" (__a) \
: "0" (__a) \
46,7 → 46,7
#endif
 
#define scale(a,d,c) \
({ int __a=(a), __d=(d), __c=(c); \
({ int32_t __a=(a), __d=(d), __c=(c); \
__asm__ __volatile__ ("imull %%edx; idivl %%ecx" \
: "=a" (__a), "=d" (__d) \
: "0" (__a), "1" (__d), "c" (__c) : "cc"); \
53,199 → 53,199
__a; })
 
#define mulscale(a,d,c) \
({ int __a=(a), __d=(d), __c=(c); \
({ int32_t __a=(a), __d=(d), __c=(c); \
__asm__ __volatile__ ("imull %%edx; shrdl %%cl, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d), "c" (__c) : "cc"); \
__a; })
#define mulscale1(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $1, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale2(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $2, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale3(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $3, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale4(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $4, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale5(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $5, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale6(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $6, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale7(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $7, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale8(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $8, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale9(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $9, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale10(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $10, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale11(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $11, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale12(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $12, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale13(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $13, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale14(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $14, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale15(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $15, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale16(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $16, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale17(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $17, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale18(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $18, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale19(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $19, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale20(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $20, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale21(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $21, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale22(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $22, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale23(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $23, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale24(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $24, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale25(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $25, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale26(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $26, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale27(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $27, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale28(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $28, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale29(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $29, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale30(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $30, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale31(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx; shrdl $31, %%edx, %%eax" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
__a; })
#define mulscale32(a,d) \
({ int __a=(a), __d=(d); \
({ int32_t __a=(a), __d=(d); \
__asm__ __volatile__ ("imull %%edx" \
: "=a" (__a), "=d" (__d) \
: "a" (__a), "d" (__d) : "cc"); \
252,7 → 252,7
__d; })
 
#define dmulscale(a,d,S,D,c) \
({ int __a=(a), __d=(d), __S=(S), __D=(D), __c=(c); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D), __c=(c); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl %%cl, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
259,7 → 259,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D), "c" (__c) : "ebx", "cc"); \
__a; })
#define dmulscale1(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $1, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
266,7 → 266,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale2(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $2, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
273,7 → 273,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale3(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $3, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
280,7 → 280,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale4(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $4, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
287,7 → 287,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale5(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $5, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
294,7 → 294,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale6(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $6, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
301,7 → 301,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale7(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $7, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
308,7 → 308,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale8(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $8, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
315,7 → 315,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale9(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $9, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
322,7 → 322,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale10(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $10, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
329,7 → 329,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale11(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $11, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
336,7 → 336,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale12(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $12, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
343,7 → 343,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale13(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $13, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
350,7 → 350,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale14(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $14, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
357,7 → 357,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale15(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $15, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
364,7 → 364,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale16(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $16, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
371,7 → 371,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale17(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $17, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
378,7 → 378,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale18(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $18, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
385,7 → 385,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale19(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $19, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
392,7 → 392,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale20(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $20, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
399,7 → 399,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale21(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $21, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
406,7 → 406,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale22(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $22, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
413,7 → 413,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale23(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $23, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
420,7 → 420,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale24(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $24, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
427,7 → 427,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale25(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $25, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
434,7 → 434,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale26(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $26, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
441,7 → 441,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale27(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $27, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
448,7 → 448,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale28(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $28, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
455,7 → 455,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale29(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $29, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
462,7 → 462,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale30(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $30, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
469,7 → 469,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale31(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $31, %%edx, %%eax" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
476,7 → 476,7
: "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \
__a; })
#define dmulscale32(a,d,S,D) \
({ int __a=(a), __d=(d), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx" \
: "=a" (__a), "=d" (__d), "=S" (__S) \
484,7 → 484,7
__d; })
 
#define tmulscale1(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $1, %%edx, %%eax" \
492,7 → 492,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale2(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $2, %%edx, %%eax" \
500,7 → 500,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale3(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $3, %%edx, %%eax" \
508,7 → 508,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale4(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $4, %%edx, %%eax" \
516,7 → 516,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale5(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $5, %%edx, %%eax" \
524,7 → 524,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale6(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $6, %%edx, %%eax" \
532,7 → 532,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale7(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $7, %%edx, %%eax" \
540,7 → 540,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale8(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $8, %%edx, %%eax" \
548,7 → 548,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale9(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $9, %%edx, %%eax" \
556,7 → 556,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale10(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $10, %%edx, %%eax" \
564,7 → 564,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale11(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $11, %%edx, %%eax" \
572,7 → 572,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale12(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $12, %%edx, %%eax" \
580,7 → 580,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale13(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $13, %%edx, %%eax" \
588,7 → 588,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale14(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $14, %%edx, %%eax" \
596,7 → 596,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale15(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $15, %%edx, %%eax" \
604,7 → 604,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale16(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $16, %%edx, %%eax" \
612,7 → 612,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale17(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $17, %%edx, %%eax" \
620,7 → 620,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale18(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $18, %%edx, %%eax" \
628,7 → 628,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale19(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $19, %%edx, %%eax" \
636,7 → 636,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale20(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $20, %%edx, %%eax" \
644,7 → 644,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale21(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $21, %%edx, %%eax" \
652,7 → 652,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale22(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $22, %%edx, %%eax" \
660,7 → 660,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale23(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $23, %%edx, %%eax" \
668,7 → 668,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale24(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $24, %%edx, %%eax" \
676,7 → 676,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale25(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $25, %%edx, %%eax" \
684,7 → 684,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale26(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $26, %%edx, %%eax" \
692,7 → 692,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale27(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $27, %%edx, %%eax" \
700,7 → 700,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale28(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $28, %%edx, %%eax" \
708,7 → 708,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale29(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $29, %%edx, %%eax" \
716,7 → 716,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale30(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $30, %%edx, %%eax" \
724,7 → 724,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale31(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $31, %%edx, %%eax" \
732,7 → 732,7
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__a; })
#define tmulscale32(a,d,b,c,S,D) \
({ int __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \
__asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \
"imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \
"imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx" \
741,214 → 741,214
__d; })
 
#define divscale(a,b,c) \
({ int __a=(a), __b=(b), __c=(c); \
({ int32_t __a=(a), __b=(b), __c=(c); \
__asm__ __volatile__ ("movl %%eax, %%edx; shll %%cl, %%eax; negb %%cl; sarl %%cl, %%edx; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "c" (__c), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale1(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("addl %%eax, %%eax; sbbl %%edx, %%edx; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale2(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $30, %%edx; leal (,%%eax,4), %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale3(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $29, %%edx; leal (,%%eax,8), %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale4(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $28, %%edx; shll $4, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale5(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $27, %%edx; shll $5, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale6(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $26, %%edx; shll $6, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale7(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $25, %%edx; shll $7, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale8(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $24, %%edx; shll $8, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale9(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $23, %%edx; shll $9, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale10(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $22, %%edx; shll $10, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale11(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $21, %%edx; shll $11, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale12(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $20, %%edx; shll $12, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale13(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $19, %%edx; shll $13, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale14(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $18, %%edx; shll $14, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale15(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $17, %%edx; shll $15, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale16(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $16, %%edx; shll $16, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale17(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $15, %%edx; shll $17, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale18(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $14, %%edx; shll $18, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale19(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $13, %%edx; shll $19, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale20(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $12, %%edx; shll $20, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale21(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $11, %%edx; shll $21, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale22(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $10, %%edx; shll $22, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale23(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $9, %%edx; shll $23, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale24(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $8, %%edx; shll $24, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale25(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $7, %%edx; shll $25, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale26(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $6, %%edx; shll $26, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale27(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $5, %%edx; shll $27, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale28(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $4, %%edx; shll $28, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale29(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $3, %%edx; shll $29, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale30(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $2, %%edx; shll $30, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale31(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("movl %%eax, %%edx; sarl $1, %%edx; shll $31, %%eax; idivl %%ebx" \
: "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \
__a; })
#define divscale32(d,b) \
({ int __d=(d), __b=(b), __r; \
({ int32_t __d=(d), __b=(b), __r; \
__asm__ __volatile__ ("xorl %%eax, %%eax; idivl %%ebx" \
: "=a" (__r), "=d" (__d) : "d" (__d), "b" (__b) : "cc"); \
__r; })
 
#define readpixel(D) \
({ void *__D=(D); int __a; \
({ void *__D=(D); int32_t __a; \
__asm__ __volatile__ ("movb (%%edi), %%al" \
: "=a" (__a): "D" (__D) : "cc"); \
__a; })
#define drawpixel(D,a) \
({ void *__D=(D); int __a=(a); \
({ void *__D=(D); int32_t __a=(a); \
__asm__ __volatile__ ("movb %%al, (%%edi)" \
: : "D" (__D), "a" (__a) : "memory", "cc"); \
0; })
#define drawpixels(D,a) \
({ void *__D=(D); int __a=(a); \
({ void *__D=(D); int32_t __a=(a); \
__asm__ __volatile__ ("movw %%ax, (%%edi)" \
: : "D" (__D), "a" (__a) : "memory", "cc"); \
0; })
#define drawpixelses(D,a) \
({ void *__D=(D); int __a=(a); \
({ void *__D=(D); int32_t __a=(a); \
__asm__ __volatile__ ("movl %%eax, (%%edi)" \
: : "D" (__D), "a" (__a) : "memory", "cc"); \
0; })
#define clearbuf(D,c,a) \
({ void *__D=(D); int __c=(c), __a=(a); \
({ void *__D=(D); int32_t __c=(c), __a=(a); \
__asm__ __volatile__ ("rep; stosl" \
: "=&D" (__D), "=&c" (__c) : "0" (__D), "1" (__c), "a" (__a) : "memory", "cc"); \
0; })
#define copybuf(S,D,c) \
({ void *__S=(S), *__D=(D); int __c=(c); \
({ void *__S=(S), *__D=(D); int32_t __c=(c); \
__asm__ __volatile__ ("rep; movsl" \
: "=&S" (__S), "=&D" (__D), "=&c" (__c) : "0" (__S), "1" (__D), "2" (__c) : "memory", "cc"); \
0; })
 
#define mul3(a) \
({ int __a=(a), __r; \
({ int32_t __a=(a), __r; \
__asm__ __volatile__ ("lea (%1,%1,2), %0" \
: "=r" (__r) : "0" (__a) : "cc"); \
__r; })
#define mul5(a) \
({ int __a=(a), __r; \
({ int32_t __a=(a), __r; \
__asm__ __volatile__ ("lea (%1,%1,4), %0" \
: "=r" (__r) : "0" (__a) : "cc"); \
__r; })
#define mul9(a) \
({ int __a=(a), __r; \
({ int32_t __a=(a), __r; \
__asm__ __volatile__ ("lea (%1,%1,8), %0" \
: "=r" (__r) : "0" (__a) : "cc"); \
__r; })
955,46 → 955,46
 
//returns eax/ebx, dmval = eax%edx;
#define divmod(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("xorl %%edx, %%edx; divl %%ebx; movl %%edx, "_DMVAL \
: "+a" (__a) : "b" (__b) : "edx", "memory", "cc"); \
__a; })
//returns eax%ebx, dmval = eax/edx;
#define moddiv(a,b) \
({ int __a=(a), __b=(b), __d; \
({ int32_t __a=(a), __b=(b), __d; \
__asm__ __volatile__ ("xorl %%edx, %%edx; divl %%ebx; movl %%eax, "_DMVAL \
: "=d" (__d) : "a" (__a), "b" (__b) : "eax", "memory", "cc"); \
__d; })
 
#define klabs(a) \
({ int __a=(a); \
({ int32_t __a=(a); \
__asm__ __volatile__ ("testl %%eax, %%eax; jns 0f; negl %%eax; 0:" \
: "=a" (__a) : "a" (__a) : "cc"); \
__a; })
#define ksgn(b) \
({ int __b=(b), __r; \
({ int32_t __b=(b), __r; \
__asm__ __volatile__ ("addl %%ebx, %%ebx; sbbl %%eax, %%eax; cmpl %%ebx, %%eax; adcb $0, %%al" \
: "=a" (__r) : "b" (__b) : "cc"); \
__r; })
 
#define umin(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("subl %%ebx, %%eax; sbbl %%ecx, %%ecx; andl %%ecx, %%eax; addl %%ebx, %%eax" \
: "=a" (__a) : "a" (__a), "b" (__b) : "ecx", "cc"); \
__a; })
#define umax(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("subl %%ebx, %%eax; sbbl %%ecx, %%ecx; xorl $0xffffffff, %%ecx; andl %%ecx, %%eax; addl %%ebx, %%eax" \
: "=a" (__a) : "a" (__a), "b" (__b) : "ecx", "cc"); \
__a; })
 
#define kmin(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("cmpl %%ebx, %%eax; jl 0f; movl %%ebx, %%eax; 0:" \
: "=a" (__a) : "a" (__a), "b" (__b) : "cc"); \
__a; })
#define kmax(a,b) \
({ int __a=(a), __b=(b); \
({ int32_t __a=(a), __b=(b); \
__asm__ __volatile__ ("cmpl %%ebx, %%eax; jg 0f; movl %%ebx, %%eax; 0:" \
: "=a" (__a) : "a" (__a), "b" (__b) : "cc"); \
__a; })
1015,7 → 1015,7
: : "a" (__a), "b" (__b) : "ecx", "edx", "memory", "cc"); \
0; })
#define swapbuf4(a,b,c) \
({ void *__a=(a), *__b=(b); int __c=(c); \
({ void *__a=(a), *__b=(b); int32_t __c=(c); \
__asm__ __volatile__ ("0: movl (%%eax), %%esi; movl (%%ebx), %%edi; movl %%esi, (%%ebx); " \
"movl %%edi, (%%eax); addl $4, %%eax; addl $4, %%ebx; decl %%ecx; jnz 0b" \
: : "a" (__a), "b" (__b), "c" (__c) : "esi", "edi", "memory", "cc"); \
1031,7 → 1031,7
//swapchar2(ptr1,ptr2,xsiz); is the same as:
//swapchar(ptr1,ptr2); swapchar(ptr1+1,ptr2+xsiz);
#define swapchar2(a,b,S) \
({ void *__a=(a), *__b=(b); int __S=(S); \
({ void *__a=(a), *__b=(b); int32_t __S=(S); \
__asm__ __volatile__ ("addl %%ebx, %%esi; movw (%%eax), %%cx; movb (%%ebx), %%dl; " \
"movb %%cl, (%%ebx); movb (%%esi), %%dh; movb %%ch, (%%esi); " \
"movw %%dx, (%%eax)" \
1040,7 → 1040,7
 
 
#define qinterpolatedown16(a,c,d,S) \
({ void *__a=(void*)(a); int __c=(c), __d=(d), __S=(S); \
({ void *__a=(void*)(a); int32_t __c=(c), __d=(d), __S=(S); \
__asm__ __volatile__ ("movl %%ecx, %%ebx; shrl $1, %%ecx; jz 1f; " \
"0: leal (%%edx,%%esi,), %%edi; sarl $16, %%edx; movl %%edx, (%%eax); " \
"leal (%%edi,%%esi,), %%edx; sarl $16, %%edi; movl %%edi, 4(%%eax); " \
1051,7 → 1051,7
0; })
 
#define qinterpolatedown16short(a,c,d,S) \
({ void *__a=(void*)(a); int __c=(c), __d=(d), __S=(S); \
({ void *__a=(void*)(a); int32_t __c=(c), __d=(d), __S=(S); \
__asm__ __volatile__ ("testl %%ecx, %%ecx; jz 3f; testb $2, %%al; jz 0f; movl %%edx, %%ebx; " \
"sarl $16, %%ebx; movw %%bx, (%%eax); addl %%esi, %%edx; addl $2, %%eax; " \
"decl %%ecx; jz 3f; " \
1075,7 → 1075,7
//
 
//{{{
int sqr(int);
int32_t sqr(int32_t);
#pragma aux sqr =\
"imul eax, eax",\
parm nomemory [eax]\
1082,7 → 1082,7
modify exact [eax]\
value [eax]
 
int scale(int,int,int);
int32_t scale(int32_t,int32_t,int32_t);
#pragma aux scale =\
"imul edx",\
"idiv ecx",\
1089,7 → 1089,7
parm nomemory [eax][edx][ecx]\
modify exact [eax edx]
 
int mulscale(int,int,int);
int32_t mulscale(int32_t,int32_t,int32_t);
#pragma aux mulscale =\
"imul edx",\
"shrd eax, edx, cl",\
1096,7 → 1096,7
parm nomemory [eax][edx][ecx]\
modify exact [eax edx]
 
int mulscale1(int,int);
int32_t mulscale1(int32_t,int32_t);
#pragma aux mulscale1 =\
"imul edx",\
"shrd eax, edx, 1",\
1103,7 → 1103,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale2(int,int);
int32_t mulscale2(int32_t,int32_t);
#pragma aux mulscale2 =\
"imul edx",\
"shrd eax, edx, 2",\
1110,7 → 1110,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale3(int,int);
int32_t mulscale3(int32_t,int32_t);
#pragma aux mulscale3 =\
"imul edx",\
"shrd eax, edx, 3",\
1117,7 → 1117,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale4(int,int);
int32_t mulscale4(int32_t,int32_t);
#pragma aux mulscale4 =\
"imul edx",\
"shrd eax, edx, 4",\
1124,7 → 1124,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale5(int,int);
int32_t mulscale5(int32_t,int32_t);
#pragma aux mulscale5 =\
"imul edx",\
"shrd eax, edx, 5",\
1131,7 → 1131,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale6(int,int);
int32_t mulscale6(int32_t,int32_t);
#pragma aux mulscale6 =\
"imul edx",\
"shrd eax, edx, 6",\
1138,7 → 1138,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale7(int,int);
int32_t mulscale7(int32_t,int32_t);
#pragma aux mulscale7 =\
"imul edx",\
"shrd eax, edx, 7",\
1145,7 → 1145,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale8(int,int);
int32_t mulscale8(int32_t,int32_t);
#pragma aux mulscale8 =\
"imul edx",\
"shrd eax, edx, 8",\
1152,7 → 1152,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale9(int,int);
int32_t mulscale9(int32_t,int32_t);
#pragma aux mulscale9 =\
"imul edx",\
"shrd eax, edx, 9",\
1159,7 → 1159,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale10(int,int);
int32_t mulscale10(int32_t,int32_t);
#pragma aux mulscale10 =\
"imul edx",\
"shrd eax, edx, 10",\
1166,7 → 1166,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale11(int,int);
int32_t mulscale11(int32_t,int32_t);
#pragma aux mulscale11 =\
"imul edx",\
"shrd eax, edx, 11",\
1173,7 → 1173,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale12(int,int);
int32_t mulscale12(int32_t,int32_t);
#pragma aux mulscale12 =\
"imul edx",\
"shrd eax, edx, 12",\
1180,7 → 1180,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale13(int,int);
int32_t mulscale13(int32_t,int32_t);
#pragma aux mulscale13 =\
"imul edx",\
"shrd eax, edx, 13",\
1187,7 → 1187,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale14(int,int);
int32_t mulscale14(int32_t,int32_t);
#pragma aux mulscale14 =\
"imul edx",\
"shrd eax, edx, 14",\
1194,7 → 1194,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale15(int,int);
int32_t mulscale15(int32_t,int32_t);
#pragma aux mulscale15 =\
"imul edx",\
"shrd eax, edx, 15",\
1201,7 → 1201,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale16(int,int);
int32_t mulscale16(int32_t,int32_t);
#pragma aux mulscale16 =\
"imul edx",\
"shrd eax, edx, 16",\
1208,7 → 1208,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale17(int,int);
int32_t mulscale17(int32_t,int32_t);
#pragma aux mulscale17 =\
"imul edx",\
"shrd eax, edx, 17",\
1215,7 → 1215,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale18(int,int);
int32_t mulscale18(int32_t,int32_t);
#pragma aux mulscale18 =\
"imul edx",\
"shrd eax, edx, 18",\
1222,7 → 1222,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale19(int,int);
int32_t mulscale19(int32_t,int32_t);
#pragma aux mulscale19 =\
"imul edx",\
"shrd eax, edx, 19",\
1229,7 → 1229,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale20(int,int);
int32_t mulscale20(int32_t,int32_t);
#pragma aux mulscale20 =\
"imul edx",\
"shrd eax, edx, 20",\
1236,7 → 1236,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale21(int,int);
int32_t mulscale21(int32_t,int32_t);
#pragma aux mulscale21 =\
"imul edx",\
"shrd eax, edx, 21",\
1243,7 → 1243,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale22(int,int);
int32_t mulscale22(int32_t,int32_t);
#pragma aux mulscale22 =\
"imul edx",\
"shrd eax, edx, 22",\
1250,7 → 1250,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale23(int,int);
int32_t mulscale23(int32_t,int32_t);
#pragma aux mulscale23 =\
"imul edx",\
"shrd eax, edx, 23",\
1257,7 → 1257,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale24(int,int);
int32_t mulscale24(int32_t,int32_t);
#pragma aux mulscale24 =\
"imul edx",\
"shrd eax, edx, 24",\
1264,7 → 1264,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale25(int,int);
int32_t mulscale25(int32_t,int32_t);
#pragma aux mulscale25 =\
"imul edx",\
"shrd eax, edx, 25",\
1271,7 → 1271,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale26(int,int);
int32_t mulscale26(int32_t,int32_t);
#pragma aux mulscale26 =\
"imul edx",\
"shrd eax, edx, 26",\
1278,7 → 1278,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale27(int,int);
int32_t mulscale27(int32_t,int32_t);
#pragma aux mulscale27 =\
"imul edx",\
"shrd eax, edx, 27",\
1285,7 → 1285,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale28(int,int);
int32_t mulscale28(int32_t,int32_t);
#pragma aux mulscale28 =\
"imul edx",\
"shrd eax, edx, 28",\
1292,7 → 1292,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale29(int,int);
int32_t mulscale29(int32_t,int32_t);
#pragma aux mulscale29 =\
"imul edx",\
"shrd eax, edx, 29",\
1299,7 → 1299,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale30(int,int);
int32_t mulscale30(int32_t,int32_t);
#pragma aux mulscale30 =\
"imul edx",\
"shrd eax, edx, 30",\
1306,7 → 1306,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale31(int,int);
int32_t mulscale31(int32_t,int32_t);
#pragma aux mulscale31 =\
"imul edx",\
"shrd eax, edx, 31",\
1313,7 → 1313,7
parm nomemory [eax][edx]\
modify exact [eax edx]
 
int mulscale32(int,int);
int32_t mulscale32(int32_t,int32_t);
#pragma aux mulscale32 =\
"imul edx",\
parm nomemory [eax][edx]\
1320,7 → 1320,7
modify exact [eax edx]\
value [edx]
 
int dmulscale(int,int,int,int,int);
int32_t dmulscale(int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale =\
"imul edx",\
"mov ebx, eax",\
1333,7 → 1333,7
parm nomemory [eax][edx][esi][edi][ecx]\
modify exact [eax ebx edx esi]
 
int dmulscale1(int,int,int,int);
int32_t dmulscale1(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale1 =\
"imul edx",\
"mov ebx, eax",\
1346,7 → 1346,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale2(int,int,int,int);
int32_t dmulscale2(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale2 =\
"imul edx",\
"mov ebx, eax",\
1359,7 → 1359,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale3(int,int,int,int);
int32_t dmulscale3(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale3 =\
"imul edx",\
"mov ebx, eax",\
1372,7 → 1372,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale4(int,int,int,int);
int32_t dmulscale4(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale4 =\
"imul edx",\
"mov ebx, eax",\
1385,7 → 1385,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale5(int,int,int,int);
int32_t dmulscale5(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale5 =\
"imul edx",\
"mov ebx, eax",\
1398,7 → 1398,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale6(int,int,int,int);
int32_t dmulscale6(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale6 =\
"imul edx",\
"mov ebx, eax",\
1411,7 → 1411,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale7(int,int,int,int);
int32_t dmulscale7(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale7 =\
"imul edx",\
"mov ebx, eax",\
1424,7 → 1424,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale8(int,int,int,int);
int32_t dmulscale8(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale8 =\
"imul edx",\
"mov ebx, eax",\
1437,7 → 1437,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale9(int,int,int,int);
int32_t dmulscale9(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale9 =\
"imul edx",\
"mov ebx, eax",\
1450,7 → 1450,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale10(int,int,int,int);
int32_t dmulscale10(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale10 =\
"imul edx",\
"mov ebx, eax",\
1463,7 → 1463,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale11(int,int,int,int);
int32_t dmulscale11(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale11 =\
"imul edx",\
"mov ebx, eax",\
1476,7 → 1476,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale12(int,int,int,int);
int32_t dmulscale12(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale12 =\
"imul edx",\
"mov ebx, eax",\
1489,7 → 1489,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale13(int,int,int,int);
int32_t dmulscale13(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale13 =\
"imul edx",\
"mov ebx, eax",\
1502,7 → 1502,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale14(int,int,int,int);
int32_t dmulscale14(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale14 =\
"imul edx",\
"mov ebx, eax",\
1515,7 → 1515,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale15(int,int,int,int);
int32_t dmulscale15(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale15 =\
"imul edx",\
"mov ebx, eax",\
1528,7 → 1528,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale16(int,int,int,int);
int32_t dmulscale16(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale16 =\
"imul edx",\
"mov ebx, eax",\
1541,7 → 1541,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale17(int,int,int,int);
int32_t dmulscale17(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale17 =\
"imul edx",\
"mov ebx, eax",\
1554,7 → 1554,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale18(int,int,int,int);
int32_t dmulscale18(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale18 =\
"imul edx",\
"mov ebx, eax",\
1567,7 → 1567,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale19(int,int,int,int);
int32_t dmulscale19(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale19 =\
"imul edx",\
"mov ebx, eax",\
1580,7 → 1580,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale20(int,int,int,int);
int32_t dmulscale20(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale20 =\
"imul edx",\
"mov ebx, eax",\
1593,7 → 1593,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale21(int,int,int,int);
int32_t dmulscale21(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale21 =\
"imul edx",\
"mov ebx, eax",\
1606,7 → 1606,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale22(int,int,int,int);
int32_t dmulscale22(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale22 =\
"imul edx",\
"mov ebx, eax",\
1619,7 → 1619,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale23(int,int,int,int);
int32_t dmulscale23(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale23 =\
"imul edx",\
"mov ebx, eax",\
1632,7 → 1632,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale24(int,int,int,int);
int32_t dmulscale24(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale24 =\
"imul edx",\
"mov ebx, eax",\
1645,7 → 1645,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale25(int,int,int,int);
int32_t dmulscale25(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale25 =\
"imul edx",\
"mov ebx, eax",\
1658,7 → 1658,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale26(int,int,int,int);
int32_t dmulscale26(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale26 =\
"imul edx",\
"mov ebx, eax",\
1671,7 → 1671,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale27(int,int,int,int);
int32_t dmulscale27(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale27 =\
"imul edx",\
"mov ebx, eax",\
1684,7 → 1684,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale28(int,int,int,int);
int32_t dmulscale28(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale28 =\
"imul edx",\
"mov ebx, eax",\
1697,7 → 1697,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale29(int,int,int,int);
int32_t dmulscale29(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale29 =\
"imul edx",\
"mov ebx, eax",\
1710,7 → 1710,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale30(int,int,int,int);
int32_t dmulscale30(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale30 =\
"imul edx",\
"mov ebx, eax",\
1723,7 → 1723,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale31(int,int,int,int);
int32_t dmulscale31(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale31 =\
"imul edx",\
"mov ebx, eax",\
1736,7 → 1736,7
parm nomemory [eax][edx][esi][edi]\
modify exact [eax ebx edx esi]
 
int dmulscale32(int,int,int,int);
int32_t dmulscale32(int32_t,int32_t,int32_t,int32_t);
#pragma aux dmulscale32 =\
"imul edx",\
"mov ebx, eax",\
1749,7 → 1749,7
modify exact [eax ebx edx esi]\
value [edx]
 
int tmulscale1(int,int,int,int,int,int);
int32_t tmulscale1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale1 =\
"imul edx",\
"xchg eax, ebx",\
1765,7 → 1765,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale2(int,int,int,int,int,int);
int32_t tmulscale2(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale2 =\
"imul edx",\
"xchg eax, ebx",\
1781,7 → 1781,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale3(int,int,int,int,int,int);
int32_t tmulscale3(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale3 =\
"imul edx",\
"xchg eax, ebx",\
1797,7 → 1797,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale4(int,int,int,int,int,int);
int32_t tmulscale4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale4 =\
"imul edx",\
"xchg eax, ebx",\
1813,7 → 1813,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale5(int,int,int,int,int,int);
int32_t tmulscale5(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale5 =\
"imul edx",\
"xchg eax, ebx",\
1829,7 → 1829,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale6(int,int,int,int,int,int);
int32_t tmulscale6(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale6 =\
"imul edx",\
"xchg eax, ebx",\
1845,7 → 1845,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale7(int,int,int,int,int,int);
int32_t tmulscale7(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale7 =\
"imul edx",\
"xchg eax, ebx",\
1861,7 → 1861,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale8(int,int,int,int,int,int);
int32_t tmulscale8(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale8 =\
"imul edx",\
"xchg eax, ebx",\
1877,7 → 1877,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale9(int,int,int,int,int,int);
int32_t tmulscale9(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale9 =\
"imul edx",\
"xchg eax, ebx",\
1893,7 → 1893,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale10(int,int,int,int,int,int);
int32_t tmulscale10(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale10 =\
"imul edx",\
"xchg eax, ebx",\
1909,7 → 1909,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale11(int,int,int,int,int,int);
int32_t tmulscale11(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale11 =\
"imul edx",\
"xchg eax, ebx",\
1925,7 → 1925,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale12(int,int,int,int,int,int);
int32_t tmulscale12(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale12 =\
"imul edx",\
"xchg eax, ebx",\
1941,7 → 1941,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale13(int,int,int,int,int,int);
int32_t tmulscale13(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale13 =\
"imul edx",\
"xchg eax, ebx",\
1957,7 → 1957,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale14(int,int,int,int,int,int);
int32_t tmulscale14(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale14 =\
"imul edx",\
"xchg eax, ebx",\
1973,7 → 1973,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale15(int,int,int,int,int,int);
int32_t tmulscale15(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale15 =\
"imul edx",\
"xchg eax, ebx",\
1989,7 → 1989,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale16(int,int,int,int,int,int);
int32_t tmulscale16(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale16 =\
"imul edx",\
"xchg eax, ebx",\
2005,7 → 2005,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale17(int,int,int,int,int,int);
int32_t tmulscale17(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale17 =\
"imul edx",\
"xchg eax, ebx",\
2021,7 → 2021,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale18(int,int,int,int,int,int);
int32_t tmulscale18(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale18 =\
"imul edx",\
"xchg eax, ebx",\
2037,7 → 2037,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale19(int,int,int,int,int,int);
int32_t tmulscale19(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale19 =\
"imul edx",\
"xchg eax, ebx",\
2053,7 → 2053,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale20(int,int,int,int,int,int);
int32_t tmulscale20(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale20 =\
"imul edx",\
"xchg eax, ebx",\
2069,7 → 2069,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale21(int,int,int,int,int,int);
int32_t tmulscale21(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale21 =\
"imul edx",\
"xchg eax, ebx",\
2085,7 → 2085,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale22(int,int,int,int,int,int);
int32_t tmulscale22(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale22 =\
"imul edx",\
"xchg eax, ebx",\
2101,7 → 2101,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale23(int,int,int,int,int,int);
int32_t tmulscale23(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale23 =\
"imul edx",\
"xchg eax, ebx",\
2117,7 → 2117,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale24(int,int,int,int,int,int);
int32_t tmulscale24(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale24 =\
"imul edx",\
"xchg eax, ebx",\
2133,7 → 2133,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale25(int,int,int,int,int,int);
int32_t tmulscale25(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale25 =\
"imul edx",\
"xchg eax, ebx",\
2149,7 → 2149,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale26(int,int,int,int,int,int);
int32_t tmulscale26(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale26 =\
"imul edx",\
"xchg eax, ebx",\
2165,7 → 2165,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale27(int,int,int,int,int,int);
int32_t tmulscale27(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale27 =\
"imul edx",\
"xchg eax, ebx",\
2181,7 → 2181,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale28(int,int,int,int,int,int);
int32_t tmulscale28(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale28 =\
"imul edx",\
"xchg eax, ebx",\
2197,7 → 2197,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale29(int,int,int,int,int,int);
int32_t tmulscale29(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale29 =\
"imul edx",\
"xchg eax, ebx",\
2213,7 → 2213,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale30(int,int,int,int,int,int);
int32_t tmulscale30(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale30 =\
"imul edx",\
"xchg eax, ebx",\
2229,7 → 2229,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale31(int,int,int,int,int,int);
int32_t tmulscale31(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale31 =\
"imul edx",\
"xchg eax, ebx",\
2245,7 → 2245,7
parm nomemory [eax][edx][ebx][ecx][esi][edi]\
modify exact [eax ebx ecx edx]
 
int tmulscale32(int,int,int,int,int,int);
int32_t tmulscale32(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t);
#pragma aux tmulscale32 =\
"imul edx",\
"xchg eax, ebx",\
2261,7 → 2261,7
modify exact [eax ebx ecx edx]\
value [edx]
 
int boundmulscale(int,int,int);
int32_t boundmulscale(int32_t,int32_t,int32_t);
#pragma aux boundmulscale =\
"imul ebx",\
"mov ebx, edx",\
2281,7 → 2281,7
parm nomemory [eax][ebx][ecx]\
modify exact [eax ebx edx]
 
int divscale(int,int,int);
int32_t divscale(int32_t,int32_t,int32_t);
#pragma aux divscale =\
"mov edx, eax",\
"shl eax, cl",\
2291,7 → 2291,7
parm nomemory [eax][ebx][ecx]\
modify exact [eax ecx edx]
 
int divscale1(int,int);
int32_t divscale1(int32_t,int32_t);
#pragma aux divscale1 =\
"add eax, eax",\
"sbb edx, edx",\
2299,7 → 2299,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale2(int,int);
int32_t divscale2(int32_t,int32_t);
#pragma aux divscale2 =\
"mov edx, eax",\
"sar edx, 30",\
2308,7 → 2308,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale3(int,int);
int32_t divscale3(int32_t,int32_t);
#pragma aux divscale3 =\
"mov edx, eax",\
"sar edx, 29",\
2317,7 → 2317,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale4(int,int);
int32_t divscale4(int32_t,int32_t);
#pragma aux divscale4 =\
"mov edx, eax",\
"sar edx, 28",\
2326,7 → 2326,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale5(int,int);
int32_t divscale5(int32_t,int32_t);
#pragma aux divscale5 =\
"mov edx, eax",\
"sar edx, 27",\
2335,7 → 2335,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale6(int,int);
int32_t divscale6(int32_t,int32_t);
#pragma aux divscale6 =\
"mov edx, eax",\
"sar edx, 26",\
2344,7 → 2344,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale7(int,int);
int32_t divscale7(int32_t,int32_t);
#pragma aux divscale7 =\
"mov edx, eax",\
"sar edx, 25",\
2353,7 → 2353,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale8(int,int);
int32_t divscale8(int32_t,int32_t);
#pragma aux divscale8 =\
"mov edx, eax",\
"sar edx, 24",\
2362,7 → 2362,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale9(int,int);
int32_t divscale9(int32_t,int32_t);
#pragma aux divscale9 =\
"mov edx, eax",\
"sar edx, 23",\
2371,7 → 2371,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale10(int,int);
int32_t divscale10(int32_t,int32_t);
#pragma aux divscale10 =\
"mov edx, eax",\
"sar edx, 22",\
2380,7 → 2380,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale11(int,int);
int32_t divscale11(int32_t,int32_t);
#pragma aux divscale11 =\
"mov edx, eax",\
"sar edx, 21",\
2389,7 → 2389,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale12(int,int);
int32_t divscale12(int32_t,int32_t);
#pragma aux divscale12 =\
"mov edx, eax",\
"sar edx, 20",\
2398,7 → 2398,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale13(int,int);
int32_t divscale13(int32_t,int32_t);
#pragma aux divscale13 =\
"mov edx, eax",\
"sar edx, 19",\
2407,7 → 2407,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale14(int,int);
int32_t divscale14(int32_t,int32_t);
#pragma aux divscale14 =\
"mov edx, eax",\
"sar edx, 18",\
2416,7 → 2416,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale15(int,int);
int32_t divscale15(int32_t,int32_t);
#pragma aux divscale15 =\
"mov edx, eax",\
"sar edx, 17",\
2425,7 → 2425,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale16(int,int);
int32_t divscale16(int32_t,int32_t);
#pragma aux divscale16 =\
"mov edx, eax",\
"sar edx, 16",\
2434,7 → 2434,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale17(int,int);
int32_t divscale17(int32_t,int32_t);
#pragma aux divscale17 =\
"mov edx, eax",\
"sar edx, 15",\
2443,7 → 2443,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale18(int,int);
int32_t divscale18(int32_t,int32_t);
#pragma aux divscale18 =\
"mov edx, eax",\
"sar edx, 14",\
2452,7 → 2452,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale19(int,int);
int32_t divscale19(int32_t,int32_t);
#pragma aux divscale19 =\
"mov edx, eax",\
"sar edx, 13",\
2461,7 → 2461,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale20(int,int);
int32_t divscale20(int32_t,int32_t);
#pragma aux divscale20 =\
"mov edx, eax",\
"sar edx, 12",\
2470,7 → 2470,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale21(int,int);
int32_t divscale21(int32_t,int32_t);
#pragma aux divscale21 =\
"mov edx, eax",\
"sar edx, 11",\
2479,7 → 2479,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale22(int,int);
int32_t divscale22(int32_t,int32_t);
#pragma aux divscale22 =\
"mov edx, eax",\
"sar edx, 10",\
2488,7 → 2488,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale23(int,int);
int32_t divscale23(int32_t,int32_t);
#pragma aux divscale23 =\
"mov edx, eax",\
"sar edx, 9",\
2497,7 → 2497,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale24(int,int);
int32_t divscale24(int32_t,int32_t);
#pragma aux divscale24 =\
"mov edx, eax",\
"sar edx, 8",\
2506,7 → 2506,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale25(int,int);
int32_t divscale25(int32_t,int32_t);
#pragma aux divscale25 =\
"mov edx, eax",\
"sar edx, 7",\
2515,7 → 2515,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale26(int,int);
int32_t divscale26(int32_t,int32_t);
#pragma aux divscale26 =\
"mov edx, eax",\
"sar edx, 6",\
2524,7 → 2524,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale27(int,int);
int32_t divscale27(int32_t,int32_t);
#pragma aux divscale27 =\
"mov edx, eax",\
"sar edx, 5",\
2533,7 → 2533,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale28(int,int);
int32_t divscale28(int32_t,int32_t);
#pragma aux divscale28 =\
"mov edx, eax",\
"sar edx, 4",\
2542,7 → 2542,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale29(int,int);
int32_t divscale29(int32_t,int32_t);
#pragma aux divscale29 =\
"mov edx, eax",\
"sar edx, 3",\
2551,7 → 2551,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale30(int,int);
int32_t divscale30(int32_t,int32_t);
#pragma aux divscale30 =\
"mov edx, eax",\
"sar edx, 2",\
2560,7 → 2560,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale31(int,int);
int32_t divscale31(int32_t,int32_t);
#pragma aux divscale31 =\
"mov edx, eax",\
"sar edx, 1",\
2569,7 → 2569,7
parm nomemory [eax][ebx]\
modify exact [eax edx]
 
int divscale32(int,int);
int32_t divscale32(int32_t,int32_t);
#pragma aux divscale32 =\
"xor eax, eax",\
"idiv ebx",\
2576,37 → 2576,37
parm nomemory [edx][ebx]\
modify exact [eax edx]
 
int readpixel(void*);
int32_t readpixel(void*);
#pragma aux readpixel =\
"mov al, byte ptr [edi]",\
parm nomemory [edi]\
modify exact [eax]
 
int drawpixel(void*,int);
int32_t drawpixel(void*,int32_t);
#pragma aux drawpixel =\
"mov byte ptr [edi], al",\
parm [edi][eax]\
modify exact
 
int drawpixels(void*,int);
int32_t drawpixels(void*,int32_t);
#pragma aux drawpixels =\
"mov word ptr [edi], ax",\
parm [edi][eax]\
modify exact
 
int drawpixelses(void*,int);
int32_t drawpixelses(void*,int32_t);
#pragma aux drawpixelses =\
"mov dword ptr [edi], eax",\
parm [edi][eax]\
modify exact
 
int clearbuf(void*,int,int);
int32_t clearbuf(void*,int32_t,int32_t);
#pragma aux clearbuf =\
"rep stosd",\
parm [edi][ecx][eax]\
modify exact [edi ecx]
 
int clearbufbyte(void*,int,int);
int32_t clearbufbyte(void*,int32_t,int32_t);
#pragma aux clearbufbyte =\
"cmp ecx, 4",\
"jae longcopy",\
2637,13 → 2637,13
parm [edi][ecx][eax]\
modify [ebx]
 
int copybuf(void*,void*,int);
int32_t copybuf(void*,void*,int32_t);
#pragma aux copybuf =\
"rep movsd",\
parm [esi][edi][ecx]\
modify exact [ecx esi edi]
 
int copybufbyte(void*,void*,int);
int32_t copybufbyte(void*,void*,int32_t);
#pragma aux copybufbyte =\
"cmp ecx, 4",\
"jae longcopy",\
2674,7 → 2674,7
parm [esi][edi][ecx]\
modify [ebx]
 
int copybufreverse(void*,void*,int);
int32_t copybufreverse(void*,void*,int32_t);
#pragma aux copybufreverse =\
"shr ecx, 1",\
"jnc skipit1",\
2701,7 → 2701,7
"endloop:",\
parm [esi][edi][ecx]
 
int qinterpolatedown16(int,int,int,int);
int32_t qinterpolatedown16(int32_t,int32_t,int32_t,int32_t);
#pragma aux qinterpolatedown16 =\
"mov ebx, ecx",\
"shr ecx, 1",\
2723,7 → 2723,7
parm [eax][ecx][edx][esi]\
modify exact [eax ebx ecx edx edi]
 
int qinterpolatedown16short(int,int,int,int);
int32_t qinterpolatedown16short(int32_t,int32_t,int32_t,int32_t);
#pragma aux qinterpolatedown16short =\
"test ecx, ecx",\
"jz endit",\
2758,23 → 2758,23
parm [eax][ecx][edx][esi]\
modify exact [eax ebx ecx edx edi]
 
int mul3(int);
int32_t mul3(int32_t);
#pragma aux mul3 =\
"lea eax, [eax+eax*2]",\
parm nomemory [eax]
 
int mul5(int);
int32_t mul5(int32_t);
#pragma aux mul5 =\
"lea eax, [eax+eax*4]",\
parm nomemory [eax]
 
int mul9(int);
int32_t mul9(int32_t);
#pragma aux mul9 =\
"lea eax, [eax+eax*8]",\
parm nomemory [eax]
 
//returns eax/ebx, dmval = eax%edx;
int divmod(int,int);
int32_t divmod(int32_t,int32_t);
#pragma aux divmod =\
"xor edx, edx",\
"div ebx",\
2784,7 → 2784,7
value [eax]
 
//returns eax%ebx, dmval = eax/edx;
int moddiv(int,int);
int32_t moddiv(int32_t,int32_t);
#pragma aux moddiv =\
"xor edx, edx",\
"div ebx",\
2793,7 → 2793,7
modify exact [eax edx]\
value [edx]
 
int klabs(int);
int32_t klabs(int32_t);
#pragma aux klabs =\
"test eax, eax",\
"jns skipnegate",\
2801,7 → 2801,7
"skipnegate:",\
parm nomemory [eax]
 
int ksgn(int);
int32_t ksgn(int32_t);
#pragma aux ksgn =\
"add ebx, ebx",\
"sbb eax, eax",\
2811,7 → 2811,7
modify exact [eax ebx]
 
//eax = (unsigned min)umin(eax,ebx)
int umin(int,int);
int32_t umin(int32_t,int32_t);
#pragma aux umin =\
"sub eax, ebx",\
"sbb ecx, ecx",\
2821,7 → 2821,7
modify exact [eax ecx]
 
//eax = (unsigned max)umax(eax,ebx)
int umax(int,int);
int32_t umax(int32_t,int32_t);
#pragma aux umax =\
"sub eax, ebx",\
"sbb ecx, ecx",\
2831,7 → 2831,7
parm nomemory [eax][ebx]\
modify exact [eax ecx]
 
int kmin(int,int);
int32_t kmin(int32_t,int32_t);
#pragma aux kmin =\
"cmp eax, ebx",\
"jl skipit",\
2840,7 → 2840,7
parm nomemory [eax][ebx]\
modify exact [eax]
 
int kmax(int,int);
int32_t kmax(int32_t,int32_t);
#pragma aux kmax =\
"cmp eax, ebx",\
"jg skipit",\
2849,7 → 2849,7
parm nomemory [eax][ebx]\
modify exact [eax]
 
int swapchar(void*,void*);
int32_t swapchar(void*,void*);
#pragma aux swapchar =\
"mov cl, [eax]",\
"mov ch, [ebx]",\
2858,7 → 2858,7
parm [eax][ebx]\
modify exact [ecx]
 
int swapshort(void*,void*);
int32_t swapshort(void*,void*);
#pragma aux swapshort =\
"mov cx, [eax]",\
"mov dx, [ebx]",\
2867,7 → 2867,7
parm [eax][ebx]\
modify exact [ecx edx]
 
int swaplong(void*,void*);
int32_t swaplong(void*,void*);
#pragma aux swaplong =\
"mov ecx, [eax]",\
"mov edx, [ebx]",\
2876,7 → 2876,7
parm [eax][ebx]\
modify exact [ecx edx]
 
int swapbuf4(void*,void*,int);
int32_t swapbuf4(void*,void*,int32_t);
#pragma aux swapbuf4 =\
"begswap:",\
"mov esi, [eax]",\
2890,7 → 2890,7
parm [eax][ebx][ecx]\
modify exact [eax ebx ecx esi edi]
 
int swap64bit(void*,void*);
int32_t swap64bit(void*,void*);
#pragma aux swap64bit =\
"mov ecx, [eax]",\
"mov edx, [ebx]",\
2905,7 → 2905,7
 
//swapchar2(ptr1,ptr2,xsiz); is the same as:
//swapchar(ptr1,ptr2); swapchar(ptr1+1,ptr2+xsiz);
int swapchar2(void*,void*,int);
int32_t swapchar2(void*,void*,int32_t);
#pragma aux swapchar2 =\
"add esi, ebx",\
"mov cx, [eax]",\
2925,7 → 2925,7
//
 
//{{{
static __inline int sqr(int a)
static __inline int32_t sqr(int32_t a)
{
_asm {
mov eax, a
2933,7 → 2933,7
}
}
 
static __inline int scale(int a, int d, int c)
static __inline int32_t scale(int32_t a, int32_t d, int32_t c)
{
_asm {
mov eax, a
2942,7 → 2942,7
}
}
 
static __inline int mulscale(int a, int d, int c)
static __inline int32_t mulscale(int32_t a, int32_t d, int32_t c)
{
_asm {
mov ecx, c
2953,7 → 2953,7
}
 
#define MULSCALE(x) \
static __inline int mulscale##x (int a, int d) \
static __inline int32_t mulscale##x (int32_t a, int32_t d) \
{ \
_asm mov eax, a \
_asm imul d \
2969,7 → 2969,7
MULSCALE(25) MULSCALE(26) MULSCALE(27) MULSCALE(28)
MULSCALE(29) MULSCALE(30) MULSCALE(31)
#undef MULSCALE
static __inline int mulscale32(int a, int d)
static __inline int32_t mulscale32(int32_t a, int32_t d)
{
_asm {
mov eax, a
2978,7 → 2978,7
}
}
 
static __inline int dmulscale(int a, int d, int S, int D, int c)
static __inline int32_t dmulscale(int32_t a, int32_t d, int32_t S, int32_t D, int32_t c)
{
_asm {
mov ecx, c
2995,7 → 2995,7
}
 
#define DMULSCALE(x) \
static __inline int dmulscale##x (int a, int d, int S, int D) \
static __inline int32_t dmulscale##x (int32_t a, int32_t d, int32_t S, int32_t D) \
{ \
_asm mov eax, a \
_asm imul d \
3017,7 → 3017,7
DMULSCALE(25) DMULSCALE(26) DMULSCALE(27) DMULSCALE(28)
DMULSCALE(29) DMULSCALE(30) DMULSCALE(31)
#undef DMULSCALE
static __inline int dmulscale32(int a, int d, int S, int D)
static __inline int32_t dmulscale32(int32_t a, int32_t d, int32_t S, int32_t D)
{
_asm {
mov eax, a
3033,7 → 3033,7
}
 
#define TMULSCALE(x) \
static __inline int tmulscale##x (int a, int d, int b, int c, int S, int D) \
static __inline int32_t tmulscale##x (int32_t a, int32_t d, int32_t b, int32_t c, int32_t S, int32_t D) \
{ \
_asm mov eax, a \
_asm mov ebx, b \
3060,7 → 3060,7
TMULSCALE(25) TMULSCALE(26) TMULSCALE(27) TMULSCALE(28)
TMULSCALE(29) TMULSCALE(30) TMULSCALE(31)
#undef TMULSCALE
static __inline int tmulscale32(int a, int d, int b, int c, int S, int D)
static __inline int32_t tmulscale32(int32_t a, int32_t d, int32_t b, int32_t c, int32_t S, int32_t D)
{
_asm {
mov eax, a
3080,7 → 3080,7
}
}
 
static __inline int boundmulscale(int a, int b, int c)
static __inline int32_t boundmulscale(int32_t a, int32_t b, int32_t c)
{
_asm {
mov eax, a
3103,7 → 3103,7
}
}
 
static __inline int divscale(int a, int b, int c)
static __inline int32_t divscale(int32_t a, int32_t b, int32_t c)
{
_asm {
mov eax, a
3116,7 → 3116,7
}
}
 
static __inline int divscale1(int a, int b)
static __inline int32_t divscale1(int32_t a, int32_t b)
{
_asm {
mov eax, a
3126,7 → 3126,7
}
}
 
static __inline int divscale2(int a, int b)
static __inline int32_t divscale2(int32_t a, int32_t b)
{
_asm {
mov eax, a
3137,7 → 3137,7
}
}
 
static __inline int divscale3(int a, int b)
static __inline int32_t divscale3(int32_t a, int32_t b)
{
_asm {
mov eax, a
3149,7 → 3149,7
}
 
#define DIVSCALE(x,y) \
static __inline int divscale##y(int a, int b) \
static __inline int32_t divscale##y(int32_t a, int32_t b) \
{ \
_asm mov eax, a \
_asm mov edx, eax \
3166,7 → 3166,7
DIVSCALE(8,24) DIVSCALE(7,25) DIVSCALE(6,26) DIVSCALE(5,27)
DIVSCALE(4,28) DIVSCALE(3,29) DIVSCALE(2,30) DIVSCALE(1,31)
 
static __inline int divscale32(int d, int b)
static __inline int32_t divscale32(int32_t d, int32_t b)
{
_asm {
mov edx, d
3192,7 → 3192,7
}
}
 
static __inline void drawpixels(void *d, short a)
static __inline void drawpixels(void *d, int16_t a)
{
_asm {
mov edx, d
3201,7 → 3201,7
}
}
 
static __inline void drawpixelses(void *d, int a)
static __inline void drawpixelses(void *d, int32_t a)
{
_asm {
mov edx, d
3210,7 → 3210,7
}
}
 
static __inline void clearbuf(void *d, int c, int a)
static __inline void clearbuf(void *d, int32_t c, int32_t a)
{
_asm {
mov edi, d
3220,7 → 3220,7
}
}
 
static __inline void clearbufbyte(void *d, int c, int a)
static __inline void clearbufbyte(void *d, int32_t c, int32_t a)
{
_asm {
mov edi, d
3260,7 → 3260,7
}
}
 
static __inline void copybuf(void *s, void *d, int c)
static __inline void copybuf(void *s, void *d, int32_t c)
{
_asm {
mov esi, s
3270,7 → 3270,7
}
}
 
static __inline void copybufbyte(void *s, void *d, int c)
static __inline void copybufbyte(void *s, void *d, int32_t c)
{
_asm {
mov esi, s
3310,7 → 3310,7
}
}
 
static __inline void copybufreverse(void *s, void *d, int c)
static __inline void copybufreverse(void *s, void *d, int32_t c)
{
_asm {
mov esi, s
3345,7 → 3345,7
}
}
 
static __inline void qinterpolatedown16(int a, int c, int d, int s)
static __inline void qinterpolatedown16(int32_t a, int32_t c, int32_t d, int32_t s)
{
_asm {
mov eax, a
3374,7 → 3374,7
}
}
 
static __inline void qinterpolatedown16short(int a, int c, int d, int s)
static __inline void qinterpolatedown16short(int32_t a, int32_t c, int32_t d, int32_t s)
{
_asm {
mov eax, a
3417,7 → 3417,7
}
}
 
static __inline int mul3(int a)
static __inline int32_t mul3(int32_t a)
{
_asm {
mov eax, a
3425,7 → 3425,7
}
}
 
static __inline int mul5(int a)
static __inline int32_t mul5(int32_t a)
{
_asm {
mov eax, a
3433,7 → 3433,7
}
}
 
static __inline int mul9(int a)
static __inline int32_t mul9(int32_t a)
{
_asm {
mov eax, a
3442,7 → 3442,7
}
 
//returns eax/ebx, dmval = eax%edx;
static __inline int divmod(int a, int b)
static __inline int32_t divmod(int32_t a, int32_t b)
{
_asm {
mov eax, a
3453,7 → 3453,7
}
 
//returns eax%ebx, dmval = eax/edx;
static __inline int moddiv(int a, int b)
static __inline int32_t moddiv(int32_t a, int32_t b)
{
_asm {
mov eax, a
3464,7 → 3464,7
}
}
 
static __inline int klabs(int a)
static __inline int32_t klabs(int32_t a)
{
_asm {
mov eax, a
3475,7 → 3475,7
}
}
 
static __inline int ksgn(int b)
static __inline int32_t ksgn(int32_t b)
{
_asm {
mov ebx, b
3487,7 → 3487,7
}
 
//eax = (unsigned min)umin(eax,ebx)
static __inline int umin(int a, int b)
static __inline int32_t umin(int32_t a, int32_t b)
{
_asm {
mov eax, a
3499,7 → 3499,7
}
 
//eax = (unsigned max)umax(eax,ebx)
static __inline int umax(int a, int b)
static __inline int32_t umax(int32_t a, int32_t b)
{
_asm {
mov eax, a
3511,7 → 3511,7
}
}
 
static __inline int kmin(int a, int b)
static __inline int32_t kmin(int32_t a, int32_t b)
{
_asm {
mov eax, a
3523,7 → 3523,7
}
}
 
static __inline int kmax(int a, int b)
static __inline int32_t kmax(int32_t a, int32_t b)
{
_asm {
mov eax, a
3571,7 → 3571,7
}
}
 
static __inline void swapbuf4(void *a, void *b, int c)
static __inline void swapbuf4(void *a, void *b, int32_t c)
{
_asm {
mov eax, a
3585,7 → 3585,7
add eax, 4
add ebx, 4
dec ecx
jnz short begswap
jnz int16_t begswap
}
}
 
3607,7 → 3607,7
 
//swapchar2(ptr1,ptr2,xsiz); is the same as:
//swapchar(ptr1,ptr2); swapchar(ptr1+1,ptr2+xsiz);
static __inline void swapchar2(void *a, void *b, int s)
static __inline void swapchar2(void *a, void *b, int32_t s)
{
_asm {
mov eax, a
3631,27 → 3631,27
//
 
#define qw(x) ((int64)(x)) // quadword cast
#define dw(x) ((int)(x)) // doubleword cast
#define wo(x) ((short)(x)) // word cast
#define by(x) ((char)(x)) // byte cast
#define dw(x) ((int32_t)(x)) // doubleword cast
#define wo(x) ((int16_t)(x)) // word cast
#define by(x) ((uint8_t)(x)) // byte cast
 
#define _scaler(a) \
static inline int mulscale##a(int eax, int edx) \
static inline int32_t mulscale##a(int32_t eax, int32_t edx) \
{ \
return dw((qw(eax) * qw(edx)) >> a); \
} \
\
static inline int divscale##a(int eax, int ebx) \
static inline int32_t divscale##a(int32_t eax, int32_t ebx) \
{ \
return dw((qw(eax) << a) / qw(ebx)); \
} \
\
static inline int dmulscale##a(int eax, int edx, int esi, int edi) \
static inline int32_t dmulscale##a(int32_t eax, int32_t edx, int32_t esi, int32_t edi) \
{ \
return dw(((qw(eax) * qw(edx)) + (qw(esi) * qw(edi))) >> a); \
} \
\
static inline int tmulscale##a(int eax, int edx, int ebx, int ecx, int esi, int edi) \
static inline int32_t tmulscale##a(int32_t eax, int32_t edx, int32_t ebx, int32_t ecx, int32_t esi, int32_t edi) \
{ \
return dw(((qw(eax) * qw(edx)) + (qw(ebx) * qw(ecx)) + (qw(esi) * qw(edi))) >> a); \
} \
3666,44 → 3666,44
_scaler(29) _scaler(30) _scaler(31) _scaler(32)
 
static inline void swapchar(void* a, void* b) { char t = *((char*)b); *((char*)b) = *((char*)a); *((char*)a) = t; }
static inline void swapchar2(void* a, void* b, int s) { swapchar(a,b); swapchar((char*)a+1,(char*)b+s); }
static inline void swapshort(void* a, void* b) { short t = *((short*)b); *((short*)b) = *((short*)a); *((short*)a) = t; }
static inline void swaplong(void* a, void* b) { int t = *((int*)b); *((int*)b) = *((int*)a); *((int*)a) = t; }
static inline void swapchar2(void* a, void* b, int32_t s) { swapchar(a,b); swapchar((char*)a+1,(char*)b+s); }
static inline void swapshort(void* a, void* b) { int16_t t = *((int16_t*)b); *((int16_t*)b) = *((int16_t*)a); *((int16_t*)a) = t; }
static inline void swaplong(void* a, void* b) { int32_t t = *((int32_t*)b); *((int32_t*)b) = *((int32_t*)a); *((int32_t*)a) = t; }
static inline void swap64bit(void* a, void* b) { int64 t = *((int64*)b); *((int64*)b) = *((int64*)a); *((int64*)a) = t; }
 
static inline char readpixel(void* s) { return (*((char*)(s))); }
static inline void drawpixel(void* s, char a) { *((char*)(s)) = a; }
static inline void drawpixels(void* s, short a) { *((short*)(s)) = a; }
static inline void drawpixelses(void* s, int a) { *((int*)(s)) = a; }
static inline void drawpixels(void* s, int16_t a) { *((int16_t*)(s)) = a; }
static inline void drawpixelses(void* s, int32_t a) { *((int32_t*)(s)) = a; }
 
static inline int mul3(int a) { return (a<<1)+a; }
static inline int mul5(int a) { return (a<<2)+a; }
static inline int mul9(int a) { return (a<<3)+a; }
static inline int32_t mul3(int32_t a) { return (a<<1)+a; }
static inline int32_t mul5(int32_t a) { return (a<<2)+a; }
static inline int32_t mul9(int32_t a) { return (a<<3)+a; }
 
static inline int divmod(int a, int b) { unsigned int _a=(unsigned int)a, _b=(unsigned int)b; dmval = _a%_b; return _a/_b; }
static inline int moddiv(int a, int b) { unsigned int _a=(unsigned int)a, _b=(unsigned int)b; dmval = _a/_b; return _a%_b; }
static inline int32_t divmod(int32_t a, int32_t b) { uint32_t _a=(uint32_t)a, _b=(uint32_t)b; dmval = _a%_b; return _a/_b; }
static inline int32_t moddiv(int32_t a, int32_t b) { uint32_t _a=(uint32_t)a, _b=(uint32_t)b; dmval = _a/_b; return _a%_b; }
 
static inline int klabs(int a) { if (a < 0) return -a; return a; }
static inline int ksgn(int a) { if (a > 0) return 1; if (a < 0) return -1; return 0; }
static inline int32_t klabs(int32_t a) { if (a < 0) return -a; return a; }
static inline int32_t ksgn(int32_t a) { if (a > 0) return 1; if (a < 0) return -1; return 0; }
 
static inline int umin(int a, int b) { if ((unsigned int)a < (unsigned int)b) return a; return b; }
static inline int umax(int a, int b) { if ((unsigned int)a < (unsigned int)b) return b; return a; }
static inline int kmin(int a, int b) { if ((signed int)a < (signed int)b) return a; return b; }
static inline int kmax(int a, int b) { if ((signed int)a < (signed int)b) return b; return a; }
static inline int32_t umin(int32_t a, int32_t b) { if ((uint32_t)a < (uint32_t)b) return a; return b; }
static inline int32_t umax(int32_t a, int32_t b) { if ((uint32_t)a < (uint32_t)b) return b; return a; }
static inline int32_t kmin(int32_t a, int32_t b) { if ((int32_t)a < (int32_t)b) return a; return b; }
static inline int32_t kmax(int32_t a, int32_t b) { if ((int32_t)a < (int32_t)b) return b; return a; }
 
static inline int sqr(int eax) { return (eax) * (eax); }
static inline int scale(int eax, int edx, int ecx) { return dw((qw(eax) * qw(edx)) / qw(ecx)); }
static inline int mulscale(int eax, int edx, int ecx) { return dw((qw(eax) * qw(edx)) >> by(ecx)); }
static inline int divscale(int eax, int ebx, int ecx) { return dw((qw(eax) << by(ecx)) / qw(ebx)); }
static inline int dmulscale(int eax, int edx, int esi, int edi, int ecx) { return dw(((qw(eax) * qw(edx)) + (qw(esi) * qw(edi))) >> by(ecx)); }
static inline int32_t sqr(int32_t eax) { return (eax) * (eax); }
static inline int32_t scale(int32_t eax, int32_t edx, int32_t ecx) { return dw((qw(eax) * qw(edx)) / qw(ecx)); }
static inline int32_t mulscale(int32_t eax, int32_t edx, int32_t ecx) { return dw((qw(eax) * qw(edx)) >> by(ecx)); }
static inline int32_t divscale(int32_t eax, int32_t ebx, int32_t ecx) { return dw((qw(eax) << by(ecx)) / qw(ebx)); }
static inline int32_t dmulscale(int32_t eax, int32_t edx, int32_t esi, int32_t edi, int32_t ecx) { return dw(((qw(eax) * qw(edx)) + (qw(esi) * qw(edi))) >> by(ecx)); }
 
static inline int boundmulscale(int a, int d, int c)
static inline int32_t boundmulscale(int32_t a, int32_t d, int32_t c)
{ // courtesy of Ken
int64 p;
p = (((int64)a)*((int64)d))>>c;
if (p >= longlong(2147483647)) p = longlong(2147483647);
if (p < longlong(-2147483648)) p = longlong(-2147483648);
return((int)p);
return((int32_t)p);
}
 
#undef qw
3712,16 → 3712,16
#undef by
#undef _scaler
 
void qinterpolatedown16 (intptr_t bufptr, int num, int val, int add);
void qinterpolatedown16short (intptr_t bufptr, int num, int val, int add);
void qinterpolatedown16 (intptr_t bufptr, int32_t num, int32_t val, int32_t add);
void qinterpolatedown16short (intptr_t bufptr, int32_t num, int32_t val, int32_t add);
 
void clearbuf(void* d, int c, int a);
void copybuf(void* s, void* d, int c);
void swapbuf4(void* a, void* b, int c);
void clearbuf(void* d, int32_t c, int32_t a);
void copybuf(void* s, void* d, int32_t c);
void swapbuf4(void* a, void* b, int32_t c);
 
void clearbufbyte(void *D, int c, int a);
void copybufbyte(void *S, void *D, int c);
void copybufreverse(void *S, void *D, int c);
void clearbufbyte(void *D, int32_t c, int32_t a);
void copybufbyte(void *S, void *D, int32_t c);
void copybufreverse(void *S, void *D, int32_t c);
 
#endif
 
/polymer/eduke32/build/include/scriptfile.h
1,27 → 1,27
typedef struct {
char *textbuf;
unsigned int textlength;
uint32_t textlength;
char *ltextptr; // pointer to start of the last token fetched (use this for line numbers)
char *textptr;
char *eof;
char *filename;
int linenum;
int *lineoffs;
int32_t linenum;
int32_t *lineoffs;
} scriptfile;
 
char *scriptfile_gettoken(scriptfile *sf);
int scriptfile_getnumber(scriptfile *sf, int *num);
int scriptfile_getdouble(scriptfile *sf, double *num);
int scriptfile_getstring(scriptfile *sf, char **st);
int scriptfile_getsymbol(scriptfile *sf, int *num);
int scriptfile_getlinum(scriptfile *sf, char *ptr);
int scriptfile_getbraces(scriptfile *sf, char **braceend);
int32_t scriptfile_getnumber(scriptfile *sf, int32_t *num);
int32_t scriptfile_getdouble(scriptfile *sf, double *num);
int32_t scriptfile_getstring(scriptfile *sf, char **st);
int32_t scriptfile_getsymbol(scriptfile *sf, int32_t *num);
int32_t scriptfile_getlinum(scriptfile *sf, char *ptr);
int32_t scriptfile_getbraces(scriptfile *sf, char **braceend);
 
scriptfile *scriptfile_fromfile(char *fn);
scriptfile *scriptfile_fromstring(char *string);
void scriptfile_close(scriptfile *sf);
int scriptfile_eof(scriptfile *sf);
int32_t scriptfile_eof(scriptfile *sf);
 
int scriptfile_getsymbolvalue(char *name, int *val);
int scriptfile_addsymbolvalue(char *name, int val);
int32_t scriptfile_getsymbolvalue(char *name, int32_t *val);
int32_t scriptfile_addsymbolvalue(char *name, int32_t val);
void scriptfile_clearsymbols(void);
/polymer/eduke32/build/include/sdlayer.h
8,9 → 8,9
#include "baselayer.h"
 
struct sdlappicon {
int width,height;
unsigned int *pixels;
unsigned char *mask;
int32_t width,height;
uint32_t *pixels;
char *mask;
};
 
#else
/polymer/eduke32/build/include/winlayer.h
5,16 → 5,16
#ifndef __build_interface_layer__
#define __build_interface_layer__ WIN
 
extern int backgroundidle; // set to 1 to tell winlayer to go to idle priority when inactive
extern int32_t backgroundidle; // set to 1 to tell winlayer to go to idle priority when inactive
extern unsigned maxrefreshfreq;
 
extern int glusecds;
extern int32_t glusecds;
 
int win_gethwnd(void);
int win_gethinstance(void);
int32_t win_gethwnd(void);
int32_t win_gethinstance(void);
 
void win_allowtaskswitching(int onf);
int win_checkinstance(void);
void win_allowtaskswitching(int32_t onf);
int32_t win_checkinstance(void);
 
#include "baselayer.h"
 
/polymer/eduke32/build/src/a-c.c
10,21 → 10,21
 
#ifdef ENGINE_USING_A_C
 
int krecip(int num); // from engine.c
int32_t krecip(int32_t num); // from engine.c
 
#define BITSOFPRECISION 3
#define BITSOFPRECISIONPOW 8
 
extern intptr_t asm1, asm2, asm3, asm4;
extern int fpuasm, globalx3, globaly3;
extern int32_t fpuasm, globalx3, globaly3;
extern void *reciptable;
 
static int bpl, transmode = 0;
static int glogx, glogy, gbxinc, gbyinc, gpinc;
static int32_t bpl, transmode = 0;
static int32_t glogx, glogy, gbxinc, gbyinc, gpinc;
static char *gbuf, *gpal, *ghlinepal, *gtrans;
 
//Global variable functions
void setvlinebpl(int dabpl) { bpl = dabpl; }
void setvlinebpl(int32_t dabpl) { bpl = dabpl; }
void fixtransluscence(intptr_t datransoff) { gtrans = (char *)datransoff; }
void settransnormal(void) { transmode = 0; }
void settransreverse(void) { transmode = 1; }
31,11 → 31,11
 
 
//Ceiling/floor horizontal line functions
void sethlinesizes(int logx, int logy, intptr_t bufplc)
void sethlinesizes(int32_t logx, int32_t logy, intptr_t bufplc)
{ glogx = logx; glogy = logy; gbuf = (char *)bufplc; }
void setpalookupaddress(char *paladdr) { ghlinepal = paladdr; }
void setuphlineasm4(int bxinc, int byinc) { gbxinc = bxinc; gbyinc = byinc; }
void hlineasm4(int cnt, int skiploadincs, int paloffs, unsigned int by, unsigned int bx, intptr_t p)
void setuphlineasm4(int32_t bxinc, int32_t byinc) { gbxinc = bxinc; gbyinc = byinc; }
void hlineasm4(int32_t cnt, int32_t skiploadincs, int32_t paloffs, uint32_t by, uint32_t bx, intptr_t p)
{
char *palptr;
 
52,18 → 52,18
 
 
//Sloped ceiling/floor vertical line functions
void setupslopevlin(int logylogx, intptr_t bufplc, int pinc)
void setupslopevlin(int32_t logylogx, intptr_t bufplc, int32_t pinc)
{
glogx = (logylogx&255); glogy = (logylogx>>8);
gbuf = (char *)bufplc; gpinc = pinc;
}
void slopevlin(intptr_t p, int i, intptr_t slopaloffs, int cnt, int bx, int by)
void slopevlin(intptr_t p, int32_t i, intptr_t slopaloffs, int32_t cnt, int32_t bx, int32_t by)
{
int *slopalptr, bz, bzinc;
unsigned int u, v;
int32_t *slopalptr, bz, bzinc;
uint32_t u, v;
 
bz = asm3; bzinc = (asm1>>3);
slopalptr = (int*)slopaloffs;
slopalptr = (int32_t*)slopaloffs;
for (;cnt>0;cnt--)
{
i = krecip(bz>>6); bz += bzinc;
77,8 → 77,8
 
 
//Wall,face sprite/wall sprite vertical line functions
void setupvlineasm(int neglogy) { glogy = neglogy; }
void vlineasm1(int vinc, intptr_t paloffs, int cnt, unsigned int vplc, intptr_t bufplc, intptr_t p)
void setupvlineasm(int32_t neglogy) { glogy = neglogy; }
void vlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p)
{
gbuf = (char *)bufplc;
gpal = (char *)paloffs;
90,8 → 90,8
}
}
 
void setupmvlineasm(int neglogy) { glogy = neglogy; }
void mvlineasm1(int vinc, intptr_t paloffs, int cnt, unsigned int vplc, intptr_t bufplc, intptr_t p)
void setupmvlineasm(int32_t neglogy) { glogy = neglogy; }
void mvlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p)
{
char ch;
 
105,8 → 105,8
}
}
 
void setuptvlineasm(int neglogy) { glogy = neglogy; }
void tvlineasm1(int vinc, intptr_t paloffs, int cnt, unsigned int vplc, intptr_t bufplc, intptr_t p)
void setuptvlineasm(int32_t neglogy) { glogy = neglogy; }
void tvlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p)
{
char ch;
 
135,8 → 135,8
}
 
//Floor sprite horizontal line functions
void msethlineshift(int logx, int logy) { glogx = logx; glogy = logy; }
void mhline(intptr_t bufplc, unsigned int bx, int cntup16, int junk, unsigned int by, intptr_t p)
void msethlineshift(int32_t logx, int32_t logy) { glogx = logx; glogy = logy; }
void mhline(intptr_t bufplc, uint32_t bx, int32_t cntup16, int32_t junk, uint32_t by, intptr_t p)
{
char ch;
 
152,8 → 152,8
}
}
 
void tsethlineshift(int logx, int logy) { glogx = logx; glogy = logy; }
void thline(intptr_t bufplc, unsigned int bx, int cntup16, int junk, unsigned int by, intptr_t p)
void tsethlineshift(int32_t logx, int32_t logy) { glogx = logx; glogy = logy; }
void thline(intptr_t bufplc, uint32_t bx, int32_t cntup16, int32_t junk, uint32_t by, intptr_t p)
{
char ch;
 
185,7 → 185,7
 
 
//Rotatesprite vertical line functions
void setupspritevline(intptr_t paloffs, int bxinc, int byinc, int ysiz)
void setupspritevline(intptr_t paloffs, int32_t bxinc, int32_t byinc, int32_t ysiz)
{
gpal = (char *)paloffs;
gbxinc = bxinc;
192,7 → 192,7
gbyinc = byinc;
glogy = ysiz;
}
void spritevline(int bx, int by, int cnt, intptr_t bufplc, intptr_t p)
void spritevline(int32_t bx, int32_t by, int32_t cnt, intptr_t bufplc, intptr_t p)
{
gbuf = (char *)bufplc;
for (;cnt>1;cnt--)
205,7 → 205,7
}
 
//Rotatesprite vertical line functions
void msetupspritevline(intptr_t paloffs, int bxinc, int byinc, int ysiz)
void msetupspritevline(intptr_t paloffs, int32_t bxinc, int32_t byinc, int32_t ysiz)
{
gpal = (char *)paloffs;
gbxinc = bxinc;
212,7 → 212,7
gbyinc = byinc;
glogy = ysiz;
}
void mspritevline(int bx, int by, int cnt, intptr_t bufplc, intptr_t p)
void mspritevline(int32_t bx, int32_t by, int32_t cnt, intptr_t bufplc, intptr_t p)
{
char ch;
 
227,7 → 227,7
}
}
 
void tsetupspritevline(intptr_t paloffs, int bxinc, int byinc, int ysiz)
void tsetupspritevline(intptr_t paloffs, int32_t bxinc, int32_t byinc, int32_t ysiz)
{
gpal = (char *)paloffs;
gbxinc = bxinc;
234,7 → 234,7
gbyinc = byinc;
glogy = ysiz;
}
void tspritevline(int bx, int by, int cnt, intptr_t bufplc, intptr_t p)
void tspritevline(int32_t bx, int32_t by, int32_t cnt, intptr_t bufplc, intptr_t p)
{
char ch;
 
263,21 → 263,21
}
}
 
void setupdrawslab(int dabpl, intptr_t pal)
void setupdrawslab(int32_t dabpl, intptr_t pal)
{ bpl = dabpl; gpal = (char *)pal; }
 
void drawslab(int dx, int v, int dy, int vi, intptr_t vptr, intptr_t p)
void drawslab(int32_t dx, int32_t v, int32_t dy, int32_t vi, intptr_t vptr, intptr_t p)
{
int x;
int32_t x;
 
while (dy > 0)
{
for (x=0;x<dx;x++) *(char *)(p+x) = gpal[(int)(*(char *)((v>>16)+vptr))];
for (x=0;x<dx;x++) *(char *)(p+x) = gpal[(int32_t)(*(char *)((v>>16)+vptr))];
p += bpl; v += vi; dy--;
}
}
 
void stretchhline(intptr_t p0, int u, int cnt, int uinc, intptr_t rptr, intptr_t p)
void stretchhline(intptr_t p0, int32_t u, int32_t cnt, int32_t uinc, intptr_t rptr, intptr_t p)
{
p0 = p-(cnt<<2);
do
/polymer/eduke32/build/src/baselayer.c
47,9 → 47,9
};
#endif
 
char *strtolower(char *str, int len)
char *strtolower(char *str, int32_t len)
{
int i = 0;
int32_t i = 0;
if (len <= 0) return str;
do
{
60,15 → 60,15
return str;
}
 
int flushlogwindow = 0;
int32_t flushlogwindow = 0;
 
static void onvideomodechange(int newmode) { UNREFERENCED_PARAMETER(newmode); }
void (*baselayer_onvideomodechange)(int) = onvideomodechange;
static void onvideomodechange(int32_t newmode) { UNREFERENCED_PARAMETER(newmode); }
void (*baselayer_onvideomodechange)(int32_t) = onvideomodechange;
 
#if defined(POLYMOST)
static int osdfunc_setrendermode(const osdfuncparm_t *parm)
static int32_t osdfunc_setrendermode(const osdfuncparm_t *parm)
{
int m;
int32_t m;
char *p;
 
char *modestrs[] =
89,9 → 89,9
}
#if defined(USE_OPENGL)
#ifdef DEBUGGINGAIDS
static int osdcmd_hicsetpalettetint(const osdfuncparm_t *parm)
static int32_t osdcmd_hicsetpalettetint(const osdfuncparm_t *parm)
{
int pal, cols[3], eff;
int32_t pal, cols[3], eff;
 
if (parm->numparms != 5) return OSDCMD_SHOWHELP;
 
107,7 → 107,7
}
#endif
 
int osdcmd_glinfo(const osdfuncparm_t *parm)
int32_t osdcmd_glinfo(const osdfuncparm_t *parm)
{
char *s,*t,*u,i;
 
191,9 → 191,9
#endif
#endif
 
static int osdcmd_vars(const osdfuncparm_t *parm)
static int32_t osdcmd_vars(const osdfuncparm_t *parm)
{
int showval = (parm->numparms < 1);
int32_t showval = (parm->numparms < 1);
 
if (!Bstrcasecmp(parm->name, "r_scrcaptureformat"))
{
201,7 → 201,7
if (showval) { OSD_Printf("r_scrcaptureformat is %s\n", fmts[captureformat]); }
else
{
int j;
int32_t j;
for (j=0; j<2; j++)
if (!Bstrcasecmp(parm->parms[0], fmts[j])) break;
if (j == 2) return OSDCMD_SHOWHELP;
224,7 → 224,7
return OSDCMD_SHOWHELP;
}
 
int baselayer_init(void)
int32_t baselayer_init(void)
{
#ifdef POLYMOST
OSD_RegisterFunction("setrendermode","setrendermode <number>: sets the engine's rendering mode.\n"
/polymer/eduke32/build/src/build.c
22,12 → 22,12
 
#define TIMERINTSPERSECOND 120
 
#define updatecrc16(crc,dat) (crc = (((crc<<8)&65535)^crctable[((((unsigned short)crc)>>8)&65535)^dat]))
static int crctable[256];
#define updatecrc16(crc,dat) (crc = (((crc<<8)&65535)^crctable[((((uint16_t)crc)>>8)&65535)^dat]))
static int32_t crctable[256];
static char kensig[64];
 
extern int ExtInit(void);
extern int ExtPreInit(int argc,const char **argv);
extern int32_t ExtInit(void);
extern int32_t ExtPreInit(int32_t argc,const char **argv);
extern void ExtUnInit(void);
extern void ExtPreCheckKeys(void);
#ifdef SUPERBUILD
36,22 → 36,22
extern void ExtCheckKeys(void);
extern void ExtLoadMap(const char *mapname);
extern void ExtSaveMap(const char *mapname);
extern const char *ExtGetSectorCaption(short sectnum);
extern const char *ExtGetWallCaption(short wallnum);
extern const char *ExtGetSpriteCaption(short spritenum);
extern void ExtShowSectorData(short sectnum);
extern void ExtShowWallData(short wallnum);
extern void ExtShowSpriteData(short spritenum);
extern void ExtEditSectorData(short sectnum);
extern void ExtEditWallData(short wallnum);
extern void ExtEditSpriteData(short spritenum);
extern const char *ExtGetSectorType(int lotag);
extern const char *ExtGetSectorCaption(int16_t sectnum);
extern const char *ExtGetWallCaption(int16_t wallnum);
extern const char *ExtGetSpriteCaption(int16_t spritenum);
extern void ExtShowSectorData(int16_t sectnum);
extern void ExtShowWallData(int16_t wallnum);
extern void ExtShowSpriteData(int16_t spritenum);
extern void ExtEditSectorData(int16_t sectnum);
extern void ExtEditWallData(int16_t wallnum);
extern void ExtEditSpriteData(int16_t spritenum);
extern const char *ExtGetSectorType(int32_t lotag);
 
extern char spritecol2d[MAXTILES][2];
 
char noclip=0;
 
int vel, svel, angvel;
int32_t vel, svel, angvel;
 
// 0 1 2 3 4 5 6 7
// up, down, left, right, lshift, rctrl, lctrl, space
59,7 → 59,7
// a, z, pgdn, pgup, [,], [.]
// 14 15 16 17 18 19
// kpenter, enter, =, -, tab, `
unsigned char buildkeys[NUMBUILDKEYS] =
uint8_t buildkeys[NUMBUILDKEYS] =
{
0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39,
0x1e,0x2c,0xd1,0xc9,0x33,0x34,
66,86 → 66,86
0x9c,0x1c,0xd,0xc,0xf,0x29
};
 
int posx, posy, posz, horiz = 100;
int mousexsurp = 0, mouseysurp = 0;
short ang, cursectnum;
int hvel;
int32_t posx, posy, posz, horiz = 100;
int32_t mousexsurp = 0, mouseysurp = 0;
int16_t ang, cursectnum;
int32_t hvel;
 
int grponlymode = 0;
extern int editorgridextent; // in engine.c
int32_t grponlymode = 0;
extern int32_t editorgridextent; // in engine.c
extern double msens;
int graphicsmode = 0;
extern int xyaspect;
extern int totalclocklock;
int32_t graphicsmode = 0;
extern int32_t xyaspect;
extern int32_t totalclocklock;
 
int synctics = 0, lockclock = 0;
int32_t synctics = 0, lockclock = 0;
 
extern char vgacompatible;
 
extern char picsiz[MAXTILES];
extern int startposx, startposy, startposz;
extern short startang, startsectnum;
extern int ydim16, halfxdim16, midydim16;
extern int32_t startposx, startposy, startposz;
extern int16_t startang, startsectnum;
extern int32_t ydim16, halfxdim16, midydim16;
extern intptr_t frameplace;
int xdim2d = 640, ydim2d = 480, xdimgame = 640, ydimgame = 480, bppgame = 8;
int forcesetup = 1;
int32_t xdim2d = 640, ydim2d = 480, xdimgame = 640, ydimgame = 480, bppgame = 8;
int32_t forcesetup = 1;
 
extern int cachesize, artsize;
extern int32_t cachesize, artsize;
 
static short oldmousebstatus = 0;
short brightness = 0;
static int16_t oldmousebstatus = 0;
int16_t brightness = 0;
char game_executable[BMAX_PATH] = DEFAULT_GAME_LOCAL_EXEC;
int zlock = 0x7fffffff, zmode = 0, whitecol, kensplayerheight = 32;
short defaultspritecstat = 0;
int32_t zlock = 0x7fffffff, zmode = 0, whitecol, kensplayerheight = 32;
int16_t defaultspritecstat = 0;
 
short localartfreq[MAXTILES];
short localartlookup[MAXTILES], localartlookupnum;
int16_t localartfreq[MAXTILES];
int16_t localartlookup[MAXTILES], localartlookupnum;
 
char tempbuf[4096];
 
char names[MAXTILES][25];
 
short asksave = 0;
extern short editstatus, searchit;
extern int searchx, searchy; //search input
extern short searchsector, searchwall, searchstat; //search output
int osearchx, osearchy; //old search input
int16_t asksave = 0;
extern int16_t editstatus, searchit;
extern int32_t searchx, searchy; //search input
extern int16_t searchsector, searchwall, searchstat; //search output
int32_t osearchx, osearchy; //old search input
 
extern short pointhighlight, linehighlight, highlightcnt;
short grid = 3, gridlock = 1, showtags = 1;
int zoom = 768, gettilezoom = 1;
int lastpm16time;
extern int16_t pointhighlight, linehighlight, highlightcnt;
int16_t grid = 3, gridlock = 1, showtags = 1;
int32_t zoom = 768, gettilezoom = 1;
int32_t lastpm16time;
 
int numsprites;
extern int mapversion;
int32_t numsprites;
extern int32_t mapversion;
 
short highlight[MAXWALLS];
short highlightsector[MAXSECTORS], highlightsectorcnt = -1;
int16_t highlight[MAXWALLS];
int16_t highlightsector[MAXSECTORS], highlightsectorcnt = -1;
extern char textfont[128][8];
 
char pskysearch[MAXSECTORS];
 
int temppicnum, tempcstat, templotag, temphitag, tempextra;
unsigned int temppal, tempvis, tempxrepeat, tempyrepeat;
int tempshade, tempxvel, tempyvel, tempzvel;
unsigned char somethingintab = 255;
int32_t temppicnum, tempcstat, templotag, temphitag, tempextra;
uint32_t temppal, tempvis, tempxrepeat, tempyrepeat;
int32_t tempshade, tempxvel, tempyvel, tempzvel;
char somethingintab = 255;
 
int mlook = 0,mskip=0;
int revertCTRL=0,scrollamount=3;
int unrealedlook=1, quickmapcycling=1; //PK
int32_t mlook = 0,mskip=0;
int32_t revertCTRL=0,scrollamount=3;
int32_t unrealedlook=1, quickmapcycling=1; //PK
 
static char boardfilename[BMAX_PATH], selectedboardfilename[BMAX_PATH];
 
static CACHE1D_FIND_REC *finddirs=NULL, *findfiles=NULL, *finddirshigh=NULL, *findfileshigh=NULL;
static int numdirs=0, numfiles=0;
static int currentlist=0;
static int32_t numdirs=0, numfiles=0;
static int32_t currentlist=0;
 
//static int repeatcountx, repeatcounty;
//static int32_t repeatcountx, repeatcounty;
 
static int fillist[640];
static int32_t fillist[640];
 
int mousx, mousy;
short prefixtiles[16] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
int32_t mousx, mousy;
int16_t prefixtiles[16] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
/*
static char scantoasc[128] =
{
170,54 → 170,54
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
*/
int pk_turnaccel=16;
int pk_turndecel=12;
int pk_uedaccel=3;
int32_t pk_turnaccel=16;
int32_t pk_turndecel=12;
int32_t pk_uedaccel=3;
 
char changechar(char dachar, int dadir, char smooshyalign, char boundcheck);
int adjustmark(int *xplc, int *yplc, short danumwalls);
int checkautoinsert(int dax, int day, short danumwalls);
char changechar(char dachar, int32_t dadir, char smooshyalign, char boundcheck);
int32_t adjustmark(int32_t *xplc, int32_t *yplc, int16_t danumwalls);
int32_t checkautoinsert(int32_t dax, int32_t day, int16_t danumwalls);
void keytimerstuff(void);
int clockdir(short wallstart);
void flipwalls(short numwalls, short newnumwalls);
void insertpoint(short linehighlight, int dax, int day);
void deletepoint(short point);
int deletesector(short sucksect);
int checksectorpointer(short i, short sectnum);
void fixrepeats(short i);
short loopinside(int x, int y, short startwall);
int fillsector(short sectnum, char fillcolor);
short whitelinescan(short dalinehighlight);
void printcoords16(int posxe, int posye, short ange);
void copysector(short soursector, short destsector, short deststartwall, char copystat);
void showsectordata(short sectnum);
void showwalldata(short wallnum);
void showspritedata(short spritenum);
int drawtilescreen(int pictopleft, int picbox);
int32_t clockdir(int16_t wallstart);
void flipwalls(int16_t numwalls, int16_t newnumwalls);
void insertpoint(int16_t linehighlight, int32_t dax, int32_t day);
void deletepoint(int16_t point);
int32_t deletesector(int16_t sucksect);
int32_t checksectorpointer(int16_t i, int16_t sectnum);
void fixrepeats(int16_t i);
int16_t loopinside(int32_t x, int32_t y, int16_t startwall);
int32_t fillsector(int16_t sectnum, char fillcolor);
int16_t whitelinescan(int16_t dalinehighlight);
void printcoords16(int32_t posxe, int32_t posye, int16_t ange);
void copysector(int16_t soursector, int16_t destsector, int16_t deststartwall, char copystat);
void showsectordata(int16_t sectnum);
void showwalldata(int16_t wallnum);
void showspritedata(int16_t spritenum);
int32_t drawtilescreen(int32_t pictopleft, int32_t picbox);
void overheadeditor(void);
int getlinehighlight(int xplc, int yplc, int line);
int32_t getlinehighlight(int32_t xplc, int32_t yplc, int32_t line);
void fixspritesectors(void);
int movewalls(int start, int offs);
int loadnames(void);
int32_t movewalls(int32_t start, int32_t offs);
int32_t loadnames(void);
void updatenumsprites(void);
void getclosestpointonwall(int x, int y, int dawall, int *nx, int *ny);
void getclosestpointonwall(int32_t x, int32_t y, int32_t dawall, int32_t *nx, int32_t *ny);
void initcrc(void);
void AutoAlignWalls(int nWall0, int ply);
int gettile(int tilenum);
void AutoAlignWalls(int32_t nWall0, int32_t ply);
int32_t gettile(int32_t tilenum);
 
int menuselect(void);
int32_t menuselect(void);
 
int menuselect_pk(int); //PK
int32_t menuselect_pk(int32_t); //PK
 
int getfilenames(char *path, char *kind);
int32_t getfilenames(char *path, char *kind);
void clearfilenames(void);
void loadmhk();
 
void clearkeys(void) { memset(keystatus,0,sizeof(keystatus)); }
 
static int osdcmd_restartvid(const osdfuncparm_t *parm)
static int32_t osdcmd_restartvid(const osdfuncparm_t *parm)
{
extern int qsetmode;
extern int32_t qsetmode;
 
UNREFERENCED_PARAMETER(parm);
 
230,10 → 230,10
return OSDCMD_OK;
}
 
static int osdcmd_vidmode(const osdfuncparm_t *parm)
static int32_t osdcmd_vidmode(const osdfuncparm_t *parm)
{
int newx = xdim, newy = ydim, newbpp = bpp, newfullscreen = fullscreen;
extern int qsetmode;
int32_t newx = xdim, newy = ydim, newbpp = bpp, newfullscreen = fullscreen;
extern int32_t qsetmode;
 
switch (parm->numparms)
{
282,14 → 282,14
return OSDCMD_OK;
}
 
extern int startwin_run(void);
extern int32_t startwin_run(void);
 
extern char *defsfilename; // set in bstub.c
 
int app_main(int argc, const char **argv)
int32_t app_main(int32_t argc, const char **argv)
{
char quitflag, cmdsetup = 0;
int i, j, k;
int32_t i, j, k;
 
pathsearchmode = 1; // unrestrict findfrompath so that full access to the filesystem can be had
 
385,7 → 385,7
k = 0;
for (i=0;i<256;i++)
{
j = ((int)palette[i*3])+((int)palette[i*3+1])+((int)palette[i*3+2]);
j = ((int32_t)palette[i*3])+((int32_t)palette[i*3+1])+((int32_t)palette[i*3+2]);
if (j > k) { k = j; whitecol = i; }
}
 
556,7 → 556,7
/*
void showmouse(void)
{
int i;
int32_t i;
 
for (i=1;i<=4;i++)
{
567,7 → 567,7
}
}*/
 
int mhk=0;
int32_t mhk=0;
void loadmhk()
{
char *p;char levname[BMAX_PATH];
590,11 → 590,11
{
// char smooshyalign, repeatpanalign, buffer[80];
// short sectnum, nextsectnum, startwall, endwall, dasector, daang;
int mousz, bstatus;
int i, j, k, /*cnt,*/ tempint=0, doubvel/*, changedir, wallfind[2], daz[2]*/;
int /*dashade[2],*/ goalz, xvect, yvect,/*PK*/ zvect, hiz, loz;
short hitsect, hitwall, hitsprite;
int hitx, hity, hitz, dax, day, hihit, lohit;
int32_t mousz, bstatus;
int32_t i, j, k, /*cnt,*/ tempint=0, doubvel/*, changedir, wallfind[2], daz[2]*/;
int32_t /*dashade[2],*/ goalz, xvect, yvect,/*PK*/ zvect, hiz, loz;
int16_t hitsect, hitwall, hitsprite;
int32_t hitx, hity, hitz, dax, day, hihit, lohit;
 
// 3B 3C 3D 3E 3F 40 41 42 43 44 57 58 46
// F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 SCROLL
625,13 → 625,13
ldiv_t ld;
if (mlook)
{
ld = ldiv((int)(mousx), (int)((1<<16)/(msens*0.5f))); mousx = ld.quot; mousexsurp = ld.rem;
ld = ldiv((int)(mousy), (int)((1<<16)/(msens*0.25f))); mousy = ld.quot; mouseysurp = ld.rem;
ld = ldiv((int32_t)(mousx), (int32_t)((1<<16)/(msens*0.5f))); mousx = ld.quot; mousexsurp = ld.rem;
ld = ldiv((int32_t)(mousy), (int32_t)((1<<16)/(msens*0.25f))); mousy = ld.quot; mouseysurp = ld.rem;
}
else
{
ld = ldiv((int)(mousx), (int)((1<<16)/msens)); mousx = ld.quot; mousexsurp = ld.rem;
ld = ldiv((int)(mousy), (int)((1<<16)/msens)); mousy = ld.quot; mouseysurp = ld.rem;
ld = ldiv((int32_t)(mousx), (int32_t)((1<<16)/msens)); mousx = ld.quot; mousexsurp = ld.rem;
ld = ldiv((int32_t)(mousy), (int32_t)((1<<16)/msens)); mousy = ld.quot; mouseysurp = ld.rem;
}
}
 
649,8 → 649,8
if ((bstatus&1) && !(bstatus&(2|4)))
{
ang += mousx;
xvect = -((mousy*(int)sintable[(ang+2560)&2047])<<(3+pk_uedaccel));
yvect = -((mousy*(int)sintable[(ang+2048)&2047])<<(3+pk_uedaccel));
xvect = -((mousy*(int32_t)sintable[(ang+2560)&2047])<<(3+pk_uedaccel));
yvect = -((mousy*(int32_t)sintable[(ang+2048)&2047])<<(3+pk_uedaccel));
 
if (noclip)
{
667,8 → 667,8
else if ((bstatus&1) && (bstatus&2) && !(bstatus&4))
{
zmode = 2;
xvect = -((mousx*(int)sintable[(ang+2048)&2047])<<pk_uedaccel);
yvect = -((mousx*(int)sintable[(ang+1536)&2047])<<pk_uedaccel);
xvect = -((mousx*(int32_t)sintable[(ang+2048)&2047])<<pk_uedaccel);
yvect = -((mousx*(int32_t)sintable[(ang+1536)&2047])<<pk_uedaccel);
posz += mousy<<(4+pk_uedaccel);
if (noclip)
{
686,15 → 686,15
tempint = getangle(128, horiz-100);
 
xvect = -((mousy*
((int)sintable[(ang+2560)&2047]>>6)*
((int)sintable[(tempint+512)&2047])>>6)
((int32_t)sintable[(ang+2560)&2047]>>6)*
((int32_t)sintable[(tempint+512)&2047])>>6)
<<pk_uedaccel);
yvect = -((mousy*
((int)sintable[(ang+2048)&2047]>>6)*
((int)sintable[(tempint+512)&2047])>>6)
((int32_t)sintable[(ang+2048)&2047]>>6)*
((int32_t)sintable[(tempint+512)&2047])>>6)
<<pk_uedaccel);
 
zvect = mousy*(((int)sintable[(tempint+2048)&2047])>>(10-pk_uedaccel));
zvect = mousy*(((int32_t)sintable[(tempint+2048)&2047])>>(10-pk_uedaccel));
 
posz += zvect;
if (noclip)
789,13 → 789,13
xvect = 0, yvect = 0;
if (vel != 0)
{
xvect += ((vel*doubvel*(int)sintable[(ang+2560)&2047])>>3);
yvect += ((vel*doubvel*(int)sintable[(ang+2048)&2047])>>3);
xvect += ((vel*doubvel*(int32_t)sintable[(ang+2560)&2047])>>3);
yvect += ((vel*doubvel*(int32_t)sintable[(ang+2048)&2047])>>3);
}
if (svel != 0)
{
xvect += ((svel*doubvel*(int)sintable[(ang+2048)&2047])>>3);
yvect += ((svel*doubvel*(int)sintable[(ang+1536)&2047])>>3);
xvect += ((svel*doubvel*(int32_t)sintable[(ang+2048)&2047])>>3);
yvect += ((svel*doubvel*(int32_t)sintable[(ang+1536)&2047])>>3);
}
if (noclip)
{
1091,7 → 1091,7
}
}
 
char changechar(char dachar, int dadir, char smooshyalign, char boundcheck)
char changechar(char dachar, int32_t dadir, char smooshyalign, char boundcheck)
{
if (dadir < 0)
{
1118,11 → 1118,11
}
#if 0
/*
int gettile(int tilenum)
int32_t gettile(int32_t tilenum)
{
char snotbuf[80], ch;
int i, j, k, otilenum, topleft, gap, temp, tempint;
int xtiles, ytiles, tottiles;
int32_t i, j, k, otilenum, topleft, gap, temp, tempint;
int32_t xtiles, ytiles, tottiles;
 
if (tilenum < 0) tilenum = 0;
 
1324,10 → 1324,10
return(tilenum);
}
 
int drawtilescreen(int pictopleft, int picbox)
int32_t drawtilescreen(int32_t pictopleft, int32_t picbox)
{
int i, j, vidpos, vidpos2, dat, wallnum, xdime, ydime, cnt, pinc;
int dax, day, scaledown, xtiles, ytiles, tottiles;
int32_t i, j, vidpos, vidpos2, dat, wallnum, xdime, ydime, cnt, pinc;
int32_t dax, day, scaledown, xtiles, ytiles, tottiles;
char *picptr, snotbuf[80];
 
xtiles = (xdim>>6); ytiles = (ydim>>6); tottiles = xtiles*ytiles;
1432,22 → 1432,22
void overheadeditor(void)
{
char buffer[80], *dabuffer, ch;
int i, j, k, m=0, mousxplc, mousyplc, firstx=0, firsty=0, oposz, col;
int tempint, tempint1, tempint2, doubvel;
int startwall=0, endwall, dax, day, daz, x1, y1, x2, y2, x3, y3, x4, y4;
int highlightx1, highlighty1, highlightx2, highlighty2, xvect, yvect;
short pag, suckwall=0, sucksect, newnumwalls, newnumsectors, split=0, bad;
short splitsect=0, danumwalls, secondstartwall, joinsector[2], joinsectnum;
short splitstartwall=0, splitendwall, loopnum;
int mousx, mousy, bstatus;
int centerx, centery, circlerad;
short circlepoints, circleang1, circleang2, circleangdir;
int sectorhighlightx=0, sectorhighlighty=0;
short cursectorhighlight, sectorhighlightstat;
short hitsect, hitwall, hitsprite;
int hitx, hity, hitz;
int32_t i, j, k, m=0, mousxplc, mousyplc, firstx=0, firsty=0, oposz, col;
int32_t tempint, tempint1, tempint2, doubvel;
int32_t startwall=0, endwall, dax, day, daz, x1, y1, x2, y2, x3, y3, x4, y4;
int32_t highlightx1, highlighty1, highlightx2, highlighty2, xvect, yvect;
int16_t pag, suckwall=0, sucksect, newnumwalls, newnumsectors, split=0, bad;
int16_t splitsect=0, danumwalls, secondstartwall, joinsector[2], joinsectnum;
int16_t splitstartwall=0, splitendwall, loopnum;
int32_t mousx, mousy, bstatus;
int32_t centerx, centery, circlerad;
int16_t circlepoints, circleang1, circleang2, circleangdir;
int32_t sectorhighlightx=0, sectorhighlighty=0;
int16_t cursectorhighlight, sectorhighlightstat;
int16_t hitsect, hitwall, hitsprite;
int32_t hitx, hity, hitz;
walltype *wal;
int prefixarg = 0;
int32_t prefixarg = 0;
 
//qsetmode640480();
qsetmodeany(xdim2d,ydim2d);
1546,8 → 1546,8
mousy = (mousy<<16)+mouseysurp;
{
ldiv_t ld;
ld = ldiv((int)(mousx), (1<<16)); mousx = ld.quot; mousexsurp = ld.rem;
ld = ldiv((int)(mousy), (1<<16)); mousy = ld.quot; mouseysurp = ld.rem;
ld = ldiv((int32_t)(mousx), (1<<16)); mousx = ld.quot; mousexsurp = ld.rem;
ld = ldiv((int32_t)(mousy), (1<<16)); mousy = ld.quot; mouseysurp = ld.rem;
}
searchx += mousx;
searchy += mousy;
1579,13 → 1579,13
xvect = 0, yvect = 0;
if (vel != 0)
{
xvect += ((vel*doubvel*(int)sintable[(ang+2560)&2047])>>3);
yvect += ((vel*doubvel*(int)sintable[(ang+2048)&2047])>>3);
xvect += ((vel*doubvel*(int32_t)sintable[(ang+2560)&2047])>>3);
yvect += ((vel*doubvel*(int32_t)sintable[(ang+2048)&2047])>>3);
}
if (svel != 0)
{
xvect += ((svel*doubvel*(int)sintable[(ang+2048)&2047])>>3);
yvect += ((svel*doubvel*(int)sintable[(ang+1536)&2047])>>3);
xvect += ((svel*doubvel*(int32_t)sintable[(ang+2048)&2047])>>3);
yvect += ((svel*doubvel*(int32_t)sintable[(ang+1536)&2047])>>3);
}
if (noclip)
{
1618,7 → 1618,7
 
if (graphicsmode)
{
int ii = xyaspect;
int32_t ii = xyaspect;
 
i = yxaspect;
Bmemset(show2dsector, 255, sizeof(show2dsector));
1835,7 → 1835,7
//Draw the white pixel closest to mouse cursor on linehighlight
if (linehighlight>=0)
{
getclosestpointonwall(mousxplc,mousyplc,(int)linehighlight,&dax,&day);
getclosestpointonwall(mousxplc,mousyplc,(int32_t)linehighlight,&dax,&day);
x2 = mulscale14(dax-posx,zoom);
y2 = mulscale14(day-posy,zoom);
if (wall[linehighlight].nextsector >= 0)
1886,10 → 1886,10
 
for (i=0;i<highlightsectorcnt;i++)
{
int startofloop;
int endofloop;
int numtoswap = -1;
int w=0;
int32_t startofloop;
int32_t endofloop;
int32_t numtoswap = -1;
int32_t w=0;
walltype tempwall;
 
startofloop = startwall = sector[highlightsector[i]].wallptr;
2007,10 → 2007,10
 
for (i=0;i<highlightsectorcnt;i++)
{
int startofloop;
int endofloop;
int numtoswap = -1;
int w=0;
int32_t startofloop;
int32_t endofloop;
int32_t numtoswap = -1;
int32_t w=0;
walltype tempwall;
 
startofloop = startwall = sector[highlightsector[i]].wallptr;
2279,7 → 2279,7
bstatus &= ~32;
 
clearmidstatbar16();
showspritedata((short)pointhighlight-16384);
showspritedata((int16_t)pointhighlight-16384);
}
}
}
2378,7 → 2378,7
mouseb &= ~16;
bstatus &= ~16;
clearmidstatbar16();
showspritedata((short)pointhighlight-16384);
showspritedata((int16_t)pointhighlight-16384);
}
}
}
2401,7 → 2401,7
if (inside(mousxplc,mousyplc,i) == 1)
{
ydim16 = STATUS2DSIZ;
ExtShowSectorData((short)i);
ExtShowSectorData((int16_t)i);
ydim16 = ydim-STATUS2DSIZ;
break;
}
2415,7 → 2415,7
i = pointhighlight-16384;
 
ydim16 = STATUS2DSIZ;
ExtShowSpriteData((short)i);
ExtShowSpriteData((int16_t)i);
ydim16 = ydim-STATUS2DSIZ;
}
else if (linehighlight >= 0)
2423,7 → 2423,7
i = linehighlight;
 
ydim16 = STATUS2DSIZ;
ExtShowWallData((short)i);
ExtShowWallData((int16_t)i);
ydim16 = ydim-STATUS2DSIZ;
}
}
2435,7 → 2435,7
if (inside(mousxplc,mousyplc,i) == 1)
{
ydim16 = STATUS2DSIZ;
ExtEditSectorData((short)i);
ExtEditSectorData((int16_t)i);
ydim16 = ydim-STATUS2DSIZ;
break;
}
2449,7 → 2449,7
i = pointhighlight-16384;
 
ydim16 = STATUS2DSIZ;
ExtEditSpriteData((short)i);
ExtEditSpriteData((int16_t)i);
ydim16 = ydim-STATUS2DSIZ;
}
else if (linehighlight >= 0)
2457,7 → 2457,7
i = linehighlight;
 
ydim16 = STATUS2DSIZ;
ExtEditWallData((short)i);
ExtEditWallData((int16_t)i);
ydim16 = ydim-STATUS2DSIZ;
}
}
2494,7 → 2494,7
Bsprintf(buffer,"Sprite (%d) Hi-tag: ",i);
sprite[i].hitag = getnumber16(buffer,sprite[i].hitag,65536L,0);
clearmidstatbar16();
showspritedata((short)i);
showspritedata((int16_t)i);
}
else if (linehighlight >= 0)
{
2502,7 → 2502,7
Bsprintf(buffer,"Wall (%d) Hi-tag: ",i);
wall[i].hitag = getnumber16(buffer,wall[i].hitag,65536L,0);
clearmidstatbar16();
showwalldata((short)i);
showwalldata((int16_t)i);
}
}
else
2513,7 → 2513,7
Bsprintf(buffer,"Sector (%d) Hi-tag: ",i);
sector[i].hitag = getnumber16(buffer,sector[i].hitag,65536L,0);
clearmidstatbar16();
showsectordata((short)i);
showsectordata((int16_t)i);
break;
}
}
2529,12 → 2529,12
Bsprintf(buffer,"Sector (%d) Ceilingpal: ",i);
sector[i].ceilingpal = getnumber16(buffer,sector[i].ceilingpal,256L,0);
clearmidstatbar16();
showsectordata((short)i);
showsectordata((int16_t)i);
 
Bsprintf(buffer,"Sector (%d) Floorpal: ",i);
sector[i].floorpal = getnumber16(buffer,sector[i].floorpal,256L,0);
clearmidstatbar16();
showsectordata((short)i);
showsectordata((int16_t)i);
 
printmessage16("");
break;
2548,7 → 2548,7
Bsprintf(buffer,"Sprite (%d) Status list: ",i);
changespritestat(i,getnumber16(buffer,sprite[i].statnum,65536L,0));
clearmidstatbar16();
showspritedata((short)i);
showspritedata((int16_t)i);
}
 
printmessage16("");
2563,9 → 2563,9
if ((keystatus[0x38]|keystatus[0xb8]|keystatus[0x1d]|keystatus[0x9d]) > 0) //ALT or CTRL
{
if (pointhighlight >= 16384)
showspritedata((short)pointhighlight-16384);
showspritedata((int16_t)pointhighlight-16384);
else if (linehighlight >= 0)
showwalldata((short)linehighlight);
showwalldata((int16_t)linehighlight);
}
else
{
2572,7 → 2572,7
for (i=0;i<numsectors;i++)
if (inside(mousxplc,mousyplc,i) == 1)
{
showsectordata((short)i);
showsectordata((int16_t)i);
break;
}
}
2695,7 → 2695,7
{
if (wall[j].nextwall >= 0)
checksectorpointer(wall[j].nextwall,wall[j].nextsector);
checksectorpointer((short)j,highlightsector[i]);
checksectorpointer((int16_t)j,highlightsector[i]);
}
}
highlightx1 = searchx;
2769,7 → 2769,7
 
if (((bstatus&1) < (oldmousebstatus&1)) && (highlightsectorcnt < 0)) //after dragging
{
int wallsdrawn = newnumwalls-numwalls;
int32_t wallsdrawn = newnumwalls-numwalls;
 
if (newnumwalls != -1)
{
2830,7 → 2830,7
{
if (wall[i].x == wall[wall[i].point2].x)
if (wall[i].y == wall[wall[i].point2].y)
if (sector[sectorofwall((short)i)].wallnum > 3)
if (sector[sectorofwall((int16_t)i)].wallnum > 3)
if (sector[sectorofwall(wall[i].point2)].wallnum > 3)
if (!(wall[i].nextwall == -1 ||
(sector[sectorofwall(wall[i].nextwall)].wallnum > 3 &&
2845,13 → 2845,13
{
if (wall[i].x == wall[wall[i].point2].x)
if (wall[i].y == wall[wall[i].point2].y)
if (sector[sectorofwall((short)i)].wallnum > 3)
if (sector[sectorofwall((int16_t)i)].wallnum > 3)
if (sector[sectorofwall(wall[i].point2)].wallnum > 3)
if (wall[i].nextwall == -1 ||
(sector[sectorofwall(wall[i].nextwall)].wallnum > 3 &&
sector[sectorofwall(wall[wall[i].nextwall].point2)].wallnum > 3))
{
deletepoint((short)i);
deletepoint((int16_t)i);
printmessage16("Point deleted.");
asksave = 1;
}
2861,14 → 2861,14
{
if ((wall[i].x == dax) && (wall[i].y == day))
{
checksectorpointer((short)i,sectorofwall((short)i));
fixrepeats((short)i);
checksectorpointer((int16_t)i,sectorofwall((int16_t)i));
fixrepeats((int16_t)i);
asksave = 1;
}
else if ((wall[wall[i].point2].x == dax) && (wall[wall[i].point2].y == day))
{
checksectorpointer((short)i,sectorofwall((short)i));
fixrepeats((short)i);
checksectorpointer((int16_t)i,sectorofwall((int16_t)i));
fixrepeats((int16_t)i);
asksave = 1;
}
}
3018,7 → 3018,7
sprite[pointhighlight&16383].x = dax;
sprite[pointhighlight&16383].y = day;
if (sprite[pointhighlight&16383].sectnum != i)
changespritesect(pointhighlight&16383,(short)i);
changespritesect(pointhighlight&16383,(int16_t)i);
break;
}
}
3241,10 → 3241,10
}
}
 
deletesector((short)joinsector[0]);
deletesector((int16_t)joinsector[0]);
if (joinsector[0] < joinsector[1])
joinsector[1]--;
deletesector((short)joinsector[1]);
deletesector((int16_t)joinsector[1]);
printmessage16("Sectors joined.");
}
}
3414,7 → 3414,7
{
if (wall[j].nextwall >= 0)
checksectorpointer(wall[j].nextwall,wall[j].nextsector);
checksectorpointer((short)j,highlightsector[i]);
checksectorpointer((int16_t)j,highlightsector[i]);
}
highlightsector[i] = numsectors+i;
}
3472,7 → 3472,7
tempint2 = dmulscale4(y1-y2,x1-x3,y1-y3,x2-x1);
if (tempint2 != 0)
{
int pointsize = 2;
int32_t pointsize = 2;
 
centerx = (((x1+x2) + scale(y1-y2,tempint1,tempint2))>>1);
centery = (((y1+y2) + scale(x2-x1,tempint1,tempint2))>>1);
3600,7 → 3600,7
}
if (m >= 0)
if ((wall[wall[k].point2].x != mousxplc) || (wall[wall[k].point2].y != mousyplc))
if ((wall[lastwall((short)k)].x != mousxplc) || (wall[lastwall((short)k)].y != mousyplc))
if ((wall[lastwall((int16_t)k)].x != mousxplc) || (wall[lastwall((int16_t)k)].y != mousyplc))
{
split = 1;
splitsect = i;
3680,7 → 3680,7
wall[i].cstat = 0;
wall[i].shade = 0;
wall[i].yrepeat = 8;
fixrepeats((short)i);
fixrepeats((int16_t)i);
wall[i].picnum = 0;
wall[i].overpicnum = 0;
wall[i].nextsector = -1;
3721,7 → 3721,7
wall[i].cstat = wall[suckwall+j].cstat&~(1+16+32+64);
wall[i].shade = wall[suckwall+j].shade;
wall[i].yrepeat = wall[suckwall+j].yrepeat;
fixrepeats((short)i);
fixrepeats((int16_t)i);
wall[i].picnum = wall[suckwall+j].picnum;
wall[i].overpicnum = wall[suckwall+j].overpicnum;
 
3760,10 → 3760,10
wall[i].cstat = wall[suckwall].cstat;
wall[i].shade = wall[suckwall].shade;
wall[i].yrepeat = wall[suckwall].yrepeat;
fixrepeats((short)i);
fixrepeats((int16_t)i);
wall[i].picnum = wall[suckwall].picnum;
wall[i].overpicnum = wall[suckwall].overpicnum;
checksectorpointer((short)i,(short)numsectors);
checksectorpointer((int16_t)i,(int16_t)numsectors);
}
headspritesect[numsectors] = -1;
numsectors++;
3782,7 → 3782,7
if (wall[k].y == wall[newnumwalls-1].y)
{
bad = 0;
if (loopnumofsector(splitsect,splitstartwall) != loopnumofsector(splitsect,(short)k))
if (loopnumofsector(splitsect,splitstartwall) != loopnumofsector(splitsect,(int16_t)k))
bad = 1;
 
if (bad == 0)
3798,7 → 3798,7
wall[i].cstat = wall[startwall].cstat;
wall[i].shade = wall[startwall].shade;
wall[i].yrepeat = wall[startwall].yrepeat;
fixrepeats((short)i);
fixrepeats((int16_t)i);
wall[i].picnum = wall[startwall].picnum;
wall[i].overpicnum = wall[startwall].overpicnum;
 
3823,7 → 3823,7
i = loopnum;
for (j=startwall;j<=endwall;j++)
{
k = loopnumofsector(splitsect,(short)j);
k = loopnumofsector(splitsect,(int16_t)j);
if ((k != i) && (k != loopnum))
{
i = k;
3869,7 → 3869,7
i = loopnum;
for (j=startwall;j<=endwall;j++)
{
k = loopnumofsector(splitsect,(short)j);
k = loopnumofsector(splitsect,(int16_t)j);
if ((k != i) && (k != loopnum))
{
i = k;
3951,7 → 3951,7
{
if (wall[j].nextwall >= 0)
checksectorpointer(wall[j].nextwall,wall[j].nextsector);
checksectorpointer((short)j,sectorofwall((short)j));
checksectorpointer((int16_t)j,sectorofwall((int16_t)j));
}
 
//k now safe to use as temp
3982,7 → 3982,7
wall[i].cstat = wall[startwall].cstat;
wall[i].shade = wall[startwall].shade;
wall[i].yrepeat = wall[startwall].yrepeat;
fixrepeats((short)i);
fixrepeats((int16_t)i);
wall[i].picnum = wall[startwall].picnum;
wall[i].overpicnum = wall[startwall].overpicnum;
 
4028,7 → 4028,7
i = loopnum;
for (j=startwall;j<=endwall;j++)
{
k = loopnumofsector(splitsect,(short)j);
k = loopnumofsector(splitsect,(int16_t)j);
if ((k != i) && (k != loopnumofsector(splitsect,splitstartwall)) && (k != loopnumofsector(splitsect,splitendwall)))
{
i = k;
4088,7 → 4088,7
{
if (wall[j].nextwall >= 0)
checksectorpointer(wall[j].nextwall,wall[j].nextsector);
checksectorpointer((short)j,numsectors-1);
checksectorpointer((int16_t)j,numsectors-1);
}
 
newnumwalls = -1;
4127,7 → 4127,7
startwall = sector[i].wallptr;
endwall = startwall + sector[i].wallnum;
for (j=startwall;j<endwall;j++)
checksectorpointer((short)j,(short)i);
checksectorpointer((int16_t)j,(int16_t)i);
}
printmessage16("ALL POINTERS CHECKED!");
asksave = 1;
4207,7 → 4207,7
}
if (k == 0)
{
deletesector((short)i);
deletesector((int16_t)i);
highlightsectorcnt = -1;
printmessage16("Sector deleted.");
}
4250,7 → 4250,7
{
if (wall[j].nextwall >= 0)
checksectorpointer(wall[j].nextwall,wall[j].nextsector);
checksectorpointer((short)j,highlightsector[i]);
checksectorpointer((int16_t)j,highlightsector[i]);
}
highlightsector[i] = numsectors+i;
}
4282,7 → 4282,7
}
else if (linehighlight >= 0)
{
int wallsdrawn = newnumwalls-numwalls;
int32_t wallsdrawn = newnumwalls-numwalls;
 
if (newnumwalls != -1)
{
4291,7 → 4291,7
}
else wallsdrawn = -1;
 
getclosestpointonwall(mousxplc,mousyplc,(int)linehighlight,&dax,&day);
getclosestpointonwall(mousxplc,mousyplc,(int32_t)linehighlight,&dax,&day);
adjustmark(&dax,&day,newnumwalls);
insertpoint(linehighlight,dax,day);
printmessage16("Point inserted.");
4302,7 → 4302,7
if (wall[i].x == wall[wall[i].point2].x)
if (wall[i].y == wall[wall[i].point2].y)
{
deletepoint((short)i);
deletepoint((int16_t)i);
j++;
}
for (i=0;i<numwalls;i++) //make new red lines?
4309,13 → 4309,13
{
if ((wall[i].x == dax) && (wall[i].y == day))
{
checksectorpointer((short)i,sectorofwall((short)i));
fixrepeats((short)i);
checksectorpointer((int16_t)i,sectorofwall((int16_t)i));
fixrepeats((int16_t)i);
}
else if ((wall[wall[i].point2].x == dax) && (wall[wall[i].point2].y == day))
{
checksectorpointer((short)i,sectorofwall((short)i));
fixrepeats((short)i);
checksectorpointer((int16_t)i,sectorofwall((int16_t)i));
fixrepeats((int16_t)i);
}
}
//if (j != 0)
4558,7 → 4558,7
for (i=0;i<highlightsectorcnt;i++)
{
j -= sector[highlightsector[i]].wallnum;
copysector(highlightsector[i],(short)(MAXSECTORS-highlightsectorcnt+i),(short)j,0);
copysector(highlightsector[i],(int16_t)(MAXSECTORS-highlightsectorcnt+i),(int16_t)j,0);
}
 
//Put sprites to end of list
4625,7 → 4625,7
//Re-attach sectors&walls
for (i=0;i<highlightsectorcnt;i++)
{
copysector((short)(MAXSECTORS-highlightsectorcnt+i),numsectors,numwalls,0);
copysector((int16_t)(MAXSECTORS-highlightsectorcnt+i),numsectors,numwalls,0);
highlightsector[i] = numsectors;
numwalls += sector[numsectors].wallnum;
numsectors++;
4659,7 → 4659,7
{
if (wall[j].nextwall >= 0)
checksectorpointer(wall[j].nextwall,wall[j].nextsector);
checksectorpointer((short)j,highlightsector[i]);
checksectorpointer((int16_t)j,highlightsector[i]);
}
}
 
4736,7 → 4736,7
}
if (bad == 2)
{
char *f;int res;
char *f;int32_t res;
keystatus[0x1c] = 0;
 
boardfilename[i] = '.';
4774,7 → 4774,7
else if (ch == 's' || ch == 'S') //S
{
char *f;
int res;
int32_t res;
bad = 0;
printmessage16("Saving board...");
showframe(1);
4888,7 → 4888,7
{
if (wall[j].nextwall >= 0)
checksectorpointer(wall[j].nextwall,wall[j].nextsector);
checksectorpointer((short)j,highlightsector[i]);
checksectorpointer((int16_t)j,highlightsector[i]);
}
}
 
4912,7 → 4912,7
searchy = scale(searchy,ydimgame,ydim2d-STATUS2DSIZ);
}
 
void getpoint(int searchxe, int searchye, int *x, int *y)
void getpoint(int32_t searchxe, int32_t searchye, int32_t *x, int32_t *y)
{
if (posx <= -editorgridextent) posx = -editorgridextent;
if (posx >= editorgridextent) posx = editorgridextent;
4928,9 → 4928,9
if (*y >= editorgridextent) *y = editorgridextent;
}
 
int getlinehighlight(int xplc, int yplc, int line)
int32_t getlinehighlight(int32_t xplc, int32_t yplc, int32_t line)
{
int i, dst, dist, closest, x1, y1, x2, y2, nx, ny;
int32_t i, dst, dist, closest, x1, y1, x2, y2, nx, ny;
 
if (numwalls == 0)
return(-1);
4964,9 → 4964,9
return(closest);
}
 
int getpointhighlight(int xplc, int yplc, int point)
int32_t getpointhighlight(int32_t xplc, int32_t yplc, int32_t point)
{
int i, dst, dist = 512, closest = -1;
int32_t i, dst, dist = 512, closest = -1;
 
if (numwalls == 0)
return(-1);
4995,9 → 4995,9
return(closest);
}
 
int adjustmark(int *xplc, int *yplc, short danumwalls)
int32_t adjustmark(int32_t *xplc, int32_t *yplc, int16_t danumwalls)
{
int i, dst, dist, dax, day, pointlockdist;
int32_t i, dst, dist, dax, day, pointlockdist;
 
if (danumwalls < 0)
danumwalls = numwalls;
5031,9 → 5031,9
return(0);
}
 
int checkautoinsert(int dax, int day, short danumwalls)
int32_t checkautoinsert(int32_t dax, int32_t day, int16_t danumwalls)
{
int i, x1, y1, x2, y2;
int32_t i, x1, y1, x2, y2;
 
if (danumwalls < 0)
danumwalls = numwalls;
5054,10 → 5054,10
return(0);
}
 
int clockdir(short wallstart) //Returns: 0 is CW, 1 is CCW
int32_t clockdir(int16_t wallstart) //Returns: 0 is CW, 1 is CCW
{
short i, themin;
int minx, tempint, x0, x1, x2, y0, y1, y2;
int16_t i, themin;
int32_t minx, tempint, x0, x1, x2, y0, y1, y2;
 
minx = 0x7fffffff;
themin = -1;
5090,9 → 5090,9
return(1);
}
 
void flipwalls(short numwalls, short newnumwalls)
void flipwalls(int16_t numwalls, int16_t newnumwalls)
{
int i, j, nume, tempint;
int32_t i, j, nume, tempint;
 
nume = newnumwalls-numwalls;
 
5104,45 → 5104,45
}
}
 
void insertpoint(short linehighlight, int dax, int day)
void insertpoint(int16_t linehighlight, int32_t dax, int32_t day)
{
short sucksect;
int i, j, k;
int16_t sucksect;
int32_t i, j, k;
 
j = linehighlight;
sucksect = sectorofwall((short)j);
sucksect = sectorofwall((int16_t)j);
 
sector[sucksect].wallnum++;
for (i=sucksect+1;i<numsectors;i++)
sector[i].wallptr++;
 
movewalls((int)j+1,+1L);
movewalls((int32_t)j+1,+1L);
Bmemcpy(&wall[j+1],&wall[j],sizeof(walltype));
 
wall[j].point2 = j+1;
wall[j+1].x = dax;
wall[j+1].y = day;
fixrepeats((short)j);
fixrepeats((short)j+1);
fixrepeats((int16_t)j);
fixrepeats((int16_t)j+1);
 
if (wall[j].nextwall >= 0)
{
k = wall[j].nextwall;
 
sucksect = sectorofwall((short)k);
sucksect = sectorofwall((int16_t)k);
 
sector[sucksect].wallnum++;
for (i=sucksect+1;i<numsectors;i++)
sector[i].wallptr++;
 
movewalls((int)k+1,+1L);
movewalls((int32_t)k+1,+1L);
Bmemcpy(&wall[k+1],&wall[k],sizeof(walltype));
 
wall[k].point2 = k+1;
wall[k+1].x = dax;
wall[k+1].y = day;
fixrepeats((short)k);
fixrepeats((short)k+1);
fixrepeats((int16_t)k);
fixrepeats((int16_t)k+1);
 
j = wall[k].nextwall;
wall[j].nextwall = k+1;
5152,9 → 5152,9
}
}
 
void deletepoint(short point)
void deletepoint(int16_t point)
{
int i, j, k, sucksect;
int32_t i, j, k, sucksect;
 
sucksect = sectorofwall(point);
 
5176,14 → 5176,14
wall[wall[point].nextwall].nextwall = -1;
wall[wall[point].nextwall].nextsector = -1;
}
movewalls((int)point,-1L);
movewalls((int32_t)point,-1L);
 
checksectorpointer((short)j,(short)sucksect);
checksectorpointer((int16_t)j,(int16_t)sucksect);
}
 
int deletesector(short sucksect)
int32_t deletesector(int16_t sucksect)
{
int i, j, k, nextk, startwall, endwall;
int32_t i, j, k, nextk, startwall, endwall;
 
while (headspritesect[sucksect] >= 0)
deletesprite(headspritesect[sucksect]);
5199,7 → 5199,7
while (k != -1)
{
nextk = nextspritesect[k];
changespritesect((short)k,(short)i);
changespritesect((int16_t)k,(int16_t)i);
k = nextk;
}
 
5224,11 → 5224,11
 
void fixspritesectors(void)
{
int i, j, dax, day, daz;
int32_t i, j, dax, day, daz;
 
for (i=numsectors-1;i>=0;i--)
if ((sector[i].wallnum <= 0) || (sector[i].wallptr >= numwalls))
deletesector((short)i);
deletesector((int16_t)i);
 
for (i=0;i<MAXSPRITES;i++)
if (sprite[i].statnum < MAXSTATUS)
5240,11 → 5240,11
daz = ((tilesizy[sprite[i].picnum]*sprite[i].yrepeat)<<2);
 
for (j=0;j<numsectors;j++)
if (inside(dax,day,(short)j) == 1)
if (inside(dax,day,(int16_t)j) == 1)
if (sprite[i].z >= getceilzofslope(j,dax,day))
if (sprite[i].z-daz <= getflorzofslope(j,dax,day))
{
changespritesect((short)i,(short)j);
changespritesect((int16_t)i,(int16_t)j);
break;
}
}
5251,9 → 5251,9
}
}
 
int movewalls(int start, int offs)
int32_t movewalls(int32_t start, int32_t offs)
{
int i;
int32_t i;
 
if (offs < 0) //Delete
{
5274,9 → 5274,9
return(0);
}
 
int checksectorpointer(short i, short sectnum)
int32_t checksectorpointer(int16_t i, int16_t sectnum)
{
int j, k, startwall, endwall, x1, y1, x2, y2;
int32_t j, k, startwall, endwall, x1, y1, x2, y2;
 
x1 = wall[i].x;
y1 = wall[i].y;
5313,19 → 5313,19
return(0);
}
 
void fixrepeats(short i)
void fixrepeats(int16_t i)
{
int dax, day, dist;
int32_t dax, day, dist;
 
dax = wall[wall[i].point2].x-wall[i].x;
day = wall[wall[i].point2].y-wall[i].y;
dist = ksqrt(dax*dax+day*day);
dax = wall[i].xrepeat; day = wall[i].yrepeat;
wall[i].xrepeat = (char)min(max(mulscale10(dist,day),1),255);
wall[i].xrepeat = (uint8_t)min(max(mulscale10(dist,day),1),255);
}
 
 
int overridepm16y = -1;
int32_t overridepm16y = -1;
 
void clearmidstatbar16(void)
{
5342,10 → 5342,10
enddrawing();
}
 
short loopinside(int x, int y, short startwall)
int16_t loopinside(int32_t x, int32_t y, int16_t startwall)
{
int x1, y1, x2, y2, tempint;
short i, cnt;
int32_t x1, y1, x2, y2, tempint;
int16_t i, cnt;
 
cnt = clockdir(startwall);
i = startwall;
5370,9 → 5370,9
return(cnt);
}
 
int numloopsofsector(short sectnum)
int32_t numloopsofsector(int16_t sectnum)
{
int i, numloops, startwall, endwall;
int32_t i, numloops, startwall, endwall;
 
numloops = 0;
startwall = sector[sectnum].wallptr;
5382,12 → 5382,12
return(numloops);
}
 
int _getnumber16(char *namestart, int num, int maxnumber, char sign, void *(func)(int))
int32_t _getnumber16(char *namestart, int32_t num, int32_t maxnumber, char sign, void *(func)(int32_t))
{
char buffer[80], ch;
int n, danum, oldnum;
int32_t n, danum, oldnum;
 
danum = (int)num;
danum = (int32_t)num;
oldnum = danum;
bflushchars();
while (keystatus[0x1] == 0)
5405,7 → 5405,7
printmessage16(buffer);
if (func != NULL)
{
Bsprintf(buffer,"^011%s",(char *)func((int)danum));
Bsprintf(buffer,"^011%s",(char *)func((int32_t)danum));
printext16(200L-24, ydim-STATUS2DSIZ+20L, editorcolors[9], editorcolors[0], buffer, 0);
}
 
5443,10 → 5443,10
return(oldnum);
}
 
int _getnumber256(char *namestart, int num, int maxnumber, char sign, void *(func)(int))
int32_t _getnumber256(char *namestart, int32_t num, int32_t maxnumber, char sign, void *(func)(int32_t))
{
char buffer[80], ch;
int n, danum, oldnum;
int32_t n, danum, oldnum;
 
danum = num;
oldnum = danum;
5481,7 → 5481,7
printmessage256(0, 0, buffer);
if (func != NULL)
{
Bsprintf(buffer,"%s",(char *)func((int)danum));
Bsprintf(buffer,"%s",(char *)func((int32_t)danum));
printmessage256(0, 9, buffer);
}
 
5530,7 → 5530,7
numfiles = numdirs = 0;
}
 
int getfilenames(char *path, char *kind)
int32_t getfilenames(char *path, char *kind)
{
CACHE1D_FIND_REC *r;
 
5552,7 → 5552,7
// copied off menuselect
 
const char *g_oldpath=NULL;
int menuselect_pk(int direction) // 20080104: jump to next (direction!=0) or prev (direction==0) file
int32_t menuselect_pk(int32_t direction) // 20080104: jump to next (direction!=0) or prev (direction==0) file
{
const char *chptr;
 
5590,14 → 5590,14
}
// ^^^ PK ------------------------------------
 
int menuselect(void)
int32_t menuselect(void)
{
int listsize = (ydim16-32)/8;
int i;
int32_t listsize = (ydim16-32)/8;
int32_t i;
char ch, buffer[96], /*PK*/ *chptr;
static char oldpath[BMAX_PATH];
CACHE1D_FIND_REC *dir;
int bakpathsearchmode = pathsearchmode;
int32_t bakpathsearchmode = pathsearchmode;
 
g_oldpath=oldpath; //PK: need it in menuselect_pk
 
5652,7 → 5652,7
}
for (i=0; ((i<listsize) && dir); i++, dir=dir->next)
{
int c = (dir->type == CACHE1D_FIND_DIR ? 2 : 3); //PK
int32_t c = (dir->type == CACHE1D_FIND_DIR ? 2 : 3); //PK
memset(buffer,0,sizeof(buffer));
strncpy(buffer,dir->name,25);
if (strlen(buffer) == 25)
5864,11 → 5864,11
return(-1);
}
 
int fillsector(short sectnum, char fillcolor)
int32_t fillsector(int16_t sectnum, char fillcolor)
{
int x1, x2, y1, y2, sy, y, tempint;
int lborder, rborder, uborder, dborder, miny, maxy, dax;
short z, zz, startwall, endwall, fillcnt;
int32_t x1, x2, y1, y2, sy, y, tempint;
int32_t lborder, rborder, uborder, dborder, miny, maxy, dax;
int16_t z, zz, startwall, endwall, fillcnt;
 
lborder = 0; rborder = xdim;
uborder = 0; dborder = ydim16;
5935,10 → 5935,10
return(0);
}
 
short whitelinescan(short dalinehighlight)
int16_t whitelinescan(int16_t dalinehighlight)
{
int i, j, k;
short sucksect, newnumwalls;
int32_t i, j, k;
int16_t sucksect, newnumwalls;
 
sucksect = sectorofwall(dalinehighlight);
 
5949,7 → 5949,7
newnumwalls = numwalls;
do
{
j = lastwall((short)i);
j = lastwall((int16_t)i);
if (wall[j].nextwall >= 0)
{
j = wall[j].point2;
5968,7 → 5968,7
Bmemcpy(&wall[newnumwalls],&wall[i],sizeof(walltype));
 
wall[newnumwalls].nextwall = j;
wall[newnumwalls].nextsector = sectorofwall((short)j);
wall[newnumwalls].nextsector = sectorofwall((int16_t)j);
 
newnumwalls++;
sector[numsectors].wallnum++;
6000,10 → 6000,10
bufplc = ((bufplc+1)&4095); \
} \
 
int loadnames(void)
int32_t loadnames(void)
{
char buffer[80], firstch, ch;
int fil, i, num, buffercnt, bufplc;
int32_t fil, i, num, buffercnt, bufplc;
 
if ((fil = open("names.h",O_BINARY|O_RDWR,S_IREAD)) == -1) return(-1);
bufplc = 0;
6039,10 → 6039,10
}
*/
 
int loadnames(void)
int32_t loadnames(void)
{
char buffer[1024], *p, *name, *number, *endptr;
int num, syms=0, line=0, a, comment=0;
int32_t num, syms=0, line=0, a, comment=0;
BFILE *fp;
 
fp = fopenfrompath("NAMES.H","r");
6160,10 → 6160,10
return 0;
}
 
void printcoords16(int posxe, int posye, short ange)
void printcoords16(int32_t posxe, int32_t posye, int16_t ange)
{
char snotbuf[80];
int i,m;
int32_t i,m;
 
Bsprintf(snotbuf,"x:%d y:%d ang:%d",posxe,posye,ange);
i = 0;
6200,7 → 6200,7
 
void updatenumsprites(void)
{
int i;
int32_t i;
 
numsprites = 0;
for (i=0;i<MAXSPRITES;i++)
6208,9 → 6208,9
numsprites++;
}
 
void copysector(short soursector, short destsector, short deststartwall, char copystat)
void copysector(int16_t soursector, int16_t destsector, int16_t deststartwall, char copystat)
{
short j, k, m, newnumwalls, startwall, endwall;
int16_t j, k, m, newnumwalls, startwall, endwall;
 
newnumwalls = deststartwall; //erase existing sector fragments
 
6262,7 → 6262,7
}
}
 
void showsectordata(short sectnum)
void showsectordata(int16_t sectnum)
{
char snotbuf[80];
 
6318,9 → 6318,9
printext16(400,ydim-STATUS2DSIZ+96,editorcolors[11],-1,snotbuf,0);
}
 
void showwalldata(short wallnum)
void showwalldata(int16_t wallnum)
{
int dax, day, dist;
int32_t dax, day, dist;
char snotbuf[80];
 
Bsprintf(snotbuf,"^10Wall %d ^O(F8 to edit)",wallnum);
6372,12 → 6372,12
Bsprintf(snotbuf,"Wall length: %d",dist);
printext16(400,ydim-STATUS2DSIZ+96,editorcolors[11],-1,snotbuf,0);
 
dax = (int)sectorofwall(wallnum);
dax = (int32_t)sectorofwall(wallnum);
Bsprintf(snotbuf,"Pixel height: %d",(sector[dax].floorz-sector[dax].ceilingz)>>8);
printext16(400,ydim-STATUS2DSIZ+104,editorcolors[11],-1,snotbuf,0);
}
 
void showspritedata(short spritenum)
void showspritedata(int16_t spritenum)
{
char snotbuf[80];
 
6433,7 → 6433,7
 
void keytimerstuff(void)
{
static int ltotalclock=0;
static int32_t ltotalclock=0;
if (totalclock == ltotalclock) return;
ltotalclock=totalclock;
 
6465,7 → 6465,7
 
void _printmessage16(const char *fmt, ...)
{
int i, ybase;
int32_t i, ybase;
char snotbuf[60];
char tmpstr[64];
va_list va;
6500,10 → 6500,10
enddrawing();
}
 
void printmessage256(int x, int y, char *name)
void printmessage256(int32_t x, int32_t y, char *name)
{
char snotbuf[64];
int i;
int32_t i;
 
i = 0;
while ((name[i] != 0) && (i < 62))
6522,7 → 6522,7
}
 
//Find closest point (*dax, *day) on wall (dawall) to (x, y)
void getclosestpointonwall(int x, int y, int dawall, int *nx, int *ny)
void getclosestpointonwall(int32_t x, int32_t y, int32_t dawall, int32_t *nx, int32_t *ny)
{
walltype *wal;
int64 i, j, dx, dy;
6541,7 → 6541,7
 
void initcrc(void)
{
int i, j, k, a;
int32_t i, j, k, a;
 
for (j=0;j<256;j++) //Calculate CRC table
{
6560,11 → 6560,11
 
static char visited[MAXWALLS];
 
int GetWallZPeg(int nWall)
int32_t GetWallZPeg(int32_t nWall)
{
int z=0, nSector, nNextSector;
int32_t z=0, nSector, nNextSector;
 
nSector = sectorofwall((short)nWall);
nSector = sectorofwall((int16_t)nWall);
nNextSector = wall[nWall].nextsector;
if (nNextSector == -1)
{
6588,13 → 6588,13
return(z);
}
 
void AlignWalls(int nWall0, int z0, int nWall1, int z1, int nTile)
void AlignWalls(int32_t nWall0, int32_t z0, int32_t nWall1, int32_t z1, int32_t nTile)
{
int n;
int32_t n;
 
//do the x alignment
wall[nWall1].cstat &= ~0x0108; //Set to non-flip
wall[nWall1].xpanning = (char)((wall[nWall0].xpanning+(wall[nWall0].xrepeat<<3))%tilesizx[nTile]);
wall[nWall1].xpanning = (uint8_t)((wall[nWall0].xpanning+(wall[nWall0].xrepeat<<3))%tilesizx[nTile]);
 
z1 = GetWallZPeg(nWall1);
 
6601,12 → 6601,12
for (n=(picsiz[nTile]>>4);((1<<n)<tilesizy[nTile]);n++);
 
wall[nWall1].yrepeat = wall[nWall0].yrepeat;
wall[nWall1].ypanning = (char)(wall[nWall0].ypanning+(((z1-z0)*wall[nWall0].yrepeat)>>(n+3)));
wall[nWall1].ypanning = (uint8_t)(wall[nWall0].ypanning+(((z1-z0)*wall[nWall0].yrepeat)>>(n+3)));
}
 
void AutoAlignWalls(int nWall0, int ply)
void AutoAlignWalls(int32_t nWall0, int32_t ply)
{
int z0, z1, nTile, nWall1, branch, visible, nNextSector, nSector;
int32_t z0, z1, nTile, nWall1, branch, visible, nNextSector, nSector;
 
nTile = wall[nWall0].picnum;
branch = 0;
6644,12 → 6644,12
{
//ignore two sided walls that have no visible face
nSector = wall[wall[nWall1].nextwall].nextsector;
if (getceilzofslope((short)nSector,wall[nWall1].x,wall[nWall1].y) <
getceilzofslope((short)nNextSector,wall[nWall1].x,wall[nWall1].y))
if (getceilzofslope((int16_t)nSector,wall[nWall1].x,wall[nWall1].y) <
getceilzofslope((int16_t)nNextSector,wall[nWall1].x,wall[nWall1].y))
visible = 1;
 
if (getflorzofslope((short)nSector,wall[nWall1].x,wall[nWall1].y) >
getflorzofslope((short)nNextSector,wall[nWall1].x,wall[nWall1].y))
if (getflorzofslope((int16_t)nSector,wall[nWall1].x,wall[nWall1].y) >
getflorzofslope((int16_t)nNextSector,wall[nWall1].x,wall[nWall1].y))
visible = 1;
}
 
/polymer/eduke32/build/src/cache1d.c
19,7 → 19,7
//Doing this tells kzopen to load the file only if inside a .ZIP file
static intptr_t kzipopen(char *filnam)
{
unsigned int i;
uint32_t i;
char newst[BMAX_PATH+4];
 
newst[0] = '|';
35,12 → 35,12
// To use this module, here's all you need to do:
//
// Step 1: Allocate a nice BIG buffer, like from 1MB-4MB and
// Call initcache(int cachestart, int cachesize) where
// Call initcache(int32_t cachestart, int32_t cachesize) where
//
// cachestart = (intptr_t)(pointer to start of BIG buffer)
// cachesize = length of BIG buffer
//
// Step 2: Call allocache(intptr_t *bufptr, int bufsiz, char *lockptr)
// Step 2: Call allocache(intptr_t *bufptr, int32_t bufsiz, char *lockptr)
// whenever you need to allocate a buffer, where:
//
// *bufptr = pointer to multi-byte pointer to buffer
61,14 → 61,14
 
#define MAXCACHEOBJECTS 9216
 
static int cachesize = 0;
int cachecount = 0;
static int32_t cachesize = 0;
int32_t cachecount = 0;
char zerochar = 0;
intptr_t cachestart = 0;
int cacnum = 0, agecount = 0;
typedef struct { intptr_t *hand;int leng; char *lock ; } cactype;
int32_t cacnum = 0, agecount = 0;
typedef struct { intptr_t *hand;int32_t leng; char *lock ; } cactype;
cactype cac[MAXCACHEOBJECTS];
static int lockrecip[200];
static int32_t lockrecip[200];
 
static char toupperlookup[256];
 
80,9 → 80,9
extern char pow2char[8];
 
 
void initcache(intptr_t dacachestart, int dacachesize)
void initcache(intptr_t dacachestart, int32_t dacachesize)
{
int i;
int32_t i;
 
for (i=1;i<200;i++) lockrecip[i] = (1<<28)/(200-i);
 
107,9 → 107,9
initprintf("Initialized %.1fM cache\n", (float)(dacachesize/1024.f/1024.f));
}
 
void allocache(intptr_t *newhandle, int newbytes, char *newlockptr)
void allocache(intptr_t *newhandle, int32_t newbytes, char *newlockptr)
{
int i, /*j,*/ z, zz, bestz=0, daval, bestval, besto=0, o1, o2, sucklen, suckz;
int32_t i, /*j,*/ z, zz, bestz=0, daval, bestval, besto=0, o1, o2, sucklen, suckz;
 
//printf(" ==> asking for %d bytes, ", newbytes);
// Make all requests a multiple of 16 bytes
189,7 → 189,7
 
void suckcache(intptr_t *suckptr)
{
int i;
int32_t i;
 
//Can't exit early, because invalid pointer might be same even though lock = 0
for (i=0;i<cacnum;i++)
215,7 → 215,7
 
void agecache(void)
{
int cnt;
int32_t cnt;
char ch;
 
if (agecount >= cacnum) agecount = cacnum-1;
232,7 → 232,7
 
static void reportandexit(char *errormessage)
{
int i, j;
int32_t i, j;
 
//setvmode(0x3);
j = 0;
263,9 → 263,9
} searchpath_t;
static searchpath_t *searchpathhead = NULL;
static size_t maxsearchpathlen = 0;
int pathsearchmode = 0;
int32_t pathsearchmode = 0;
 
int addsearchpath(const char *p)
int32_t addsearchpath(const char *p)
{
struct stat st;
char *s;
302,11 → 302,11
return 0;
}
 
int findfrompath(const char *fn, char **where)
int32_t findfrompath(const char *fn, char **where)
{
searchpath_t *sp;
char *pfn, *ffn;
int allocsiz;
int32_t allocsiz;
 
// pathsearchmode == 0: tests current dir and then the dirs of the path stack
// pathsearchmode == 1: tests fn without modification, then like for pathsearchmode == 0
358,10 → 358,10
return -1;
}
 
int openfrompath(const char *fn, int flags, int mode)
int32_t openfrompath(const char *fn, int32_t flags, int32_t mode)
{
char *pfn;
int h;
int32_t h;
 
if (findfrompath(fn, &pfn) < 0) return -1;
h = Bopen(pfn, flags, mode);
372,9 → 372,9
 
BFILE* fopenfrompath(const char *fn, const char *mode)
{
int fh;
int32_t fh;
BFILE *h;
int bmode = 0, smode = 0;
int32_t bmode = 0, smode = 0;
const char *c;
 
for (c=mode; c[0];)
422,15 → 422,15
0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff
};
 
int numgroupfiles = 0;
static int gnumfiles[MAXGROUPFILES];
static int groupfil[MAXGROUPFILES] = {-1,-1,-1,-1,-1,-1,-1,-1};
static int groupfilpos[MAXGROUPFILES];
int32_t numgroupfiles = 0;
static int32_t gnumfiles[MAXGROUPFILES];
static int32_t groupfil[MAXGROUPFILES] = {-1,-1,-1,-1,-1,-1,-1,-1};
static int32_t groupfilpos[MAXGROUPFILES];
static char *gfilelist[MAXGROUPFILES];
static int *gfileoffs[MAXGROUPFILES];
static int32_t *gfileoffs[MAXGROUPFILES];
 
static char filegrp[MAXOPENFILES];
static int filepos[MAXOPENFILES];
static int32_t filepos[MAXOPENFILES];
static intptr_t filehan[MAXOPENFILES] =
{
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
440,13 → 440,13
};
#ifdef WITHKPLIB
static char filenamsav[MAXOPENFILES][260];
static int kzcurhand = -1;
static int32_t kzcurhand = -1;
#endif
 
int initgroupfile(char *filename)
int32_t initgroupfile(char *filename)
{
char buf[16];
int i, j, k;
int32_t i, j, k;
#ifdef WITHKPLIB
char *zfn;
#endif
493,11 → 493,11
groupfil[numgroupfiles] = -1;
return(-1);
}
gnumfiles[numgroupfiles] = B_LITTLE32(*((int *)&buf[12]));
gnumfiles[numgroupfiles] = B_LITTLE32(*((int32_t *)&buf[12]));
 
if ((gfilelist[numgroupfiles] = (char *)kmalloc(gnumfiles[numgroupfiles]<<4)) == 0)
{ Bprintf("Not enough memory for file grouping system\n"); exit(0); }
if ((gfileoffs[numgroupfiles] = (int *)kmalloc((gnumfiles[numgroupfiles]+1)<<2)) == 0)
if ((gfileoffs[numgroupfiles] = (int32_t *)kmalloc((gnumfiles[numgroupfiles]+1)<<2)) == 0)
{ Bprintf("Not enough memory for file grouping system\n"); exit(0); }
 
Bread(groupfil[numgroupfiles],gfilelist[numgroupfiles],gnumfiles[numgroupfiles]<<4);
505,7 → 505,7
j = 0;
for (i=0;i<gnumfiles[numgroupfiles];i++)
{
k = B_LITTLE32(*((int *)&gfilelist[numgroupfiles][(i<<4)+12]));
k = B_LITTLE32(*((int32_t *)&gfilelist[numgroupfiles][(i<<4)+12]));
gfilelist[numgroupfiles][(i<<4)+12] = 0;
gfileoffs[numgroupfiles][i] = j;
j += k;
516,9 → 516,9
return(groupfil[numgroupfiles-1]);
}
 
void uninitsinglegroupfile(int grphandle)
void uninitsinglegroupfile(int32_t grphandle)
{
int i, grpnum = -1;
int32_t i, grpnum = -1;
 
for (i=numgroupfiles-1;i>=0;i--)
if (groupfil[i] != -1 && groupfil[i] == grphandle)
562,7 → 562,7
 
void uninitgroupfile(void)
{
int i;
int32_t i;
 
for (i=numgroupfiles-1;i>=0;i--)
if (groupfil[i] != -1)
582,9 → 582,9
}
}
 
int kopen4load(char *filename, char searchfirst)
int32_t kopen4load(char *filename, char searchfirst)
{
int j, k, fil, newhandle;
int32_t j, k, fil, newhandle;
char bad, *gfileptr;
intptr_t i;
 
645,7 → 645,7
}
if (bad) continue;
if (j<13 && gfileptr[j]) continue; // JBF: because e1l1.map might exist before e1l1
if (j==13 && filename[j]) continue; // JBF: int file name
if (j==13 && filename[j]) continue; // JBF: int32_t file name
 
filegrp[newhandle] = k;
filehan[newhandle] = i;
657,9 → 657,9
return(-1);
}
 
int kread(int handle, void *buffer, int leng)
int32_t kread(int32_t handle, void *buffer, int32_t leng)
{
int i, filenum, groupnum;
int32_t i, filenum, groupnum;
 
filenum = filehan[handle];
groupnum = filegrp[handle];
696,9 → 696,9
return(0);
}
 
int klseek(int handle, int offset, int whence)
int32_t klseek(int32_t handle, int32_t offset, int32_t whence)
{
int i, groupnum;
int32_t i, groupnum;
 
groupnum = filegrp[handle];
 
735,9 → 735,9
return(-1);
}
 
int kfilelength(int handle)
int32_t kfilelength(int32_t handle)
{
int i, groupnum;
int32_t i, groupnum;
 
groupnum = filegrp[handle];
if (groupnum == 255)
762,9 → 762,9
return(gfileoffs[groupnum][i+1]-gfileoffs[groupnum][i]);
}
 
int ktell(int handle)
int32_t ktell(int32_t handle)
{
int groupnum = filegrp[handle];
int32_t groupnum = filegrp[handle];
 
if (groupnum == 255) return(Blseek(filehan[handle],0,BSEEK_CUR));
#ifdef WITHKPLIB
785,7 → 785,7
return(-1);
}
 
void kclose(int handle)
void kclose(int32_t handle)
{
if (handle < 0) return;
if (filegrp[handle] == 255) Bclose(filehan[handle]);
799,13 → 799,13
filehan[handle] = -1;
}
 
static int klistaddentry(CACHE1D_FIND_REC **rec, char *name, int type, int source)
static int32_t klistaddentry(CACHE1D_FIND_REC **rec, char *name, int32_t type, int32_t source)
{
CACHE1D_FIND_REC *r = NULL, *attach = NULL;
 
if (*rec)
{
int insensitive, v;
int32_t insensitive, v;
CACHE1D_FIND_REC *last = NULL;
 
for (attach = *rec; attach; last = attach, attach = attach->next)
887,7 → 887,7
}
}
 
CACHE1D_FIND_REC *klistpath(const char *_path, const char *mask, int type)
CACHE1D_FIND_REC *klistpath(const char *_path, const char *mask, int32_t type)
{
CACHE1D_FIND_REC *rec = NULL;
char *path;
900,7 → 900,7
 
// we don't need any leading dots and slashes or trailing slashes either
{
int i,j;
int32_t i,j;
for (i=0; path[i] == '.' || toupperlookup[path[i]] == '/';) i++;
for (j=0; (path[j] = path[i]); j++,i++) ;
while (j>0 && toupperlookup[path[j-1]] == '/') j--;
920,7 → 920,7
struct Bdirent *dirent;
// Adjusted for the following "autoload" dir fix - NY00123
const char *d = "./";
int stackdepth = CACHE1D_SOURCE_CURDIR;
int32_t stackdepth = CACHE1D_SOURCE_CURDIR;
char buf[BMAX_PATH];
 
if (pathsearchmode) d = _path;
980,7 → 980,7
if (!pathsearchmode) // next, zip files
{
char buf[BMAX_PATH];
int i, j, ftype;
int32_t i, j, ftype;
strcpy(buf,path);
if (*path) strcat(buf,"/");
strcat(buf,mask);
1047,7 → 1047,7
if (!pathsearchmode && !*path && (type & CACHE1D_FIND_FILE))
{
char buf[13];
int i,j;
int32_t i,j;
buf[12] = 0;
for (i=0;i<MAXGROUPFILES;i++)
{
1098,15 → 1098,15
//Internal LZW variables
#define LZWSIZE 16384 //Watch out for shorts!
static char *lzwbuf1, *lzwbuf4, *lzwbuf5, lzwbuflock[5];
static short *lzwbuf2, *lzwbuf3;
static int16_t *lzwbuf2, *lzwbuf3;
 
static int lzwcompress(char *lzwinbuf, int uncompleng, char *lzwoutbuf);
static int lzwuncompress(char *lzwinbuf, int compleng, char *lzwoutbuf);
static int32_t lzwcompress(char *lzwinbuf, int32_t uncompleng, char *lzwoutbuf);
static int32_t lzwuncompress(char *lzwinbuf, int32_t compleng, char *lzwoutbuf);
 
int kdfread(void *buffer, bsize_t dasizeof, bsize_t count, int fil)
int32_t kdfread(void *buffer, bsize_t dasizeof, bsize_t count, int32_t fil)
{
unsigned int i, j, k, kgoal;
short leng;
uint32_t i, j, k, kgoal;
int16_t leng;
char *ptr;
 
lzwbuflock[0] = lzwbuflock[1] = lzwbuflock[2] = lzwbuflock[3] = lzwbuflock[4] = 200;
1120,11 → 1120,11
ptr = (char *)buffer;
 
if (kread(fil,&leng,2) != 2) return -1; leng = B_LITTLE16(leng);
if (kread(fil,lzwbuf5,(int)leng) != leng) return -1;
k = 0; kgoal = lzwuncompress(lzwbuf5,(int)leng,lzwbuf4);
if (kread(fil,lzwbuf5,(int32_t)leng) != leng) return -1;
k = 0; kgoal = lzwuncompress(lzwbuf5,(int32_t)leng,lzwbuf4);
 
copybufbyte(lzwbuf4,ptr,(int)dasizeof);
k += (int)dasizeof;
copybufbyte(lzwbuf4,ptr,(int32_t)dasizeof);
k += (int32_t)dasizeof;
 
for (i=1;i<count;i++)
{
1131,8 → 1131,8
if (k >= kgoal)
{
if (kread(fil,&leng,2) != 2) return -1; leng = B_LITTLE16(leng);
if (kread(fil,lzwbuf5,(int)leng) != leng) return -1;
k = 0; kgoal = lzwuncompress(lzwbuf5,(int)leng,lzwbuf4);
if (kread(fil,lzwbuf5,(int32_t)leng) != leng) return -1;
k = 0; kgoal = lzwuncompress(lzwbuf5,(int32_t)leng,lzwbuf4);
}
for (j=0;j<dasizeof;j++) ptr[j+dasizeof] = ((ptr[j]+lzwbuf4[j+k])&255);
k += dasizeof;
1142,10 → 1142,10
return count;
}
 
int dfread(void *buffer, bsize_t dasizeof, bsize_t count, BFILE *fil)
int32_t dfread(void *buffer, bsize_t dasizeof, bsize_t count, BFILE *fil)
{
unsigned int i, j, k, kgoal;
short leng;
uint32_t i, j, k, kgoal;
int16_t leng;
char *ptr;
 
lzwbuflock[0] = lzwbuflock[1] = lzwbuflock[2] = lzwbuflock[3] = lzwbuflock[4] = 200;
1159,11 → 1159,11
ptr = (char *)buffer;
 
if (Bfread(&leng,2,1,fil) != 1) return -1; leng = B_LITTLE16(leng);
if (Bfread(lzwbuf5,(int)leng,1,fil) != 1) return -1;
k = 0; kgoal = lzwuncompress(lzwbuf5,(int)leng,lzwbuf4);
if (Bfread(lzwbuf5,(int32_t)leng,1,fil) != 1) return -1;
k = 0; kgoal = lzwuncompress(lzwbuf5,(int32_t)leng,lzwbuf4);
 
copybufbyte(lzwbuf4,ptr,(int)dasizeof);
k += (int)dasizeof;
copybufbyte(lzwbuf4,ptr,(int32_t)dasizeof);
k += (int32_t)dasizeof;
 
for (i=1;i<count;i++)
{
1170,8 → 1170,8
if (k >= kgoal)
{
if (Bfread(&leng,2,1,fil) != 1) return -1; leng = B_LITTLE16(leng);
if (Bfread(lzwbuf5,(int)leng,1,fil) != 1) return -1;
k = 0; kgoal = lzwuncompress(lzwbuf5,(int)leng,lzwbuf4);
if (Bfread(lzwbuf5,(int32_t)leng,1,fil) != 1) return -1;
k = 0; kgoal = lzwuncompress(lzwbuf5,(int32_t)leng,lzwbuf4);
}
for (j=0;j<dasizeof;j++) ptr[j+dasizeof] = ((ptr[j]+lzwbuf4[j+k])&255);
k += dasizeof;
1181,10 → 1181,10
return count;
}
 
void kdfwrite(void *buffer, bsize_t dasizeof, bsize_t count, int fil)
void kdfwrite(void *buffer, bsize_t dasizeof, bsize_t count, int32_t fil)
{
unsigned int i, j, k;
short leng, swleng;
uint32_t i, j, k;
int16_t leng, swleng;
char *ptr;
 
lzwbuflock[0] = lzwbuflock[1] = lzwbuflock[2] = lzwbuflock[3] = lzwbuflock[4] = 200;
1197,13 → 1197,13
if (dasizeof > LZWSIZE) { count *= dasizeof; dasizeof = 1; }
ptr = (char *)buffer;
 
copybufbyte(ptr,lzwbuf4,(int)dasizeof);
copybufbyte(ptr,lzwbuf4,(int32_t)dasizeof);
k = dasizeof;
 
if (k > LZWSIZE-dasizeof)
{
leng = (short)lzwcompress(lzwbuf4,k,lzwbuf5); k = 0; swleng = B_LITTLE16(leng);
Bwrite(fil,&swleng,2); Bwrite(fil,lzwbuf5,(int)leng);
leng = (int16_t)lzwcompress(lzwbuf4,k,lzwbuf5); k = 0; swleng = B_LITTLE16(leng);
Bwrite(fil,&swleng,2); Bwrite(fil,lzwbuf5,(int32_t)leng);
}
 
for (i=1;i<count;i++)
1212,15 → 1212,15
k += dasizeof;
if (k > LZWSIZE-dasizeof)
{
leng = (short)lzwcompress(lzwbuf4,k,lzwbuf5); k = 0; swleng = B_LITTLE16(leng);
Bwrite(fil,&swleng,2); Bwrite(fil,lzwbuf5,(int)leng);
leng = (int16_t)lzwcompress(lzwbuf4,k,lzwbuf5); k = 0; swleng = B_LITTLE16(leng);
Bwrite(fil,&swleng,2); Bwrite(fil,lzwbuf5,(int32_t)leng);
}
ptr += dasizeof;
}
if (k > 0)
{
leng = (short)lzwcompress(lzwbuf4,k,lzwbuf5); swleng = B_LITTLE16(leng);
Bwrite(fil,&swleng,2); Bwrite(fil,lzwbuf5,(int)leng);
leng = (int16_t)lzwcompress(lzwbuf4,k,lzwbuf5); swleng = B_LITTLE16(leng);
Bwrite(fil,&swleng,2); Bwrite(fil,lzwbuf5,(int32_t)leng);
}
lzwbuflock[0] = lzwbuflock[1] = lzwbuflock[2] = lzwbuflock[3] = lzwbuflock[4] = 1;
}
1227,8 → 1227,8
 
void dfwrite(void *buffer, bsize_t dasizeof, bsize_t count, BFILE *fil)
{
unsigned int i, j, k;
short leng, swleng;
uint32_t i, j, k;
int16_t leng, swleng;
char *ptr;
 
lzwbuflock[0] = lzwbuflock[1] = lzwbuflock[2] = lzwbuflock[3] = lzwbuflock[4] = 200;
1241,13 → 1241,13
if (dasizeof > LZWSIZE) { count *= dasizeof; dasizeof = 1; }
ptr = (char *)buffer;
 
copybufbyte(ptr,lzwbuf4,(int)dasizeof);
copybufbyte(ptr,lzwbuf4,(int32_t)dasizeof);
k = dasizeof;
 
if (k > LZWSIZE-dasizeof)
{
leng = (short)lzwcompress(lzwbuf4,k,lzwbuf5); k = 0; swleng = B_LITTLE16(leng);
Bfwrite(&swleng,2,1,fil); Bfwrite(lzwbuf5,(int)leng,1,fil);
leng = (int16_t)lzwcompress(lzwbuf4,k,lzwbuf5); k = 0; swleng = B_LITTLE16(leng);
Bfwrite(&swleng,2,1,fil); Bfwrite(lzwbuf5,(int32_t)leng,1,fil);
}
 
for (i=1;i<count;i++)
1256,24 → 1256,24
k += dasizeof;
if (k > LZWSIZE-dasizeof)
{
leng = (short)lzwcompress(lzwbuf4,k,lzwbuf5); k = 0; swleng = B_LITTLE16(leng);
Bfwrite(&swleng,2,1,fil); Bfwrite(lzwbuf5,(int)leng,1,fil);
leng = (int16_t)lzwcompress(lzwbuf4,k,lzwbuf5); k = 0; swleng = B_LITTLE16(leng);
Bfwrite(&swleng,2,1,fil); Bfwrite(lzwbuf5,(int32_t)leng,1,fil);
}
ptr += dasizeof;
}
if (k > 0)
{
leng = (short)lzwcompress(lzwbuf4,k,lzwbuf5); swleng = B_LITTLE16(leng);
Bfwrite(&swleng,2,1,fil); Bfwrite(lzwbuf5,(int)leng,1,fil);
leng = (int16_t)lzwcompress(lzwbuf4,k,lzwbuf5); swleng = B_LITTLE16(leng);
Bfwrite(&swleng,2,1,fil); Bfwrite(lzwbuf5,(int32_t)leng,1,fil);
}
lzwbuflock[0] = lzwbuflock[1] = lzwbuflock[2] = lzwbuflock[3] = lzwbuflock[4] = 1;
}
 
static int lzwcompress(char *lzwinbuf, int uncompleng, char *lzwoutbuf)
static int32_t lzwcompress(char *lzwinbuf, int32_t uncompleng, char *lzwoutbuf)
{
int i, addr, newaddr, addrcnt, zx, *intptr;
int bytecnt1, bitcnt, numbits, oneupnumbits;
short *shortptr;
int32_t i, addr, newaddr, addrcnt, zx, *intptr;
int32_t bytecnt1, bitcnt, numbits, oneupnumbits;
int16_t *shortptr;
 
for (i=255;i>=0;i--) { lzwbuf1[i] = i; lzwbuf3[i] = (i+1)&255; }
clearbuf(lzwbuf2,256>>1,0xffffffff);
1304,7 → 1304,7
lzwbuf2[addrcnt] = -1;
lzwbuf3[addrcnt] = -1;
 
intptr = (int *)&lzwoutbuf[bitcnt>>3];
intptr = (int32_t *)&lzwoutbuf[bitcnt>>3];
intptr[0] |= B_LITTLE32(addr<<(bitcnt&7));
bitcnt += numbits;
if ((addr&((oneupnumbits>>1)-1)) > ((addrcnt-1)&((oneupnumbits>>1)-1)))
1315,36 → 1315,36
}
while ((bytecnt1 < uncompleng) && (bitcnt < (uncompleng<<3)));
 
intptr = (int *)&lzwoutbuf[bitcnt>>3];
intptr = (int32_t *)&lzwoutbuf[bitcnt>>3];
intptr[0] |= B_LITTLE32(addr<<(bitcnt&7));
bitcnt += numbits;
if ((addr&((oneupnumbits>>1)-1)) > ((addrcnt-1)&((oneupnumbits>>1)-1)))
bitcnt--;
 
shortptr = (short *)lzwoutbuf;
shortptr[0] = B_LITTLE16((short)uncompleng);
shortptr = (int16_t *)lzwoutbuf;
shortptr[0] = B_LITTLE16((int16_t)uncompleng);
if (((bitcnt+7)>>3) < uncompleng)
{
shortptr[1] = B_LITTLE16((short)addrcnt);
shortptr[1] = B_LITTLE16((int16_t)addrcnt);
return((bitcnt+7)>>3);
}
shortptr[1] = (short)0;
shortptr[1] = (int16_t)0;
for (i=0;i<uncompleng;i++) lzwoutbuf[i+4] = lzwinbuf[i];
return(uncompleng+4);
}
 
static int lzwuncompress(char *lzwinbuf, int compleng, char *lzwoutbuf)
static int32_t lzwuncompress(char *lzwinbuf, int32_t compleng, char *lzwoutbuf)
{
int strtot, currstr, numbits, oneupnumbits;
int i, dat, leng, bitcnt, outbytecnt, *intptr;
short *shortptr;
int32_t strtot, currstr, numbits, oneupnumbits;
int32_t i, dat, leng, bitcnt, outbytecnt, *intptr;
int16_t *shortptr;
 
shortptr = (short *)lzwinbuf;
strtot = (int)B_LITTLE16(shortptr[1]);
shortptr = (int16_t *)lzwinbuf;
strtot = (int32_t)B_LITTLE16(shortptr[1]);
if (strtot == 0)
{
copybuf(lzwinbuf+4,lzwoutbuf,((compleng-4)+3)>>2);
return((int)B_LITTLE16(shortptr[0])); //uncompleng
return((int32_t)B_LITTLE16(shortptr[0])); //uncompleng
}
for (i=255;i>=0;i--) { lzwbuf2[i] = i; lzwbuf3[i] = i; }
currstr = 256; bitcnt = (4<<3); outbytecnt = 0;
1351,7 → 1351,7
numbits = 8; oneupnumbits = (1<<8);
do
{
intptr = (int *)&lzwinbuf[bitcnt>>3];
intptr = (int32_t *)&lzwinbuf[bitcnt>>3];
dat = ((B_LITTLE32(intptr[0])>>(bitcnt&7)) & (oneupnumbits-1));
bitcnt += numbits;
if ((dat&((oneupnumbits>>1)-1)) > ((currstr-1)&((oneupnumbits>>1)-1)))
1370,7 → 1370,7
if (currstr > oneupnumbits) { numbits++; oneupnumbits <<= 1; }
}
while (currstr < strtot);
return((int)B_LITTLE16(shortptr[0])); //uncompleng
return((int32_t)B_LITTLE16(shortptr[0])); //uncompleng
}
 
/*
/polymer/eduke32/build/src/compat.c
47,7 → 47,7
 
#ifndef __compat_h_macrodef__
 
int Brand(void)
int32_t Brand(void)
{
return rand();
}
62,9 → 62,9
free(ptr);
}
 
int Bopen(const char *pathname, int flags, unsigned mode)
int32_t Bopen(const char *pathname, int32_t flags, unsigned mode)
{
int n=0,o=0;
int32_t n=0,o=0;
 
if (flags&BO_BINARY) n|=O_BINARY; else n|=O_TEXT;
if ((flags&BO_RDWR)==BO_RDWR) n|=O_RDWR;
80,22 → 80,22
return open(pathname,n,o);
}
 
int Bclose(int fd)
int32_t Bclose(int32_t fd)
{
return close(fd);
}
 
bssize_t Bwrite(int fd, const void *buf, bsize_t count)
bssize_t Bwrite(int32_t fd, const void *buf, bsize_t count)
{
return write(fd,buf,count);
}
 
bssize_t Bread(int fd, void *buf, bsize_t count)
bssize_t Bread(int32_t fd, void *buf, bsize_t count)
{
return read(fd,buf,count);
}
 
int Blseek(int fildes, int offset, int whence)
int32_t Blseek(int32_t fildes, int32_t offset, int32_t whence)
{
switch (whence)
{
114,7 → 114,7
return (BFILE*)fopen(path,mode);
}
 
int Bfclose(BFILE *stream)
int32_t Bfclose(BFILE *stream)
{
return fclose((FILE*)stream);
}
124,22 → 124,22
rewind((FILE*)stream);
}
 
int Bfgetc(BFILE *stream)
int32_t Bfgetc(BFILE *stream)
{
return fgetc((FILE*)stream);
}
 
char *Bfgets(char *s, int size, BFILE *stream)
char *Bfgets(char *s, int32_t size, BFILE *stream)
{
return fgets(s,size,(FILE*)stream);
}
 
int Bfputc(int c, BFILE *stream)
int32_t Bfputc(int32_t c, BFILE *stream)
{
return fputc(c,(FILE*)stream);
}
 
int Bfputs(const char *s, BFILE *stream)
int32_t Bfputs(const char *s, BFILE *stream)
{
return fputs(s,(FILE*)stream);
}
170,17 → 170,17
return strncpy(dest,src,n);
}
 
int Bstrcmp(const char *s1, const char *s2)
int32_t Bstrcmp(const char *s1, const char *s2)
{
return strcmp(s1,s2);
}
 
int Bstrncmp(const char *s1, const char *s2, bsize_t n)
int32_t Bstrncmp(const char *s1, const char *s2, bsize_t n)
{
return strncmp(s1,s2,n);
}
 
int Bstrcasecmp(const char *s1, const char *s2)
int32_t Bstrcasecmp(const char *s1, const char *s2)
{
#ifdef _MSC_VER
return _stricmp(s1,s2);
189,7 → 189,7
#endif
}
 
int Bstrncasecmp(const char *s1, const char *s2, bsize_t n)
int32_t Bstrncasecmp(const char *s1, const char *s2, bsize_t n)
{
#ifdef _MSC_VER
return _strnicmp(s1,s2,n);
213,32 → 213,32
return strlen(s);
}
 
char *Bstrchr(const char *s, int c)
char *Bstrchr(const char *s, int32_t c)
{
return strchr(s,c);
}
 
char *Bstrrchr(const char *s, int c)
char *Bstrrchr(const char *s, int32_t c)
{
return strrchr(s,c);
}
 
int Batoi(const char *nptr)
int32_t Batoi(const char *nptr)
{
return atoi(nptr);
}
 
int Batol(const char *nptr)
int32_t Batol(const char *nptr)
{
return atol(nptr);
}
 
int int Bstrtol(const char *nptr, char **endptr, int base)
int32_t int32_t Bstrtol(const char *nptr, char **endptr, int32_t base)
{
return strtol(nptr,endptr,base);
}
 
unsigned int int Bstrtoul(const char *nptr, char **endptr, int base)
uint32_t int32_t Bstrtoul(const char *nptr, char **endptr, int32_t base)
{
return strtoul(nptr,endptr,base);
}
253,20 → 253,20
return memmove(dest,src,n);
}
 
void *Bmemchr(const void *s, int c, bsize_t n)
void *Bmemchr(const void *s, int32_t c, bsize_t n)
{
return memchr(s,c,n);
}
 
void *Bmemset(void *s, int c, bsize_t n)
void *Bmemset(void *s, int32_t c, bsize_t n)
{
return memset(s,c,n);
}
 
int Bprintf(const char *format, ...)
int32_t Bprintf(const char *format, ...)
{
va_list ap;
int r;
int32_t r;
 
va_start(ap,format);
#ifdef _MSC_VER
278,10 → 278,10
return r;
}
 
int Bsprintf(char *str, const char *format, ...)
int32_t Bsprintf(char *str, const char *format, ...)
{
va_list ap;
int r;
int32_t r;
 
va_start(ap,format);
#ifdef _MSC_VER
293,10 → 293,10
return r;
}
 
int Bsnprintf(char *str, bsize_t size, const char *format, ...)
int32_t Bsnprintf(char *str, bsize_t size, const char *format, ...)
{
va_list ap;
int r;
int32_t r;
 
va_start(ap,format);
#ifdef _MSC_VER
308,7 → 308,7
return r;
}
 
int Bvsnprintf(char *str, bsize_t size, const char *format, va_list ap)
int32_t Bvsnprintf(char *str, bsize_t size, const char *format, va_list ap)
{
#ifdef _MSC_VER
return _vsnprintf(str,size,format,ap);
339,7 → 339,7
#ifdef _WIN32
FARPROC aSHGetSpecialFolderPathA;
TCHAR appdata[MAX_PATH];
int loaded = 0;
int32_t loaded = 0;
HMODULE hShell32 = GetModuleHandle("shell32.dll");
 
if (hShell32 == NULL)
386,7 → 386,7
#endif
}
 
char *Bgetsupportdir(int global)
char *Bgetsupportdir(int32_t global)
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3_
UNREFERENCED_PARAMETER(global);
412,11 → 412,11
#endif
}
 
int Bcorrectfilename(char *filename, int removefn)
int32_t Bcorrectfilename(char *filename, int32_t removefn)
{
char *fn;
char *tokarr[64], *first, *next = NULL, *token;
int i, ntok = 0, leadslash = 0, trailslash = 0;
int32_t i, ntok = 0, leadslash = 0, trailslash = 0;
 
fn = strdup(filename);
if (!fn) return -1;
461,12 → 461,12
return 0;
}
 
int Bcanonicalisefilename(char *filename, int removefn)
int32_t Bcanonicalisefilename(char *filename, int32_t removefn)
{
char cwd[BMAX_PATH], fn[BMAX_PATH], *p;
char *fnp = filename;
#ifdef _WIN32
int drv = 0;
int32_t drv = 0;
#endif
 
#ifdef _WIN32
520,7 → 520,7
#ifdef _WIN32
char *str, *p;
DWORD drv, mask;
int number=0;
int32_t number=0;
 
drv = GetLogicalDrives();
if (drv == 0) return NULL;
552,11 → 552,11
}
 
 
int Bfilelength(int fd)
int32_t Bfilelength(int32_t fd)
{
struct stat st;
if (fstat(fd, &st) < 0) return -1;
return(int)(st.st_size);
return(int32_t)(st.st_size);
}
 
 
563,13 → 563,13
typedef struct
{
#ifdef _MSC_VER
int dir;
int32_t dir;
struct _finddata_t fid;
#else
DIR *dir;
#endif
struct Bdirent info;
int status;
int32_t status;
char name[1];
} BDIR_real;
 
680,7 → 680,7
return &dirr->info;
}
 
int Bclosedir(BDIR *dir)
int32_t Bclosedir(BDIR *dir)
{
BDIR_real *dirr = (BDIR_real*)dir;
 
695,7 → 695,7
}
 
 
char *Bstrtoken(char *s, char *delim, char **ptrptr, int chop)
char *Bstrtoken(char *s, char *delim, char **ptrptr, int32_t chop)
{
char *p, *start;
 
728,7 → 728,7
//Brute-force case-insensitive, slash-insensitive, * and ? wildcard matcher
//Given: string i and string j. string j can have wildcards
//Returns: 1:matches, 0:doesn't match
int Bwildmatch(const char *i, const char *j)
int32_t Bwildmatch(const char *i, const char *j)
{
const char *k;
char c0, c1;
778,15 → 778,15
//
// getsysmemsize() -- gets the amount of system memory in the machine
//
unsigned int Bgetsysmemsize(void)
uint32_t Bgetsysmemsize(void)
{
#ifdef _WIN32
MEMORYSTATUS memst;
GlobalMemoryStatus(&memst);
return (unsigned int)memst.dwTotalPhys;
return (uint32_t)memst.dwTotalPhys;
#elif (defined(_SC_PAGE_SIZE) || defined(_SC_PAGESIZE)) && defined(_SC_PHYS_PAGES)
unsigned int siz = 0x7fffffff;
int scpagesiz, scphyspages;
uint32_t siz = 0x7fffffff;
int32_t scpagesiz, scphyspages;
 
#ifdef _SC_PAGE_SIZE
scpagesiz = sysconf(_SC_PAGE_SIZE);
795,7 → 795,7
#endif
scphyspages = sysconf(_SC_PHYS_PAGES);
if (scpagesiz >= 0 && scphyspages >= 0)
siz = (unsigned int)min(longlong(0x7fffffff), (int64)scpagesiz * (int64)scphyspages);
siz = (uint32_t)min(longlong(0x7fffffff), (int64)scpagesiz * (int64)scphyspages);
 
//initprintf("Bgetsysmemsize(): %d pages of %d bytes, %d bytes of system memory\n",
// scphyspages, scpagesiz, siz);
/polymer/eduke32/build/src/config.c
11,15 → 11,15
#endif
#include "baselayer.h"
 
static int vesares[13][2] = {{320,200},{360,200},{320,240},{360,240},{320,400},
static int32_t vesares[13][2] = {{320,200},{360,200},{320,240},{360,240},{320,400},
{360,400},{640,350},{640,400},{640,480},{800,600},
{1024,768},{1280,1024},{1600,1200}
};
 
static int readconfig(BFILE *fp, const char *key, char *value, unsigned len)
static int32_t readconfig(BFILE *fp, const char *key, char *value, unsigned len)
{
char buf[1000], *k, *v, *eq;
int x=0;
int32_t x=0;
 
if (len < 1) return 0;
 
55,17 → 55,17
}
}
 
extern short brightness;
extern int16_t brightness;
extern char game_executable[BMAX_PATH];
extern int fullscreen;
extern int32_t fullscreen;
extern char option[8];
extern char keys[NUMBUILDKEYS];
extern unsigned char remap[256];
extern int remapinit;
extern char remap[256];
extern int32_t remapinit;
extern double msens;
extern int editorgridextent;
extern int showheightindicators;
extern int graphicsmode;
extern int32_t editorgridextent;
extern int32_t showheightindicators;
extern int32_t graphicsmode;
 
/*
* SETUP.DAT
105,12 → 105,12
* 18 = Chat (0xf)
*/
 
int loadsetup(const char *fn)
int32_t loadsetup(const char *fn)
{
BFILE *fp;
#define VL 256
char val[VL];
int i;
int32_t i;
 
if ((fp = Bfopen(fn, "rt")) == NULL) return -1;
 
234,7 → 234,7
 
#ifdef _WIN32
{
extern char map_dik_code(int);
extern char map_dik_code(int32_t);
for (i=0;i<256;i++)
remap[i]=map_dik_code(i);
}
246,7 → 246,7
remapinit=1;
if (readconfig(fp, "remap", val, VL) > 0)
{
char *p=val;int v1,v2;
char *p=val;int32_t v1,v2;
while (*p)
{
if (!sscanf(p,"%x",&v1))break;
262,10 → 262,10
return 0;
}
 
int writesetup(const char *fn)
int32_t writesetup(const char *fn)
{
BFILE *fp;
int i,first=1;
int32_t i,first=1;
 
fp = Bfopen(fn,"wt");
if (!fp) return -1;
/polymer/eduke32/build/src/crc32.c
2,7 → 2,7
 
/*
// this table of numbers is borrowed from the InfoZip source.
static unsigned int crc32table[256] = {
static uint32_t crc32table[256] = {
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
58,11 → 58,11
};
*/
 
static unsigned int crc32table[256];
static uint32_t crc32table[256];
 
void initcrc32table(void)
{
unsigned int i,j,k;
uint32_t i,j,k;
 
// algorithm and polynomial same as that used by infozip's zip
for (i=0; i<256; i++)
75,9 → 75,9
}
 
 
unsigned int crc32once(unsigned char *blk, unsigned int len)
uint32_t crc32once(uint8_t *blk, uint32_t len)
{
unsigned int crc;
uint32_t crc;
 
crc32init(&crc);
crc32block(&crc, blk, len);
84,20 → 84,20
return crc32finish(&crc);
}
 
void crc32init(unsigned int *crcvar)
void crc32init(uint32_t *crcvar)
{
if (!crcvar) return;
*crcvar = 0xffffffffl;
}
 
void crc32block(unsigned int *crcvar, unsigned char *blk, unsigned int len)
void crc32block(uint32_t *crcvar, uint8_t *blk, uint32_t len)
{
unsigned int crc = *crcvar;
uint32_t crc = *crcvar;
while (len--) crc = crc32table[(crc ^ *(blk++)) & 0xffl] ^(crc >> 8);
*crcvar = crc;
}
 
unsigned int crc32finish(unsigned int *crcvar)
uint32_t crc32finish(uint32_t *crcvar)
{
*crcvar = *crcvar ^ 0xffffffffl;
return *crcvar;
/polymer/eduke32/build/src/defs.c
78,7 → 78,7
T_TILEFROMTEXTURE, T_XOFFSET, T_YOFFSET
};
 
typedef struct { char *text; int tokenid; } tokenlist;
typedef struct { char *text; int32_t tokenid; } tokenlist;
static tokenlist basetokens[] =
{
{ "include", T_INCLUDE },
266,10 → 266,10
{ "yoff", T_YOFFSET },
};
 
static int getatoken(scriptfile *sf, tokenlist *tl, int ntokens)
static int32_t getatoken(scriptfile *sf, tokenlist *tl, int32_t ntokens)
{
char *tok;
int i;
int32_t i;
 
if (!sf) return T_ERROR;
tok = scriptfile_gettoken(sf);
284,12 → 284,12
return T_ERROR;
}
 
static int lastmodelid = -1, lastvoxid = -1, modelskin = -1, lastmodelskin = -1, seenframe = 0;
extern int nextvoxid;
static int32_t lastmodelid = -1, lastvoxid = -1, modelskin = -1, lastmodelskin = -1, seenframe = 0;
extern int32_t nextvoxid;
 
extern char faketile[MAXTILES];
extern char *faketiledata[MAXTILES];
extern int getclosestcol(int r, int g, int b);
extern int32_t getclosestcol(int32_t r, int32_t g, int32_t b);
 
#if defined(POLYMOST) && defined(USE_OPENGL)
extern float alphahackarray[MAXTILES];
303,9 → 303,9
"left face", "top face", "bottom face"
};
 
static int defsparser(scriptfile *script)
static int32_t defsparser(scriptfile *script)
{
int tokn;
int32_t tokn;
char *cmdtokptr;
while (1)
{
343,7 → 343,7
case T_DEFINE:
{
char *name;
int number;
int32_t number;
 
if (scriptfile_getstring(script,&name)) break;
if (scriptfile_getsymbol(script,&number)) break;
357,7 → 357,7
// OLD (DEPRECATED) DEFINITION SYNTAX
case T_DEFINETEXTURE:
{
int tile,pal,fnoo,i;
int32_t tile,pal,fnoo,i;
char *fn, *tfn = NULL;
 
if (scriptfile_getsymbol(script,&tile)) break;
391,7 → 391,7
break;
case T_DEFINESKYBOX:
{
int tile,pal,i,ii;
int32_t tile,pal,i,ii;
char *fn[6],happy=1,*tfn = NULL;
 
if (scriptfile_getsymbol(script,&tile)) break;
423,7 → 423,7
break;
case T_DEFINETINT:
{
int pal, r,g,b,f;
int32_t pal, r,g,b,f;
 
if (scriptfile_getsymbol(script,&pal)) break;
if (scriptfile_getnumber(script,&r)) break;
435,7 → 435,7
break;
case T_DEFINECONV:
{
int pal, pal1, pal2;
int32_t pal, pal1, pal2;
 
if (scriptfile_getsymbol(script,&pal)) break;
if (scriptfile_getnumber(script,&pal1)) break;
447,19 → 447,19
break;
case T_ALPHAHACK:
{
int tile;
int32_t tile;
double alpha;
 
if (scriptfile_getsymbol(script,&tile)) break;
if (scriptfile_getdouble(script,&alpha)) break;
#if defined(POLYMOST) && defined(USE_OPENGL)
if ((unsigned int)tile < MAXTILES) alphahackarray[tile] = alpha;
if ((uint32_t)tile < MAXTILES) alphahackarray[tile] = alpha;
#endif
}
break;
case T_ALPHAHACKRANGE:
{
int tilenume1,tilenume2,i;
int32_t tilenume1,tilenume2,i;
double alpha;
 
if (scriptfile_getsymbol(script,&tilenume1)) break;
477,7 → 477,7
{
for (i=tilenume1;i<=tilenume2;i++)
{
if ((unsigned int)i < MAXTILES)
if ((uint32_t)i < MAXTILES)
alphahackarray[i] = alpha;
}
}
486,12 → 486,12
break;
case T_SPRITECOL:
{
int tile,col,col2;
int32_t tile,col,col2;
 
if (scriptfile_getsymbol(script,&tile)) break;
if (scriptfile_getnumber(script,&col)) break;
if (scriptfile_getnumber(script,&col2)) break;
if ((unsigned int)tile < MAXTILES)
if ((uint32_t)tile < MAXTILES)
{
spritecol2d[tile][0] = col;
spritecol2d[tile][1] = col2;
500,7 → 500,7
break;
case T_2DCOL:
{
int col,b,g,r;
int32_t col,b,g,r;
 
if (scriptfile_getnumber(script,&col)) break;
if (scriptfile_getnumber(script,&r)) break;
517,7 → 517,7
break;
case T_FOGPAL:
{
int p,r,g,b,j;
int32_t p,r,g,b,j;
char tempbuf[256];
 
if (scriptfile_getnumber(script,&p)) break;
538,7 → 538,7
break;
case T_CACHESIZE:
{
int j;
int32_t j;
 
if (scriptfile_getnumber(script,&j)) break;
}
545,7 → 545,7
break;
case T_SETUPTILE:
{
int tile, tmp;
int32_t tile, tmp;
 
if (scriptfile_getsymbol(script,&tile)) break;
if (tile >= MAXTILES)break;
559,7 → 559,7
}
case T_SETUPTILERANGE:
{
int tile1,tile2,xsiz,ysiz,xoffs,yoffs,i;
int32_t tile1,tile2,xsiz,ysiz,xoffs,yoffs,i;
 
if (scriptfile_getnumber(script,&tile1)) break;
if (scriptfile_getnumber(script,&tile2)) break;
578,7 → 578,7
{
for (i=tile1;i<=tile2;i++)
{
if ((unsigned int)i < MAXTILES)
if ((uint32_t)i < MAXTILES)
{
h_xsize[i] = xsiz;
h_ysize[i] = ysiz;
591,7 → 591,7
}
case T_ANIMTILERANGE:
{
int tile1, tile2, spd, type, i;
int32_t tile1, tile2, spd, type, i;
 
if (scriptfile_getsymbol(script,&tile1)) break;
if (tile1 >= MAXTILES)break;
612,9 → 612,9
case T_TILEFROMTEXTURE:
{
char *texturetokptr = script->ltextptr, *textureend, *fn, *tfn = NULL;
int tile=-1, token, i;
int alphacut = 255;
int xoffset = 0, yoffset = 0;
int32_t tile=-1, token, i;
int32_t alphacut = 255;
int32_t xoffset = 0, yoffset = 0;
 
if (scriptfile_getsymbol(script,&tile)) break;
if (scriptfile_getbraces(script,&textureend)) break;
672,8 → 672,8
}
 
{
int xsiz, ysiz, j;
int *picptr = NULL;
int32_t xsiz, ysiz, j;
int32_t *picptr = NULL;
palette_t *col;
 
kpzload(fn, (intptr_t *)&picptr, &j, &xsiz, &ysiz);
705,9 → 705,9
picanm[tile] = (picanm[tile]&0xff00ffff)+((yoffset&255)<<16);
 
j = 15; while ((j > 1) && (pow2long[j] > xsiz)) j--;
picsiz[tile] = ((char)j);
picsiz[tile] = ((uint8_t)j);
j = 15; while ((j > 1) && (pow2long[j] > ysiz)) j--;
picsiz[tile] += ((char)(j<<4));
picsiz[tile] += ((uint8_t)(j<<4));
}
 
Bfree(picptr);
716,9 → 716,9
break;
case T_IMPORTTILE:
{
int tile, xsiz, ysiz, j, i;
int *picptr = NULL;
int bpl;
int32_t tile, xsiz, ysiz, j, i;
int32_t *picptr = NULL;
int32_t bpl;
char *fn;
palette_t *col;
 
750,9 → 750,9
picanm[tile] = 0;
 
j = 15; while ((j > 1) && (pow2long[j] > xsiz)) j--;
picsiz[tile] = ((char)j);
picsiz[tile] = ((uint8_t)j);
j = 15; while ((j > 1) && (pow2long[j] > ysiz)) j--;
picsiz[tile] += ((char)(j<<4));
picsiz[tile] += ((uint8_t)(j<<4));
}
 
Bfree(picptr);
760,7 → 760,7
}
case T_DUMMYTILE:
{
int tile, xsiz, ysiz, j;
int32_t tile, xsiz, ysiz, j;
extern char faketile[MAXTILES];
 
if (scriptfile_getsymbol(script,&tile)) break;
775,9 → 775,9
picanm[tile] = 0;
 
j = 15; while ((j > 1) && (pow2long[j] > xsiz)) j--;
picsiz[tile] = ((char)j);
picsiz[tile] = ((uint8_t)j);
j = 15; while ((j > 1) && (pow2long[j] > ysiz)) j--;
picsiz[tile] += ((char)(j<<4));
picsiz[tile] += ((uint8_t)(j<<4));
}
 
break;
784,7 → 784,7
}
case T_DUMMYTILERANGE:
{
int tile1,tile2,xsiz,ysiz,i,j;
int32_t tile1,tile2,xsiz,ysiz,i,j;
extern char faketile[MAXTILES];
 
if (scriptfile_getnumber(script,&tile1)) break;
802,7 → 802,7
{
for (i=tile1;i<=tile2;i++)
{
if ((unsigned int)i < MAXTILES)
if ((uint32_t)i < MAXTILES)
{
if (xsiz > 0 && ysiz > 0)
{
812,9 → 812,9
picanm[i] = 0;
 
j = 15; while ((j > 1) && (pow2long[j] > xsiz)) j--;
picsiz[i] = ((char)j);
picsiz[i] = ((uint8_t)j);
j = 15; while ((j > 1) && (pow2long[j] > ysiz)) j--;
picsiz[i] += ((char)(j<<4));
picsiz[i] += ((uint8_t)(j<<4));
}
}
}
826,7 → 826,7
{
char *modelfn;
double scale;
int shadeoffs;
int32_t shadeoffs;
 
if (scriptfile_getstring(script,&modelfn)) break;
if (scriptfile_getdouble(script,&scale)) break;
851,7 → 851,7
#if defined(POLYMOST) && defined(USE_OPENGL)
char happy=1;
#endif
int ftilenume, ltilenume, tilex;
int32_t ftilenume, ltilenume, tilex;
 
if (scriptfile_getstring(script,&framename)) break;
if (scriptfile_getnumber(script,&ftilenume)) break; //first tile number
897,7 → 897,7
case T_DEFINEMODELANIM:
{
char *startframe, *endframe;
int flags;
int32_t flags;
double dfps;
 
if (scriptfile_getstring(script,&startframe)) break;
911,7 → 911,7
break;
}
#if defined(POLYMOST) && defined(USE_OPENGL)
switch (md_defineanimation(lastmodelid, startframe, endframe, (int)(dfps*(65536.0*.001)), flags))
switch (md_defineanimation(lastmodelid, startframe, endframe, (int32_t)(dfps*(65536.0*.001)), flags))
{
case 0:
break;
935,7 → 935,7
break;
case T_DEFINEMODELSKIN:
{
int palnum;
int32_t palnum;
char *skinfn;
 
if (scriptfile_getsymbol(script,&palnum)) break;
1009,7 → 1009,7
break;
case T_DEFINEVOXELTILES:
{
int ftilenume, ltilenume, tilex;
int32_t ftilenume, ltilenume, tilex;
 
if (scriptfile_getnumber(script,&ftilenume)) break; //1st tile #
if (scriptfile_getnumber(script,&ltilenume)) break; //last tile #
1048,7 → 1048,7
{
char *modelend, *modelfn;
double scale=1.0, mzadd=0.0;
int shadeoffs=0, pal=0, flags=0;
int32_t shadeoffs=0, pal=0, flags=0;
 
modelskin = lastmodelskin = 0;
seenframe = 0;
1066,7 → 1066,7
#endif
while (script->textptr < modelend)
{
int token = getatoken(script,modeltokens,sizeof(modeltokens)/sizeof(tokenlist));
int32_t token = getatoken(script,modeltokens,sizeof(modeltokens)/sizeof(tokenlist));
switch (token)
{
//case T_ERROR: initprintf("Error on line %s:%d in model tokens\n", script->filename,script->linenum); break;
1082,7 → 1082,7
{
char *frametokptr = script->ltextptr;
char *frameend, *framename = 0, happy=1;
int ftilenume = -1, ltilenume = -1, tilex = 0;
int32_t ftilenume = -1, ltilenume = -1, tilex = 0;
double smoothduration = 0.1f;
 
if (scriptfile_getbraces(script,&frameend)) break;
1151,7 → 1151,7
{
char *animtokptr = script->ltextptr;
char *animend, *startframe = 0, *endframe = 0, happy=1;
int flags = 0;
int32_t flags = 0;
double dfps = 1.0;
 
if (scriptfile_getbraces(script,&animend)) break;
1180,7 → 1180,7
break;
}
#if defined(POLYMOST) && defined(USE_OPENGL)
switch (md_defineanimation(lastmodelid, startframe, endframe, (int)(dfps*(65536.0*.001)), flags))
switch (md_defineanimation(lastmodelid, startframe, endframe, (int32_t)(dfps*(65536.0*.001)), flags))
{
case 0:
break;
1207,7 → 1207,7
{
char *skintokptr = script->ltextptr;
char *skinend, *skinfn = 0;
int palnum = 0, surfnum = 0;
int32_t palnum = 0, surfnum = 0;
double param = 1.0;
 
if (scriptfile_getbraces(script,&skinend)) break;
1280,7 → 1280,7
{
char *hudtokptr = script->ltextptr;
char happy=1, *frameend;
int ftilenume = -1, ltilenume = -1, tilex = 0, flags = 0;
int32_t ftilenume = -1, ltilenume = -1, tilex = 0, flags = 0;
double xadd = 0.0, yadd = 0.0, zadd = 0.0, angadd = 0.0;
 
if (scriptfile_getbraces(script,&frameend)) break;
1370,7 → 1370,7
{
char *voxeltokptr = script->ltextptr;
char *fn, *modelend;
int tile0 = MAXTILES, tile1 = -1, tilex = -1;
int32_t tile0 = MAXTILES, tile1 = -1, tilex = -1;
 
if (scriptfile_getstring(script,&fn)) break; //voxel filename
if (nextvoxid == MAXVOXELS) { initprintf("Maximum number of voxels already defined.\n"); break; }
1388,7 → 1388,7
case T_TILE:
scriptfile_getsymbol(script,&tilex);
#ifdef SUPERBUILD
if ((unsigned int)tilex < MAXTILES) tiletovox[tilex] = lastvoxid;
if ((uint32_t)tilex < MAXTILES) tiletovox[tilex] = lastvoxid;
else initprintf("Invalid tile number on line %s:%d\n",script->filename, scriptfile_getlinum(script,voxeltokptr));
#endif
break;
1412,7 → 1412,7
double scale=1.0;
scriptfile_getdouble(script,&scale);
#ifdef SUPERBUILD
voxscale[lastvoxid] = (int)(65536*scale);
voxscale[lastvoxid] = (int32_t)(65536*scale);
#endif
break;
}
1425,7 → 1425,7
{
char *skyboxtokptr = script->ltextptr;
char *fn[6] = {0,0,0,0,0,0}, *modelend, happy=1, *tfn = NULL;
int i, tile = -1, pal = 0,ii;
int32_t i, tile = -1, pal = 0,ii;
 
if (scriptfile_getbraces(script,&modelend)) break;
while (script->textptr < modelend)
1481,7 → 1481,7
case T_TINT:
{
char *tinttokptr = script->ltextptr;
int red=255, green=255, blue=255, pal=-1, flags=0;
int32_t red=255, green=255, blue=255, pal=-1, flags=0;
char *tintend;
 
if (scriptfile_getbraces(script,&tintend)) break;
1514,10 → 1514,10
case T_TEXTURE:
{
char *texturetokptr = script->ltextptr, *textureend;
int tile=-1, token;
int32_t tile=-1, token;
 
char *fnB=0; double alphacutB=0, xscaleB=0, yscaleB=0; char flagsB=0;
int palmapbits=0;int palbits=0;
int32_t palmapbits=0;int32_t palbits=0;
 
if (scriptfile_getsymbol(script,&tile)) break;
if (scriptfile_getbraces(script,&textureend)) break;
1529,7 → 1529,7
case T_PAL:
{
char *paltokptr = script->ltextptr, *palend;
int pal=-1, i;
int32_t pal=-1, i;
char *fn = NULL, *tfn = NULL;
double alphacut = -1.0, xscale = 1.0, yscale = 1.0;
char flags = 0;
1600,7 → 1600,7
case T_REDPAL: case T_BLUEPAL: case T_BROWNPAL: case T_GREYPAL: case T_GREENPAL: case T_SPECPAL:
{
char *detailtokptr = script->ltextptr, *detailend;
int pal = 0, i;
int32_t pal = 0, i;
char *fn = NULL, *tfn = NULL;
double xscale = 1.0, yscale = 1.0;
char flags = 0;
1680,7 → 1680,7
#if defined(POLYMOST) && defined(USE_OPENGL)
if (palmapbits&&fnB)
{
int i;
int32_t i;
for (i=0;i<=25;i++)
if (!(palbits&(1<<i))&&(palmapbits&checkpalmaps(i)))
hicsetsubsttex(tile,i,fnB,alphacutB,xscaleB,yscaleB,flagsB);
1699,7 → 1699,7
case T_UNDEFMODEL:
case T_UNDEFMODELRANGE:
{
int r0,r1;
int32_t r0,r1;
 
if (scriptfile_getsymbol(script,&r0)) break;
if (tokn == T_UNDEFMODELRANGE)
1707,7 → 1707,7
if (scriptfile_getsymbol(script,&r1)) break;
if (r1 < r0)
{
int t = r1;
int32_t t = r1;
r1 = r0;
r0 = t;
initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr));
1735,9 → 1735,9
 
case T_UNDEFMODELOF:
{
int r0;
int32_t r0;
#if defined(POLYMOST) && defined(USE_OPENGL)
int mid;
int32_t mid;
#endif
 
if (scriptfile_getsymbol(script,&r0)) break;
1759,7 → 1759,7
case T_UNDEFTEXTURE:
case T_UNDEFTEXTURERANGE:
{
int r0,r1,i;
int32_t r0,r1,i;
 
if (scriptfile_getsymbol(script,&r0)) break;
if (tokn == T_UNDEFTEXTURERANGE)
1767,7 → 1767,7
if (scriptfile_getsymbol(script,&r1)) break;
if (r1 < r0)
{
int t = r1;
int32_t t = r1;
r1 = r0;
r0 = t;
initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr));
1824,7 → 1824,7
switch (getatoken(script,sound_musictokens,sizeof(sound_musictokens)/sizeof(tokenlist)))
{
case T_ID:
scriptfile_getsymbol(script,(int *)&dummy2);
scriptfile_getsymbol(script,(int32_t *)&dummy2);
break;
case T_FILE:
scriptfile_getstring(script,&dummy2);
1842,7 → 1842,7
}
 
 
int loaddefinitionsfile(char *fn)
int32_t loaddefinitionsfile(char *fn)
{
scriptfile *script;
 
/polymer/eduke32/build/src/dynamicgtk.c
13,9 → 13,9
if (!dynamicgtksyms.x ) { err = 1; break; } \
}
 
int dynamicgtk_init(void)
int32_t dynamicgtk_init(void)
{
int err = 0;
int32_t err = 0;
const char *failsym = NULL;
 
if (handle) return 1;
/polymer/eduke32/build/src/engine.c
48,13 → 48,13
#define kkfree kfree
 
#ifdef SUPERBUILD
void loadvoxel(int voxindex) { voxindex=0; }
int tiletovox[MAXTILES];
int usevoxels = 1;
void loadvoxel(int32_t voxindex) { voxindex=0; }
int32_t tiletovox[MAXTILES];
int32_t usevoxels = 1;
#define kloadvoxel loadvoxel
 
int novoxmips = 0;
int editorgridextent = 131072;
int32_t novoxmips = 0;
int32_t editorgridextent = 131072;
 
//These variables need to be copied into BUILD
#define MAXXSIZ 256
62,20 → 62,20
#define MAXZSIZ 255
#define MAXVOXMIPS 5
intptr_t voxoff[MAXVOXELS][MAXVOXMIPS]; char voxlock[MAXVOXELS][MAXVOXMIPS];
int voxscale[MAXVOXELS];
int32_t voxscale[MAXVOXELS];
 
static int ggxinc[MAXXSIZ+1], ggyinc[MAXXSIZ+1];
static int lowrecip[1024], nytooclose, nytoofar;
static unsigned int distrecip[65536];
static int32_t ggxinc[MAXXSIZ+1], ggyinc[MAXXSIZ+1];
static int32_t lowrecip[1024], nytooclose, nytoofar;
static uint32_t distrecip[65536];
#endif
 
static intptr_t *lookups = NULL;
static char lookupsalloctype = 255;
int dommxoverlay = 1, beforedrawrooms = 1, indrawroomsandmasks = 0;
int32_t dommxoverlay = 1, beforedrawrooms = 1, indrawroomsandmasks = 0;
 
static int oxdimen = -1, oviewingrange = -1, oxyaspect = -1;
static int32_t oxdimen = -1, oviewingrange = -1, oxyaspect = -1;
 
int curbrightness = 0, gammabrightness = 0;
int32_t curbrightness = 0, gammabrightness = 0;
 
double vid_gamma = DEFAULT_GAMMA;
double vid_contrast = DEFAULT_CONTRAST;
83,29 → 83,29
 
//Textured Map variables
static char globalpolytype;
static short *dotp1[MAXYDIM], *dotp2[MAXYDIM];
static int16_t *dotp1[MAXYDIM], *dotp2[MAXYDIM];
 
static char tempbuf[MAXWALLS];
static int8_t tempbuf[MAXWALLS];
 
int ebpbak, espbak;
int slopalookup[16384]; // was 2048
int32_t ebpbak, espbak;
int32_t slopalookup[16384]; // was 2048
#if defined(USE_OPENGL)
palette_t palookupfog[MAXPALOOKUPS];
#endif
 
static char permanentlock = 255;
int artversion, mapversion=7L; // JBF 20040211: default mapversion to 7
int32_t artversion, mapversion=7L; // JBF 20040211: default mapversion to 7
void *pic = NULL;
char picsiz[MAXTILES], tilefilenum[MAXTILES];
int lastageclock;
int tilefileoffs[MAXTILES];
int32_t lastageclock;
int32_t tilefileoffs[MAXTILES];
 
int artsize = 0, cachesize = 0;
int32_t artsize = 0, cachesize = 0;
 
static short radarang[1280], radarang2[MAXXDIM];
static unsigned short sqrtable[4096], shlookup[4096+256];
static int16_t radarang[1280], radarang2[MAXXDIM];
static uint16_t sqrtable[4096], shlookup[4096+256];
char pow2char[8] = {1,2,4,8,16,32,64,128};
int pow2long[32] =
int32_t pow2long[32] =
{
1L,2L,4L,8L,
16L,32L,64L,128L,
116,7 → 116,7
16777216L,33554432L,67108864L,134217728L,
268435456L,536870912L,1073741824L,2147483647L
};
int reciptable[2048], fpuasm;
int32_t reciptable[2048], fpuasm;
 
char britable[16][256]; // JBF 20040207: full 8bit precision
 
147,7 → 147,7
"shr eax, cl",\
parm nomemory [eax]\
modify exact [eax ebx ecx]
unsigned int nsqrtasm(unsigned int);
uint32_t nsqrtasm(uint32_t);
 
#pragma aux msqrtasm =\
"mov eax, 0x40000000",\
165,7 → 165,7
"shr eax, 1",\
parm nomemory [ecx]\
modify exact [eax ebx ecx]
int msqrtasm(unsigned int);
int32_t msqrtasm(uint32_t);
 
//0x007ff000 is (11<<13), 0x3f800000 is (127<<23)
#pragma aux krecipasm =\
185,7 → 185,7
"xor eax, ebx",\
parm [eax]\
modify exact [eax ebx ecx]
int krecipasm(int);
int32_t krecipasm(int32_t);
 
#pragma aux getclipmask =\
"sar eax, 31",\
201,7 → 201,7
"xor eax, ebx",\
parm [eax][ebx][ecx][edx]\
modify exact [eax ebx ecx edx]
int getclipmask(int,int,int,int);
int32_t getclipmask(int32_t,int32_t,int32_t,int32_t);
 
#pragma aux getkensmessagecrc =\
"xor eax, eax",\
213,7 → 213,7
"loop short beg",\
parm [ebx]\
modify exact [eax ebx ecx edx]
int getkensmessagecrc(int);
int32_t getkensmessagecrc(int32_t);
 
#elif defined(_MSC_VER) && !defined(NOASM) // __WATCOMC__
 
221,7 → 221,7
// Microsoft C Inline Assembly Routines
//
 
static inline int nsqrtasm(int a)
static inline int32_t nsqrtasm(int32_t a)
{
_asm
{
229,10 → 229,10
mov eax, a
test eax, 0xff000000
mov ebx, eax
jnz short over24
jnz int16_t over24
shr ebx, 12
mov cx, word ptr shlookup[ebx*2]
jmp short under24
jmp int16_t under24
over24:
shr ebx, 24
mov cx, word ptr shlookup[ebx*2+8192]
245,7 → 245,7
}
}
 
static inline int msqrtasm(int c)
static inline int32_t msqrtasm(int32_t c)
{
_asm
{
271,7 → 271,7
}
 
//0x007ff000 is (11<<13), 0x3f800000 is (127<<23)
static inline int krecipasm(int a)
static inline int32_t krecipasm(int32_t a)
{
_asm
{
295,7 → 295,7
}
}
 
static inline int getclipmask(int a, int b, int c, int d)
static inline int32_t getclipmask(int32_t a, int32_t b, int32_t c, int32_t d)
{
_asm
{
319,7 → 319,7
}
}
 
static inline int getkensmessagecrc(void *b)
static inline int32_t getkensmessagecrc(void *b)
{
_asm
{
332,7 → 332,7
ror edx, cl
adc eax, edx
bswap eax
loop short beg
loop int16_t beg
pop ebx
}
}
344,7 → 344,7
//
 
#define nsqrtasm(a) \
({ int __r, __a=(a); \
({ int32_t __r, __a=(a); \
__asm__ __volatile__ ( \
"testl $0xff000000, %%eax\n\t" \
"movl %%eax, %%ebx\n\t" \
365,7 → 365,7
 
// edx is blown by this code somehow?!
#define msqrtasm(c) \
({ int __r, __c=(c); \
({ int32_t __r, __c=(c); \
__asm__ __volatile__ ( \
"movl $0x40000000, %%eax\n\t" \
"movl $0x20000000, %%ebx\n\t" \
386,7 → 386,7
__r; })
 
#define krecipasm(a) \
({ int __a=(a); \
({ int32_t __a=(a); \
__asm__ __volatile__ ( \
"movl %%eax, ("ASMSYM("fpuasm")"); fildl ("ASMSYM("fpuasm")"); " \
"addl %%eax, %%eax; fstps ("ASMSYM("fpuasm")"); sbbl %%ebx, %%ebx; " \
398,7 → 398,7
__a; })
 
#define getclipmask(a,b,c,d) \
({ int __a=(a), __b=(b), __c=(c), __d=(d); \
({ int32_t __a=(a), __b=(b), __c=(c), __d=(d); \
__asm__ __volatile__ ("sarl $31, %%eax; addl %%ebx, %%ebx; adcl %%eax, %%eax; " \
"addl %%ecx, %%ecx; adcl %%eax, %%eax; addl %%edx, %%edx; " \
"adcl %%eax, %%eax; movl %%eax, %%ebx; shl $4, %%ebx; " \
409,7 → 409,7
 
 
#define getkensmessagecrc(b) \
({ int __a, __b=(b); \
({ int32_t __a, __b=(b); \
__asm__ __volatile__ ( \
"xorl %%eax, %%eax\n\t" \
"movl $32, %%ecx\n\t" \
424,11 → 424,11
 
#else // __GNUC__ && __i386__
 
static inline unsigned int nsqrtasm(unsigned int a)
static inline uint32_t nsqrtasm(uint32_t a)
{
// JBF 20030901: This was a damn lot simpler to reverse engineer than
// msqrtasm was. Really, it was just like simplifying an algebra equation.
unsigned short c;
uint16_t c;
 
if (a & 0xff000000) // test eax, 0xff000000 / jnz short over24
{
450,9 → 450,9
return a;
}
 
static inline int msqrtasm(unsigned int c)
static inline int32_t msqrtasm(uint32_t c)
{
unsigned int a,b;
uint32_t a,b;
 
a = 0x40000000l; // mov eax, 0x40000000
b = 0x20000000l; // mov ebx, 0x20000000
474,15 → 474,15
return a;
}
 
static inline int krecipasm(int i)
static inline int32_t krecipasm(int32_t i)
{
// Ken did this
float f = (float)i; i = *(int *)&f;
float f = (float)i; i = *(int32_t *)&f;
return((reciptable[(i>>12)&2047]>>(((i-0x3f800000)>>23)&31))^(i>>31));
}
 
 
static inline int getclipmask(int a, int b, int c, int d)
static inline int32_t getclipmask(int32_t a, int32_t b, int32_t c, int32_t d)
{
// Ken did this
d = ((a<0)*8) + ((b<0)*4) + ((c<0)*2) + (d<0);
489,7 → 489,7
return(((d<<4)^0xf0)|d);
}
 
inline int getkensmessagecrc(int b)
inline int32_t getkensmessagecrc(int32_t b)
{
return 0x56c764d4l;
b=b;
498,105 → 498,105
#endif
 
 
int xb1[MAXWALLSB], yb1[MAXWALLSB], xb2[MAXWALLSB], yb2[MAXWALLSB];
int rx1[MAXWALLSB], ry1[MAXWALLSB], rx2[MAXWALLSB], ry2[MAXWALLSB];
short p2[MAXWALLSB], thesector[MAXWALLSB];
short thewall[MAXWALLSB];
int32_t xb1[MAXWALLSB], yb1[MAXWALLSB], xb2[MAXWALLSB], yb2[MAXWALLSB];
int32_t rx1[MAXWALLSB], ry1[MAXWALLSB], rx2[MAXWALLSB], ry2[MAXWALLSB];
int16_t p2[MAXWALLSB], thesector[MAXWALLSB];
int16_t thewall[MAXWALLSB];
 
short bunchfirst[MAXWALLSB], bunchlast[MAXWALLSB];
int16_t bunchfirst[MAXWALLSB], bunchlast[MAXWALLSB];
 
static short smost[MAXYSAVES], smostcnt;
static short smoststart[MAXWALLSB];
static int16_t smost[MAXYSAVES], smostcnt;
static int16_t smoststart[MAXWALLSB];
static char smostwalltype[MAXWALLSB];
static int smostwall[MAXWALLSB], smostwallcnt = -1L;
static int32_t smostwall[MAXWALLSB], smostwallcnt = -1L;
 
short maskwall[MAXWALLSB], maskwallcnt;
static int spritesx[MAXSPRITESONSCREEN];
static int spritesy[MAXSPRITESONSCREEN+1];
static int spritesz[MAXSPRITESONSCREEN];
int16_t maskwall[MAXWALLSB], maskwallcnt;
static int32_t spritesx[MAXSPRITESONSCREEN];
static int32_t spritesy[MAXSPRITESONSCREEN+1];
static int32_t spritesz[MAXSPRITESONSCREEN];
spritetype *tspriteptr[MAXSPRITESONSCREEN];
 
short umost[MAXXDIM], dmost[MAXXDIM];
static short bakumost[MAXXDIM], bakdmost[MAXXDIM];
short uplc[MAXXDIM], dplc[MAXXDIM];
static short uwall[MAXXDIM], dwall[MAXXDIM];
static int swplc[MAXXDIM], lplc[MAXXDIM];
static int swall[MAXXDIM], lwall[MAXXDIM+4];
int xdimen = -1, xdimenrecip, halfxdimen, xdimenscale, xdimscale;
int wx1, wy1, wx2, wy2, ydimen;
int16_t umost[MAXXDIM], dmost[MAXXDIM];
static int16_t bakumost[MAXXDIM], bakdmost[MAXXDIM];
int16_t uplc[MAXXDIM], dplc[MAXXDIM];
static int16_t uwall[MAXXDIM], dwall[MAXXDIM];
static int32_t swplc[MAXXDIM], lplc[MAXXDIM];
static int32_t swall[MAXXDIM], lwall[MAXXDIM+4];
int32_t xdimen = -1, xdimenrecip, halfxdimen, xdimenscale, xdimscale;
int32_t wx1, wy1, wx2, wy2, ydimen;
intptr_t /*viewoffset,*/ frameoffset;
 
static int nrx1[8], nry1[8], nrx2[8], nry2[8]; // JBF 20031206: Thanks Ken
static int32_t nrx1[8], nry1[8], nrx2[8], nry2[8]; // JBF 20031206: Thanks Ken
 
static int rxi[8], ryi[8], rzi[8], rxi2[8], ryi2[8], rzi2[8];
static int xsi[8], ysi[8], horizycent;
static int32_t rxi[8], ryi[8], rzi[8], rxi2[8], ryi2[8], rzi2[8];
static int32_t xsi[8], ysi[8], horizycent;
static intptr_t *horizlookup=0, *horizlookup2=0;
 
int globalposx, globalposy, globalposz, globalhoriz;
short globalang, globalcursectnum;
int globalpal, cosglobalang, singlobalang;
int cosviewingrangeglobalang, sinviewingrangeglobalang;
int32_t globalposx, globalposy, globalposz, globalhoriz;
int16_t globalang, globalcursectnum;
int32_t globalpal, cosglobalang, singlobalang;
int32_t cosviewingrangeglobalang, sinviewingrangeglobalang;
char *globalpalwritten;
int globaluclip, globaldclip, globvis;
int globalvisibility, globalhisibility, globalpisibility, globalcisibility;
int32_t globaluclip, globaldclip, globvis;
int32_t globalvisibility, globalhisibility, globalpisibility, globalcisibility;
char globparaceilclip, globparaflorclip;
 
int xyaspect, viewingrangerecip;
int32_t xyaspect, viewingrangerecip;
 
intptr_t asm1, asm2, asm3, asm4;
int vplce[4], vince[4], palookupoffse[4], bufplce[4];
int32_t vplce[4], vince[4], palookupoffse[4], bufplce[4];
char globalxshift, globalyshift;
int globalxpanning, globalypanning, globalshade;
short globalpicnum, globalshiftval;
int globalzd, globalyscale, globalorientation;
int32_t globalxpanning, globalypanning, globalshade;
int16_t globalpicnum, globalshiftval;
int32_t globalzd, globalyscale, globalorientation;
intptr_t globalbufplc;
int globalx1, globaly1, globalx2, globaly2, globalx3, globaly3, globalzx;
int globalx, globaly, globalz;
int32_t globalx1, globaly1, globalx2, globaly2, globalx3, globaly3, globalzx;
int32_t globalx, globaly, globalz;
 
short sectorborder[256], sectorbordercnt;
int16_t sectorborder[256], sectorbordercnt;
static char tablesloaded = 0;
int pageoffset, ydim16, qsetmode = 0;
int startposx, startposy, startposz;
short startang, startsectnum;
short pointhighlight, linehighlight, highlightcnt;
int lastx[MAXYDIM];
int32_t pageoffset, ydim16, qsetmode = 0;
int32_t startposx, startposy, startposz;
int16_t startang, startsectnum;
int16_t pointhighlight, linehighlight, highlightcnt;
int32_t lastx[MAXYDIM];
char *transluc = NULL, paletteloaded = 0;
 
int halfxdim16, midydim16;
int32_t halfxdim16, midydim16;
 
#define FASTPALGRIDSIZ 8
static int rdist[129], gdist[129], bdist[129];
static int32_t rdist[129], gdist[129], bdist[129];
static char colhere[((FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2))>>3];
static char colhead[(FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2)];
static int colnext[256];
static int32_t colnext[256];
static char coldist[8] = {0,1,2,3,4,3,2,1};
static int colscan[27];
static int32_t colscan[27];
 
static short clipnum, hitwalls[4];
int hitscangoalx = (1<<29)-1, hitscangoaly = (1<<29)-1;
static int16_t clipnum, hitwalls[4];
int32_t hitscangoalx = (1<<29)-1, hitscangoaly = (1<<29)-1;
#ifdef POLYMOST
int hitallsprites = 0;
int32_t hitallsprites = 0;
#endif
 
typedef struct { int x1, y1, x2, y2; } linetype;
typedef struct { int32_t x1, y1, x2, y2; } linetype;
static linetype clipit[MAXCLIPNUM];
static short clipsectorlist[MAXCLIPNUM], clipsectnum;
static short clipobjectval[MAXCLIPNUM];
static int16_t clipsectorlist[MAXCLIPNUM], clipsectnum;
static int16_t clipobjectval[MAXCLIPNUM];
 
typedef struct
{
int sx, sy, z;
short a, picnum;
signed char dashade;
int32_t sx, sy, z;
int16_t a, picnum;
int8_t dashade;
char dapalnum, dastat, pagesleft;
int cx1, cy1, cx2, cy2;
int uniqid; //JF extension
int32_t cx1, cy1, cx2, cy2;
int32_t uniqid; //JF extension
} permfifotype;
static permfifotype permfifo[MAXPERMS];
static int permhead = 0, permtail = 0;
static int32_t permhead = 0, permtail = 0;
 
short numscans, numhits, numbunches;
short capturecount = 0;
int16_t numscans, numhits, numbunches;
int16_t capturecount = 0;
 
char vgapal16[4*256] =
{
606,27 → 606,27
63,63,63,00
};
 
short editstatus = 0;
short searchit;
int searchx = -1, searchy; //search input
short searchsector, searchwall, searchstat; //search output
int16_t editstatus = 0;
int16_t searchit;
int32_t searchx = -1, searchy; //search input
int16_t searchsector, searchwall, searchstat; //search output
double msens = 1.0;
 
static char artfilename[20];
static int numtilefiles, artfil = -1, artfilnum, artfilplc;
static int32_t numtilefiles, artfil = -1, artfilnum, artfilplc;
 
char inpreparemirror = 0;
static int mirrorsx1, mirrorsy1, mirrorsx2, mirrorsy2;
static int32_t mirrorsx1, mirrorsy1, mirrorsx2, mirrorsy2;
 
static int setviewcnt = 0; // interface layers use this now
static int bakframeplace[4], bakxsiz[4], bakysiz[4];
static int bakwindowx1[4], bakwindowy1[4];
static int bakwindowx2[4], bakwindowy2[4];
static int32_t setviewcnt = 0; // interface layers use this now
static int32_t bakframeplace[4], bakxsiz[4], bakysiz[4];
static int32_t bakwindowx1[4], bakwindowy1[4];
static int32_t bakwindowx2[4], bakwindowy2[4];
#ifdef POLYMOST
static int bakrendmode,baktile;
static int32_t bakrendmode,baktile;
#endif
 
int totalclocklock;
int32_t totalclocklock;
 
char apptitle[256] = "Build Engine";
palette_t curpalette[256]; // the current palette, unadjusted for brightness or tint
639,13 → 639,13
//
// Internal Engine Functions
//
//int cacheresets = 0,cacheinvalidates = 0;
//int32_t cacheresets = 0,cacheinvalidates = 0;
 
 
//
// getpalookup (internal)
//
static inline int getpalookup(int davis, int dashade)
static inline int32_t getpalookup(int32_t davis, int32_t dashade)
{
return(min(max(dashade+(davis>>8),0),numpalookups-1));
}
654,13 → 654,13
//
// scansector (internal)
//
static void scansector(short sectnum)
static void scansector(int16_t sectnum)
{
walltype *wal, *wal2;
spritetype *spr;
int xs, ys, x1, y1, x2, y2, xp1, yp1, xp2=0, yp2=0, tempint;
short z, zz, startwall, endwall, numscansbefore, scanfirst, bunchfrst;
short nextsectnum;
int32_t xs, ys, x1, y1, x2, y2, xp1, yp1, xp2=0, yp2=0, tempint;
int16_t z, zz, startwall, endwall, numscansbefore, scanfirst, bunchfrst;
int16_t nextsectnum;
 
if (sectnum < 0) return;
 
795,14 → 795,14
//
// maskwallscan (internal)
//
static void maskwallscan(int x1, int x2, short *uwal, short *dwal, int *swal, int *lwal)
static void maskwallscan(int32_t x1, int32_t x2, int16_t *uwal, int16_t *dwal, int32_t *swal, int32_t *lwal)
{
int x,/* startx,*/ xnice, ynice, fpalookup;
int32_t x,/* startx,*/ xnice, ynice, fpalookup;
intptr_t startx, p;
int y1ve[4], y2ve[4], /* p,*/ tsizx, tsizy;
int32_t y1ve[4], y2ve[4], /* p,*/ tsizx, tsizy;
#ifndef ENGINE_USING_A_C
char bad;
int i, u4, d4, dax, z;
int32_t i, u4, d4, dax, z;
#endif
 
tsizx = tilesizx[globalpicnum];
841,7 → 841,7
y2ve[0] = min(dwal[x],startdmost[x+windowx1]-windowy1);
if (y2ve[0] <= y1ve[0]) continue;
 
palookupoffse[0] = fpalookup+(getpalookup((int)mulscale16(swal[x],globvis),globalshade)<<8);
palookupoffse[0] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x],globvis),globalshade)<<8);
 
bufplce[0] = lwal[x] + globalxpanning;
if (bufplce[0] >= tsizx) { if (xnice == 0) bufplce[0] %= tsizx; else bufplce[0] &= tsizx; }
871,8 → 871,8
}
if (bad == 15) continue;
 
palookupoffse[0] = fpalookup+(getpalookup((int)mulscale16(swal[x],globvis),globalshade)<<8);
palookupoffse[3] = fpalookup+(getpalookup((int)mulscale16(swal[x+3],globvis),globalshade)<<8);
palookupoffse[0] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x],globvis),globalshade)<<8);
palookupoffse[3] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x+3],globvis),globalshade)<<8);
 
if ((palookupoffse[0] == palookupoffse[3]) && ((bad&0x9) == 0))
{
881,8 → 881,8
}
else
{
palookupoffse[1] = fpalookup+(getpalookup((int)mulscale16(swal[x+1],globvis),globalshade)<<8);
palookupoffse[2] = fpalookup+(getpalookup((int)mulscale16(swal[x+2],globvis),globalshade)<<8);
palookupoffse[1] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x+1],globvis),globalshade)<<8);
palookupoffse[2] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x+2],globvis),globalshade)<<8);
}
 
u4 = max(max(y1ve[0],y1ve[1]),max(y1ve[2],y1ve[3]));
916,7 → 916,7
y2ve[0] = min(dwal[x],startdmost[x+windowx1]-windowy1);
if (y2ve[0] <= y1ve[0]) continue;
 
palookupoffse[0] = fpalookup+(getpalookup((int)mulscale16(swal[x],globvis),globalshade)<<8);
palookupoffse[0] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x],globvis),globalshade)<<8);
 
bufplce[0] = lwal[x] + globalxpanning;
if (bufplce[0] >= tsizx) { if (xnice == 0) bufplce[0] %= tsizx; else bufplce[0] &= tsizx; }
937,7 → 937,7
y2ve[0] = min(dwal[x],startdmost[x+windowx1]-windowy1);
if (y2ve[0] <= y1ve[0]) continue;
 
palookupoffse[0] = fpalookup+(getpalookup((int)mulscale16(swal[x],globvis),globalshade)<<8);
palookupoffse[0] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x],globvis),globalshade)<<8);
 
bufplce[0] = lwal[x] + globalxpanning;
if (bufplce[0] >= tsizx) { if (xnice == 0) bufplce[0] %= tsizx; else bufplce[0] &= tsizx; }
958,10 → 958,10
//
// wallfront (internal)
//
int wallfront(int l1, int l2)
int32_t wallfront(int32_t l1, int32_t l2)
{
walltype *wal;
int x11, y11, x21, y21, x12, y12, x22, y22, dx, dy, t1, t2;
int32_t x11, y11, x21, y21, x12, y12, x22, y22, dx, dy, t1, t2;
 
wal = &wall[thewall[l1]]; x11 = wal->x; y11 = wal->y;
wal = &wall[wal->point2]; x21 = wal->x; y21 = wal->y;
996,10 → 996,10
//
// spritewallfront (internal)
//
static int spritewallfront(spritetype *s, int w)
static int32_t spritewallfront(spritetype *s, int32_t w)
{
walltype *wal;
int x1, y1;
int32_t x1, y1;
 
wal = &wall[w]; x1 = wal->x; y1 = wal->y;
wal = &wall[wal->point2];
1010,12 → 1010,12
// spritebehindwall(internal)
//
#if 0
static int spriteobstructswall(spritetype *s, int w)
static int32_t spriteobstructswall(spritetype *s, int32_t w)
{
walltype *wal;
int x, y;
int x1, y1;
int x2, y2;
int32_t x, y;
int32_t x1, y1;
int32_t x2, y2;
double a1, b1, c1;
double a2, b2, c2;
double d1, d2;
1061,9 → 1061,9
//
// bunchfront (internal)
//
static int bunchfront(int b1, int b2)
static int32_t bunchfront(int32_t b1, int32_t b2)
{
int x1b1, x2b1, x1b2, x2b2, b1f, b2f, i;
int32_t x1b1, x2b1, x1b2, x2b2, b1f, b2f, i;
 
b1f = bunchfirst[b1]; x1b1 = xb1[b1f]; x2b2 = xb2[bunchlast[b2]]+1;
if (x1b1 >= x2b2) return(-1);
1083,15 → 1083,15
//
// hline (internal)
//
static void hline(int xr, int yp)
static void hline(int32_t xr, int32_t yp)
{
int xl, r, s;
int32_t xl, r, s;
 
xl = lastx[yp]; if (xl > xr) return;
r = horizlookup2[yp-globalhoriz+horizycent];
asm1 = globalx1*r;
asm2 = globaly2*r;
s = ((int)getpalookup((int)mulscale16(r,globvis),globalshade)<<8);
s = ((int32_t)getpalookup((int32_t)mulscale16(r,globvis),globalshade)<<8);
 
hlineasm4(xr-xl,0,s,globalx2*r+globalypanning,globaly1*r+globalxpanning,
ylookup[yp]+xr+frameoffset);
1101,9 → 1101,9
//
// slowhline (internal)
//
static void slowhline(int xr, int yp)
static void slowhline(int32_t xr, int32_t yp)
{
int xl, r;
int32_t xl, r;
 
xl = lastx[yp]; if (xl > xr) return;
r = horizlookup2[yp-globalhoriz+horizycent];
1110,7 → 1110,7
asm1 = globalx1*r;
asm2 = globaly2*r;
 
asm3 = (intptr_t)globalpalwritten + ((intptr_t)getpalookup((int)mulscale16(r,globvis),globalshade)<<8);
asm3 = (intptr_t)globalpalwritten + ((intptr_t)getpalookup((int32_t)mulscale16(r,globvis),globalshade)<<8);
if (!(globalorientation&256))
{
mhline(globalbufplc,globaly1*r+globalxpanning-asm1*(xr-xl),(xr-xl)<<16,0L,
1125,9 → 1125,9
//
// prepwall (internal)
//
static void prepwall(int z, walltype *wal)
static void prepwall(int32_t z, walltype *wal)
{
int i, l=0, ol=0, splc, sinc, x, topinc, top, botinc, bot, walxrepeat;
int32_t i, l=0, ol=0, splc, sinc, x, topinc, top, botinc, bot, walxrepeat;
 
walxrepeat = (wal->xrepeat<<3);
 
1206,9 → 1206,9
//
// animateoffs (internal)
//
int animateoffs(short tilenum, short fakevar)
int32_t animateoffs(int16_t tilenum, int16_t fakevar)
{
int i, k, offs;
int32_t i, k, offs;
 
UNREFERENCED_PARAMETER(fakevar);
 
1239,11 → 1239,11
//
// owallmost (internal)
//
static int owallmost(short *mostbuf, int w, int z)
static int32_t owallmost(int16_t *mostbuf, int32_t w, int32_t z)
{
int bad, inty, xcross, y, yinc;
int s1, s2, s3, s4, ix1, ix2, iy1, iy2, t;
int i;
int32_t bad, inty, xcross, y, yinc;
int32_t s1, s2, s3, s4, ix1, ix2, iy1, iy2, t;
int32_t i;
 
z <<= 7;
s1 = mulscale20(globaluclip,yb1[w]); s2 = mulscale20(globaluclip,yb2[w]);
1323,11 → 1323,11
//
// wallmost (internal)
//
int wallmost(short *mostbuf, int w, int sectnum, char dastat)
int32_t wallmost(int16_t *mostbuf, int32_t w, int32_t sectnum, char dastat)
{
int bad, i, j, t, y, z, inty, intz, xcross, yinc, fw;
int x1, y1, z1, x2, y2, z2, xv, yv, dx, dy, dasqr, oz1, oz2;
int s1, s2, s3, s4, ix1, ix2, iy1, iy2;
int32_t bad, i, j, t, y, z, inty, intz, xcross, yinc, fw;
int32_t x1, y1, z1, x2, y2, z2, xv, yv, dx, dy, dasqr, oz1, oz2;
int32_t s1, s2, s3, s4, ix1, ix2, iy1, iy2;
//char datempbuf[256];
 
if (dastat == 0)
1481,9 → 1481,9
//
// ceilscan (internal)
//
static void ceilscan(int x1, int x2, int sectnum)
static void ceilscan(int32_t x1, int32_t x2, int32_t sectnum)
{
int i, j, ox, oy, x, y1, y2, twall, bwall;
int32_t i, j, ox, oy, x, y1, y2, twall, bwall;
sectortype *sec;
 
sec = &sector[sectnum];
1500,15 → 1500,15
if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
setgotpic(globalpicnum);
if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) return;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs((short)globalpicnum,(short)sectnum);
if (picanm[globalpicnum]&192) globalpicnum += animateoffs((int16_t)globalpicnum,(int16_t)sectnum);
 
if (waloff[globalpicnum] == 0) loadtile(globalpicnum);
globalbufplc = waloff[globalpicnum];
 
globalshade = (int)sec->ceilingshade;
globalshade = (int32_t)sec->ceilingshade;
globvis = globalcisibility;
if (sec->visibility != 0) globvis = mulscale4(globvis,(int)((unsigned char)(sec->visibility+16)));
globalorientation = (int)sec->ceilingstat;
if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16)));
globalorientation = (int32_t)sec->ceilingstat;
 
 
if ((globalorientation&64) == 0)
1553,8 → 1553,8
globalx1 <<= globalxshift; globaly1 <<= globalxshift;
globalx2 <<= globalyshift; globaly2 <<= globalyshift;
globalxpanning <<= globalxshift; globalypanning <<= globalyshift;
globalxpanning += (((int)sec->ceilingxpanning)<<24);
globalypanning += (((int)sec->ceilingypanning)<<24);
globalxpanning += (((int32_t)sec->ceilingxpanning)<<24);
globalypanning += (((int32_t)sec->ceilingypanning)<<24);
globaly1 = (-globalx1-globaly1)*halfxdimen;
globalx2 = (globalx2-globaly2)*halfxdimen;
 
1652,9 → 1652,9
//
// florscan (internal)
//
static void florscan(int x1, int x2, int sectnum)
static void florscan(int32_t x1, int32_t x2, int32_t sectnum)
{
int i, j, ox, oy, x, y1, y2, twall, bwall;
int32_t i, j, ox, oy, x, y1, y2, twall, bwall;
sectortype *sec;
 
sec = &sector[sectnum];
1671,15 → 1671,15
if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
setgotpic(globalpicnum);
if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) return;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs((short)globalpicnum,(short)sectnum);
if (picanm[globalpicnum]&192) globalpicnum += animateoffs((int16_t)globalpicnum,(int16_t)sectnum);
 
if (waloff[globalpicnum] == 0) loadtile(globalpicnum);
globalbufplc = waloff[globalpicnum];
 
globalshade = (int)sec->floorshade;
globalshade = (int32_t)sec->floorshade;
globvis = globalcisibility;
if (sec->visibility != 0) globvis = mulscale4(globvis,(int)((unsigned char)(sec->visibility+16)));
globalorientation = (int)sec->floorstat;
if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16)));
globalorientation = (int32_t)sec->floorstat;
 
 
if ((globalorientation&64) == 0)
1724,8 → 1724,8
globalx1 <<= globalxshift; globaly1 <<= globalxshift;
globalx2 <<= globalyshift; globaly2 <<= globalyshift;
globalxpanning <<= globalxshift; globalypanning <<= globalyshift;
globalxpanning += (((int)sec->floorxpanning)<<24);
globalypanning += (((int)sec->floorypanning)<<24);
globalxpanning += (((int32_t)sec->floorxpanning)<<24);
globalypanning += (((int32_t)sec->floorypanning)<<24);
globaly1 = (-globalx1-globaly1)*halfxdimen;
globalx2 = (globalx2-globaly2)*halfxdimen;
 
1823,13 → 1823,13
//
// wallscan (internal)
//
static void wallscan(int x1, int x2, short *uwal, short *dwal, int *swal, int *lwal)
static void wallscan(int32_t x1, int32_t x2, int16_t *uwal, int16_t *dwal, int32_t *swal, int32_t *lwal)
{
int x, xnice, ynice, fpalookup;
int y1ve[4], y2ve[4], tsizx, tsizy;
int32_t x, xnice, ynice, fpalookup;
int32_t y1ve[4], y2ve[4], tsizx, tsizy;
#ifndef ENGINE_USING_A_C
char bad;
int i, u4, d4, z;
int32_t i, u4, d4, z;
#endif
 
if (x2 >= xdim) x2 = xdim-1;
1863,7 → 1863,7
y2ve[0] = min(dwal[x],dmost[x]);
if (y2ve[0] <= y1ve[0]) continue;
 
palookupoffse[0] = fpalookup+(getpalookup((int)mulscale16(swal[x],globvis),globalshade)<<8);
palookupoffse[0] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x],globvis),globalshade)<<8);
 
bufplce[0] = lwal[x] + globalxpanning;
if (bufplce[0] >= tsizx) { if (xnice == 0) bufplce[0] %= tsizx; else bufplce[0] &= tsizx; }
1893,8 → 1893,8
}
if (bad == 15) continue;
 
palookupoffse[0] = fpalookup+(getpalookup((int)mulscale16(swal[x],globvis),globalshade)<<8);
palookupoffse[3] = fpalookup+(getpalookup((int)mulscale16(swal[x+3],globvis),globalshade)<<8);
palookupoffse[0] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x],globvis),globalshade)<<8);
palookupoffse[3] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x+3],globvis),globalshade)<<8);
 
if ((palookupoffse[0] == palookupoffse[3]) && ((bad&0x9) == 0))
{
1903,8 → 1903,8
}
else
{
palookupoffse[1] = fpalookup+(getpalookup((int)mulscale16(swal[x+1],globvis),globalshade)<<8);
palookupoffse[2] = fpalookup+(getpalookup((int)mulscale16(swal[x+2],globvis),globalshade)<<8);
palookupoffse[1] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x+1],globvis),globalshade)<<8);
palookupoffse[2] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x+2],globvis),globalshade)<<8);
}
 
u4 = max(max(y1ve[0],y1ve[1]),max(y1ve[2],y1ve[3]));
1938,7 → 1938,7
y2ve[0] = min(dwal[x],dmost[x]);
if (y2ve[0] <= y1ve[0]) continue;
 
palookupoffse[0] = fpalookup+(getpalookup((int)mulscale16(swal[x],globvis),globalshade)<<8);
palookupoffse[0] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x],globvis),globalshade)<<8);
 
bufplce[0] = lwal[x] + globalxpanning;
if (bufplce[0] >= tsizx) { if (xnice == 0) bufplce[0] %= tsizx; else bufplce[0] &= tsizx; }
1958,7 → 1958,7
y2ve[0] = min(dwal[x],dmost[x]);
if (y2ve[0] <= y1ve[0]) continue;
 
palookupoffse[0] = fpalookup+(getpalookup((int)mulscale16(swal[x],globvis),globalshade)<<8);
palookupoffse[0] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x],globvis),globalshade)<<8);
 
bufplce[0] = lwal[x] + globalxpanning;
if (bufplce[0] >= tsizx) { if (xnice == 0) bufplce[0] %= tsizx; else bufplce[0] &= tsizx; }
1979,12 → 1979,12
//
// transmaskvline (internal)
//
static void transmaskvline(int x)
static void transmaskvline(int32_t x)
{
int vplc, vinc, i;
int32_t vplc, vinc, i;
intptr_t palookupoffs;
intptr_t bufplc,p;
short y1v, y2v;
int16_t y1v, y2v;
 
if ((x < 0) || (x >= xdimen)) return;
 
1993,7 → 1993,7
y2v--;
if (y2v < y1v) return;
 
palookupoffs = FP_OFF(palookup[globalpal]) + (getpalookup((int)mulscale16(swall[x],globvis),globalshade)<<8);
palookupoffs = FP_OFF(palookup[globalpal]) + (getpalookup((int32_t)mulscale16(swall[x],globvis),globalshade)<<8);
 
vinc = swall[x]*globalyscale;
vplc = globalzd + vinc*(y1v-globalhoriz+1);
2012,10 → 2012,10
// transmaskvline2 (internal)
//
#ifndef ENGINE_USING_A_C
static void transmaskvline2(int x)
static void transmaskvline2(int32_t x)
{
int i, y1, y2, x2;
short y1ve[2], y2ve[2];
int32_t i, y1, y2, x2;
int16_t y1ve[2], y2ve[2];
 
if ((x < 0) || (x >= xdimen)) return;
if (x == xdimen-1) { transmaskvline(x); return; }
2029,8 → 2029,8
y2ve[1] = min(dwall[x2],startdmost[x2+windowx1]-windowy1)-1;
if (y2ve[1] < y1ve[1]) { transmaskvline(x); return; }
 
palookupoffse[0] = FP_OFF(palookup[globalpal]) + (getpalookup((int)mulscale16(swall[x],globvis),globalshade)<<8);
palookupoffse[1] = FP_OFF(palookup[globalpal]) + (getpalookup((int)mulscale16(swall[x2],globvis),globalshade)<<8);
palookupoffse[0] = FP_OFF(palookup[globalpal]) + (getpalookup((int32_t)mulscale16(swall[x],globvis),globalshade)<<8);
palookupoffse[1] = FP_OFF(palookup[globalpal]) + (getpalookup((int32_t)mulscale16(swall[x2],globvis),globalshade)<<8);
 
setuptvlineasm2(globalshiftval,palookupoffse[0],palookupoffse[1]);
 
2084,9 → 2084,9
//
// transmaskwallscan (internal)
//
static void transmaskwallscan(int x1, int x2)
static void transmaskwallscan(int32_t x1, int32_t x2)
{
int x;
int32_t x;
 
setgotpic(globalpicnum);
if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) return;
2109,9 → 2109,9
//
// ceilspritehline (internal)
//
static void ceilspritehline(int x2, int y)
static void ceilspritehline(int32_t x2, int32_t y)
{
int x1, v, bx, by;
int32_t x1, v, bx, by;
 
//x = x1 + (x2-x1)t + (y1-y2)u ~ x = 160v
//y = y1 + (y2-y1)t + (x2-x1)u ~ y = (scrx-160)v
2125,7 → 2125,7
asm1 = mulscale14(globalx2,v);
asm2 = mulscale14(globaly2,v);
 
asm3 = FP_OFF(palookup[globalpal]) + (getpalookup((int)mulscale28(klabs(v),globvis),globalshade)<<8);
asm3 = FP_OFF(palookup[globalpal]) + (getpalookup((int32_t)mulscale28(klabs(v),globvis),globalshade)<<8);
 
if ((globalorientation&2) == 0)
mhline(globalbufplc,bx,(x2-x1)<<16,0L,by,ylookup[y]+x1+frameoffset);
2139,9 → 2139,9
//
// ceilspritescan (internal)
//
static void ceilspritescan(int x1, int x2)
static void ceilspritescan(int32_t x1, int32_t x2)
{
int x, y1, y2, twall, bwall;
int32_t x, y1, y2, twall, bwall;
 
y1 = uwall[x1]; y2 = y1;
for (x=x1;x<=x2;x++)
2178,11 → 2178,11
// grouscan (internal)
//
#define BITSOFPRECISION 3 //Don't forget to change this in A.ASM also!
static void grouscan(int dax1, int dax2, int sectnum, char dastat)
static void grouscan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat)
{
int i, j, l, x, y, dx, dy, wx, wy, y1, y2, daz;
int daslope, dasqr;
int shoffs, shinc, m1, m2, *mptr1, *mptr2, *nptr1, *nptr2;
int32_t i, j, l, x, y, dx, dy, wx, wy, y1, y2, daz;
int32_t daslope, dasqr;
int32_t shoffs, shinc, m1, m2, *mptr1, *mptr2, *nptr1, *nptr2;
walltype *wal;
sectortype *sec;
 
2273,24 → 2273,24
 
if (dastat == 0)
{
globalx1 += (((int)sec->ceilingxpanning)<<24);
globaly1 += (((int)sec->ceilingypanning)<<24);
globalx1 += (((int32_t)sec->ceilingxpanning)<<24);
globaly1 += (((int32_t)sec->ceilingypanning)<<24);
}
else
{
globalx1 += (((int)sec->floorxpanning)<<24);
globaly1 += (((int)sec->floorypanning)<<24);
globalx1 += (((int32_t)sec->floorxpanning)<<24);
globaly1 += (((int32_t)sec->floorypanning)<<24);
}
 
asm1 = -(globalzd>>(16-BITSOFPRECISION));
 
globvis = globalvisibility;
if (sec->visibility != 0) globvis = mulscale4(globvis,(int)((unsigned char)(sec->visibility+16)));
if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16)));
globvis = mulscale13(globvis,daz);
globvis = mulscale16(globvis,xdimscale);
j = FP_OFF(palookup[globalpal]);
 
setupslopevlin(((int)(picsiz[globalpicnum]&15))+(((int)(picsiz[globalpicnum]>>4))<<8),waloff[globalpicnum],-ylookup[1]);
setupslopevlin(((int32_t)(picsiz[globalpicnum]&15))+(((int32_t)(picsiz[globalpicnum]>>4))<<8),waloff[globalpicnum],-ylookup[1]);
 
l = (globalzd>>16);
 
2301,7 → 2301,7
//Avoid visibility overflow by crossing horizon
if (globalzd > 0) m1 += (globalzd>>16); else m1 -= (globalzd>>16);
m2 = m1+l;
mptr1 = (int *)&slopalookup[y1+(shoffs>>15)]; mptr2 = mptr1+1;
mptr1 = (int32_t *)&slopalookup[y1+(shoffs>>15)]; mptr2 = mptr1+1;
 
for (x=dax1;x<=dax2;x++)
{
2309,16 → 2309,16
else { y1 = max(umost[x],dplc[x]); y2 = dmost[x]-1; }
if (y1 <= y2)
{
nptr1 = (int *)&slopalookup[y1+(shoffs>>15)];
nptr2 = (int *)&slopalookup[y2+(shoffs>>15)];
nptr1 = (int32_t *)&slopalookup[y1+(shoffs>>15)];
nptr2 = (int32_t *)&slopalookup[y2+(shoffs>>15)];
while (nptr1 <= mptr1)
{
*mptr1-- = j + (getpalookup((int)mulscale24(krecipasm(m1),globvis),globalshade)<<8);
*mptr1-- = j + (getpalookup((int32_t)mulscale24(krecipasm(m1),globvis),globalshade)<<8);
m1 -= l;
}
while (nptr2 >= mptr2)
{
*mptr2++ = j + (getpalookup((int)mulscale24(krecipasm(m2),globvis),globalshade)<<8);
*mptr2++ = j + (getpalookup((int32_t)mulscale24(krecipasm(m2),globvis),globalshade)<<8);
m2 += l;
}
 
2340,11 → 2340,11
//
// parascan (internal)
//
static void parascan(int dax1, int dax2, int sectnum, char dastat, int bunch)
static void parascan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat, int32_t bunch)
{
sectortype *sec;
int j, k, l, m, n, x, z, wallnum, nextsectnum, globalhorizbak;
short *topptr, *botptr;
int32_t j, k, l, m, n, x, z, wallnum, nextsectnum, globalhorizbak;
int16_t *topptr, *botptr;
 
UNREFERENCED_PARAMETER(dax1);
UNREFERENCED_PARAMETER(dax2);
2356,15 → 2356,15
globalhoriz = mulscale16(globalhoriz-(ydimen>>1),parallaxyscale) + (ydimen>>1);
globvis = globalpisibility;
//globalorientation = 0L;
if (sec->visibility != 0) globvis = mulscale4(globvis,(int)((unsigned char)(sec->visibility+16)));
if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16)));
 
if (dastat == 0)
{
globalpal = sec->ceilingpal;
globalpicnum = sec->ceilingpicnum;
globalshade = (int)sec->ceilingshade;
globalxpanning = (int)sec->ceilingxpanning;
globalypanning = (int)sec->ceilingypanning;
globalshade = (int32_t)sec->ceilingshade;
globalxpanning = (int32_t)sec->ceilingxpanning;
globalypanning = (int32_t)sec->ceilingypanning;
topptr = umost;
botptr = uplc;
}
2372,15 → 2372,15
{
globalpal = sec->floorpal;
globalpicnum = sec->floorpicnum;
globalshade = (int)sec->floorshade;
globalxpanning = (int)sec->floorxpanning;
globalypanning = (int)sec->floorypanning;
globalshade = (int32_t)sec->floorshade;
globalxpanning = (int32_t)sec->floorxpanning;
globalypanning = (int32_t)sec->floorypanning;
topptr = dplc;
botptr = dmost;
}
 
if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(short)sectnum);
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(int16_t)sectnum);
globalshiftval = (picsiz[globalpicnum]>>4);
if (pow2long[globalshiftval] != tilesizy[globalpicnum]) globalshiftval++;
globalshiftval = 32-globalshiftval;
2414,13 → 2414,13
else
{
for (j=xb1[z];j<=xb2[z];j++)
lplc[j] = ((((int)radarang2[j]+globalang)&2047)>>k);
lplc[j] = ((((int32_t)radarang2[j]+globalang)&2047)>>k);
}
if (parallaxtype == 2)
{
n = mulscale16(xdimscale,viewingrange);
for (j=xb1[z];j<=xb2[z];j++)
swplc[j] = mulscale14(sintable[((int)radarang2[j]+512)&2047],n);
swplc[j] = mulscale14(sintable[((int32_t)radarang2[j]+512)&2047],n);
}
else
clearbuf(&swplc[xb1[z]],xb2[z]-xb1[z]+1,mulscale16(xdimscale,viewingrange));
2488,13 → 2488,13
//
// drawalls (internal)
//
static void drawalls(int bunch)
static void drawalls(int32_t bunch)
{
sectortype *sec, *nextsec;
walltype *wal;
int i, x, x1, x2, cz[5], fz[5];
int z, wallnum, sectnum, nextsectnum;
int startsmostwallcnt, startsmostcnt, gotswall;
int32_t i, x, x1, x2, cz[5], fz[5];
int32_t z, wallnum, sectnum, nextsectnum;
int32_t startsmostwallcnt, startsmostcnt, gotswall;
char andwstat1, andwstat2;
 
z = bunchfirst[bunch];
2503,8 → 2503,8
andwstat1 = 0xff; andwstat2 = 0xff;
for (;z>=0;z=p2[z]) //uplc/dplc calculation
{
andwstat1 &= wallmost(uplc,z,sectnum,(char)0);
andwstat2 &= wallmost(dplc,z,sectnum,(char)1);
andwstat1 &= wallmost(uplc,z,sectnum,(uint8_t)0);
andwstat2 &= wallmost(dplc,z,sectnum,(uint8_t)1);
}
 
if ((andwstat1&3) != 3) //draw ceilings
2567,11 → 2567,11
 
if (nextsectnum >= 0)
{
getzsofslope((short)sectnum,wal->x,wal->y,&cz[0],&fz[0]);
getzsofslope((short)sectnum,wall[wal->point2].x,wall[wal->point2].y,&cz[1],&fz[1]);
getzsofslope((short)nextsectnum,wal->x,wal->y,&cz[2],&fz[2]);
getzsofslope((short)nextsectnum,wall[wal->point2].x,wall[wal->point2].y,&cz[3],&fz[3]);
getzsofslope((short)nextsectnum,globalposx,globalposy,&cz[4],&fz[4]);
getzsofslope((int16_t)sectnum,wal->x,wal->y,&cz[0],&fz[0]);
getzsofslope((int16_t)sectnum,wall[wal->point2].x,wall[wal->point2].y,&cz[1],&fz[1]);
getzsofslope((int16_t)nextsectnum,wal->x,wal->y,&cz[2],&fz[2]);
getzsofslope((int16_t)nextsectnum,wall[wal->point2].x,wall[wal->point2].y,&cz[3],&fz[3]);
getzsofslope((int16_t)nextsectnum,globalposx,globalposy,&cz[4],&fz[4]);
 
if ((wal->cstat&48) == 16) maskwall[maskwallcnt++] = z;
 
2590,7 → 2590,7
}
else
{
wallmost(dwall,z,nextsectnum,(char)0);
wallmost(dwall,z,nextsectnum,(uint8_t)0);
if ((cz[2] > fz[0]) || (cz[3] > fz[1]))
for (i=x1;i<=x2;i++) if (dwall[i] > dplc[i]) dwall[i] = dplc[i];
 
2601,19 → 2601,19
searchstat = 0; searchit = 1;
}
 
globalorientation = (int)wal->cstat;
globalorientation = (int32_t)wal->cstat;
globalpicnum = wal->picnum;
if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
globalxpanning = (int)wal->xpanning;
globalypanning = (int)wal->ypanning;
globalxpanning = (int32_t)wal->xpanning;
globalypanning = (int32_t)wal->ypanning;
globalshiftval = (picsiz[globalpicnum]>>4);
if (pow2long[globalshiftval] != tilesizy[globalpicnum]) globalshiftval++;
globalshiftval = 32-globalshiftval;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(short)wallnum+16384);
globalshade = (int)wal->shade;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(int16_t)wallnum+16384);
globalshade = (int32_t)wal->shade;
globvis = globalvisibility;
if (sec->visibility != 0) globvis = mulscale4(globvis,(int)((unsigned char)(sec->visibility+16)));
globalpal = (int)wal->pal;
if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16)));
globalpal = (int32_t)wal->pal;
if (palookup[globalpal] == NULL) globalpal = 0; // JBF: fixes crash
globalyscale = (wal->yrepeat<<(globalshiftval-19));
if ((globalorientation&4) == 0)
2679,7 → 2679,7
}
else
{
wallmost(uwall,z,nextsectnum,(char)1);
wallmost(uwall,z,nextsectnum,(uint8_t)1);
if ((fz[2] < cz[0]) || (fz[3] < cz[1]))
for (i=x1;i<=x2;i++) if (uwall[i] < uplc[i]) uwall[i] = uplc[i];
 
2694,30 → 2694,30
if ((wal->cstat&2) > 0)
{
wallnum = wal->nextwall; wal = &wall[wallnum];
globalorientation = (int)wal->cstat;
globalorientation = (int32_t)wal->cstat;
globalpicnum = wal->picnum;
if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
globalxpanning = (int)wal->xpanning;
globalypanning = (int)wal->ypanning;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(short)wallnum+16384);
globalshade = (int)wal->shade;
globalpal = (int)wal->pal;
globalxpanning = (int32_t)wal->xpanning;
globalypanning = (int32_t)wal->ypanning;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(int16_t)wallnum+16384);
globalshade = (int32_t)wal->shade;
globalpal = (int32_t)wal->pal;
wallnum = thewall[z]; wal = &wall[wallnum];
}
else
{
globalorientation = (int)wal->cstat;
globalorientation = (int32_t)wal->cstat;
globalpicnum = wal->picnum;
if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
globalxpanning = (int)wal->xpanning;
globalypanning = (int)wal->ypanning;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(short)wallnum+16384);
globalshade = (int)wal->shade;
globalpal = (int)wal->pal;
globalxpanning = (int32_t)wal->xpanning;
globalypanning = (int32_t)wal->ypanning;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(int16_t)wallnum+16384);
globalshade = (int32_t)wal->shade;
globalpal = (int32_t)wal->pal;
}
if (palookup[globalpal] == NULL) globalpal = 0; // JBF: fixes crash
globvis = globalvisibility;
if (sec->visibility != 0) globvis = mulscale4(globvis,(int)((unsigned char)(sec->visibility+16)));
if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16)));
globalshiftval = (picsiz[globalpicnum]>>4);
if (pow2long[globalshiftval] != tilesizy[globalpicnum]) globalshiftval++;
globalshiftval = 32-globalshiftval;
2796,17 → 2796,17
}
if ((nextsectnum < 0) || (wal->cstat&32)) //White/1-way wall
{
globalorientation = (int)wal->cstat;
globalorientation = (int32_t)wal->cstat;
if (nextsectnum < 0) globalpicnum = wal->picnum;
else globalpicnum = wal->overpicnum;
if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
globalxpanning = (int)wal->xpanning;
globalypanning = (int)wal->ypanning;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(short)wallnum+16384);
globalshade = (int)wal->shade;
globalxpanning = (int32_t)wal->xpanning;
globalypanning = (int32_t)wal->ypanning;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(int16_t)wallnum+16384);
globalshade = (int32_t)wal->shade;
globvis = globalvisibility;
if (sec->visibility != 0) globvis = mulscale4(globvis,(int)((unsigned char)(sec->visibility+16)));
globalpal = (int)wal->pal;
if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16)));
globalpal = (int32_t)wal->pal;
if (palookup[globalpal] == NULL) globalpal = 0; // JBF: fixes crash
globalshiftval = (picsiz[globalpicnum]>>4);
if (pow2long[globalshiftval] != tilesizy[globalpicnum]) globalshiftval++;
2849,19 → 2849,19
// drawvox
//
#ifdef SUPERBUILD
static void drawvox(int dasprx, int daspry, int dasprz, int dasprang,
int daxscale, int dayscale, char daindex,
signed char dashade, char dapal, int *daumost, int *dadmost)
static void drawvox(int32_t dasprx, int32_t daspry, int32_t dasprz, int32_t dasprang,
int32_t daxscale, int32_t dayscale, char daindex,
int8_t dashade, char dapal, int32_t *daumost, int32_t *dadmost)
{
int i, j, k, x, y, syoff, ggxstart, ggystart, nxoff;
int cosang, sinang, sprcosang, sprsinang, backx, backy, gxinc, gyinc;
int daxsiz, daysiz, dazsiz, daxpivot, daypivot, dazpivot;
int daxscalerecip, dayscalerecip, cnt, gxstart, gystart, odayscale;
int l1, l2, /*slabxoffs,*/ xyvoxoffs, *longptr;
int32_t i, j, k, x, y, syoff, ggxstart, ggystart, nxoff;
int32_t cosang, sinang, sprcosang, sprsinang, backx, backy, gxinc, gyinc;
int32_t daxsiz, daysiz, dazsiz, daxpivot, daypivot, dazpivot;
int32_t daxscalerecip, dayscalerecip, cnt, gxstart, gystart, odayscale;
int32_t l1, l2, /*slabxoffs,*/ xyvoxoffs, *longptr;
intptr_t slabxoffs;
int lx, rx, nx, ny, x1=0, y1=0, z1, x2=0, y2=0, z2, yplc, yinc=0;
int yoff, xs=0, ys=0, xe, ye, xi=0, yi=0, cbackx, cbacky, dagxinc, dagyinc;
short *shortptr;
int32_t lx, rx, nx, ny, x1=0, y1=0, z1, x2=0, y2=0, z2, yplc, yinc=0;
int32_t yoff, xs=0, ys=0, xe, ye, xi=0, yi=0, cbackx, cbacky, dagxinc, dagyinc;
int16_t *shortptr;
char *voxptr, *voxend, *davoxptr, oand, oand16, oand32;
 
cosang = sintable[(globalang+512)&2047];
2870,7 → 2870,7
sprsinang = sintable[dasprang&2047];
 
i = klabs(dmulscale6(dasprx-globalposx,cosang,daspry-globalposy,sinang));
j = (int)(getpalookup((int)mulscale21(globvis,i),(int)dashade)<<8);
j = (int32_t)(getpalookup((int32_t)mulscale21(globvis,i),(int32_t)dashade)<<8);
setupdrawslab(ylookup[1],FP_OFF(palookup[dapal])+j);
j = 1310720;
j *= min(daxscale,dayscale); j >>= 6; //New hacks (for sized-down voxels)
2902,7 → 2902,7
daxscalerecip = (1<<30)/daxscale;
dayscalerecip = (1<<30)/dayscale;
 
longptr = (int *)davoxptr;
longptr = (int32_t *)davoxptr;
daxsiz = B_LITTLE32(longptr[0]); daysiz = B_LITTLE32(longptr[1]); dazsiz = B_LITTLE32(longptr[2]);
daxpivot = B_LITTLE32(longptr[3]); daypivot = B_LITTLE32(longptr[4]); dazpivot = B_LITTLE32(longptr[5]);
davoxptr += (6<<2);
2938,7 → 2938,7
if ((klabs(globalposz-dasprz)>>10) >= klabs(odayscale)) return;
syoff = divscale21(globalposz-dasprz,odayscale) + (dazpivot<<7);
yoff = ((klabs(gxinc)+klabs(gyinc))>>1);
longptr = (int *)davoxptr;
longptr = (int32_t *)davoxptr;
xyvoxoffs = ((daxsiz+1)<<2);
 
begindrawing(); //{{{
3029,7 → 3029,7
for (x=xs;x!=xe;x+=xi)
{
slabxoffs = (intptr_t)&davoxptr[B_LITTLE32(longptr[x])];
shortptr = (short *)&davoxptr[((x*(daysiz+1))<<1)+xyvoxoffs];
shortptr = (int16_t *)&davoxptr[((x*(daysiz+1))<<1)+xyvoxoffs];
 
nx = mulscale16(ggxstart+ggxinc[x],viewingrangerecip)+x1;
ny = ggystart+ggyinc[x];
3102,18 → 3102,18
//
// drawsprite (internal)
//
static void drawsprite(int snum)
static void drawsprite(int32_t snum)
{
spritetype *tspr;
sectortype *sec;
int startum, startdm, sectnum, xb, yp, cstat;
int siz, xsiz, ysiz, xoff, yoff, xspan, yspan;
int x1, y1, x2, y2, lx, rx, dalx2, darx2, i, j, k, x, linum, linuminc;
int yinc, z, z1, z2, xp1, yp1, xp2, yp2;
int xv, yv, top, topinc, bot, botinc, hplc, hinc;
int cosang, sinang, dax, day, lpoint, lmax, rpoint, rmax, dax1, dax2, y;
int npoints, npoints2, zz, t, zsgn, zzsgn, *longptr;
int tilenum, vtilenum = 0, spritenum;
int32_t startum, startdm, sectnum, xb, yp, cstat;
int32_t siz, xsiz, ysiz, xoff, yoff, xspan, yspan;
int32_t x1, y1, x2, y2, lx, rx, dalx2, darx2, i, j, k, x, linum, linuminc;
int32_t yinc, z, z1, z2, xp1, yp1, xp2, yp2;
int32_t xv, yv, top, topinc, bot, botinc, hplc, hinc;
int32_t cosang, sinang, dax, day, lpoint, lmax, rpoint, rmax, dax1, dax2, y;
int32_t npoints, npoints2, zz, t, zsgn, zzsgn, *longptr;
int32_t tilenum, vtilenum = 0, spritenum;
char swapped, daclip;
 
//============================================================================= //POLYMOST BEGINS
3180,8 → 3180,8
if (cstat&512) settransreverse(); else settransnormal();
}
 
xoff = (int)((signed char)((picanm[tilenum]>>8)&255))+((int)tspr->xoffset);
yoff = (int)((signed char)((picanm[tilenum]>>16)&255))+((int)tspr->yoffset);
xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)tspr->xoffset);
yoff = (int32_t)((int8_t)((picanm[tilenum]>>16)&255))+((int32_t)tspr->yoffset);
 
if ((cstat&48) == 0)
{
3189,7 → 3189,7
 
siz = divscale19(xdimenscale,yp);
 
xv = mulscale16(((int)tspr->xrepeat)<<16,xyaspect);
xv = mulscale16(((int32_t)tspr->xrepeat)<<16,xyaspect);
 
xspan = tilesizx[tilenum];
yspan = tilesizy[tilenum];
3256,8 → 3256,8
 
for (x=lx;x<=rx;x++)
{
uwall[x] = max(startumost[x+windowx1]-windowy1,(short)startum);
dwall[x] = min(startdmost[x+windowx1]-windowy1,(short)startdm);
uwall[x] = max(startumost[x+windowx1]-windowy1,(int16_t)startum);
dwall[x] = min(startdmost[x+windowx1]-windowy1,(int16_t)startdm);
}
daclip = 0;
for (i=smostwallcnt-1;i>=0;i--)
3266,7 → 3266,7
j = smostwall[i];
if ((xb1[j] > rx) || (xb2[j] < lx)) continue;
if ((yp <= yb1[j]) && (yp <= yb2[j])) continue;
if (spritewallfront(tspr,(int)thewall[j]) && ((yp <= yb1[j]) || (yp <= yb2[j]))) continue;
if (spritewallfront(tspr,(int32_t)thewall[j]) && ((yp <= yb1[j]) || (yp <= yb2[j]))) continue;
 
dalx2 = max(xb1[j],lx); darx2 = min(xb2[j],rx);
 
3324,7 → 3324,7
globalxpanning = 0L;
globalypanning = 0L;
globvis = globalvisibility;
if (sec->visibility != 0) globvis = mulscale4(globvis,(int)((unsigned char)(sec->visibility+16)));
if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16)));
globalshiftval = (picsiz[globalpicnum]>>4);
if (pow2long[globalshiftval] != tilesizy[globalpicnum]) globalshiftval++;
globalshiftval = 32-globalshiftval;
3467,7 → 3467,7
globalxpanning = 0L;
globalypanning = 0L;
globvis = globalvisibility;
if (sec->visibility != 0) globvis = mulscale4(globvis,(int)((unsigned char)(sec->visibility+16)));
if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16)));
globalshiftval = (picsiz[globalpicnum]>>4);
if (pow2long[globalshiftval] != tilesizy[globalpicnum]) globalshiftval++;
globalshiftval = 32-globalshiftval;
3484,8 → 3484,8
if (((sec->floorstat&1) == 0) && (z2 > sec->floorz))
z2 = sec->floorz;
 
owallmost(uwall,(int)(MAXWALLSB-1),z1-globalposz);
owallmost(dwall,(int)(MAXWALLSB-1),z2-globalposz);
owallmost(uwall,(int32_t)(MAXWALLSB-1),z1-globalposz);
owallmost(dwall,(int32_t)(MAXWALLSB-1),z2-globalposz);
for (i=xb1[MAXWALLSB-1];i<=xb2[MAXWALLSB-1];i++)
{ swall[i] = (krecipasm(hplc)<<2); hplc += hinc; }
 
3781,8 → 3781,8
ysi[z] = scale(ryi[z],xdimen<<15,rzi[z]) + (globalhoriz<<16);
if (xsi[z] < 0) xsi[z] = 0;
if (xsi[z] > (xdimen<<16)) xsi[z] = (xdimen<<16);
if (ysi[z] < ((int)0<<16)) ysi[z] = ((int)0<<16);
if (ysi[z] > ((int)ydimen<<16)) ysi[z] = ((int)ydimen<<16);
if (ysi[z] < ((int32_t)0<<16)) ysi[z] = ((int32_t)0<<16);
if (ysi[z] > ((int32_t)ydimen<<16)) ysi[z] = ((int32_t)ydimen<<16);
if (xsi[z] < lmax) lmax = xsi[z], lpoint = z;
if (xsi[z] > rmax) rmax = xsi[z], rpoint = z;
}
3883,7 → 3883,7
globalbufplc = waloff[globalpicnum];
 
globvis = mulscale16(globalhisibility,viewingrange);
if (sec->visibility != 0) globvis = mulscale4(globvis,(int)((unsigned char)(sec->visibility+16)));
if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16)));
 
x = picsiz[globalpicnum]; y = ((x>>4)&15); x &= 15;
if (pow2long[x] != xspan)
3915,13 → 3915,13
#ifdef SUPERBUILD
else if ((cstat&48) == 48)
{
int nxrepeat, nyrepeat;
int32_t nxrepeat, nyrepeat;
 
lx = 0; rx = xdim-1;
for (x=lx;x<=rx;x++)
{
lwall[x] = (int)startumost[x+windowx1]-windowy1;
swall[x] = (int)startdmost[x+windowx1]-windowy1;
lwall[x] = (int32_t)startumost[x+windowx1]-windowy1;
swall[x] = (int32_t)startdmost[x+windowx1]-windowy1;
}
for (i=smostwallcnt-1;i>=0;i--)
{
3928,7 → 3928,7
j = smostwall[i];
if ((xb1[j] > rx) || (xb2[j] < lx)) continue;
if ((yp <= yb1[j]) && (yp <= yb2[j])) continue;
if (spritewallfront(tspr,(int)thewall[j]) && ((yp <= yb1[j]) || (yp <= yb2[j]))) continue;
if (spritewallfront(tspr,(int32_t)thewall[j]) && ((yp <= yb1[j]) || (yp <= yb2[j]))) continue;
 
dalx2 = max(xb1[j],lx); darx2 = min(xb2[j],rx);
 
3969,25 → 3969,25
break;
}
 
longptr = (int *)voxoff[vtilenum][0];
longptr = (int32_t *)voxoff[vtilenum][0];
 
if (voxscale[vtilenum] == 65536)
{
nxrepeat = (((int)tspr->xrepeat)<<16);
nyrepeat = (((int)tspr->yrepeat)<<16);
nxrepeat = (((int32_t)tspr->xrepeat)<<16);
nyrepeat = (((int32_t)tspr->yrepeat)<<16);
}
else
{
nxrepeat = ((int)tspr->xrepeat)*voxscale[vtilenum];
nyrepeat = ((int)tspr->yrepeat)*voxscale[vtilenum];
nxrepeat = ((int32_t)tspr->xrepeat)*voxscale[vtilenum];
nyrepeat = ((int32_t)tspr->yrepeat)*voxscale[vtilenum];
}
 
if (!(cstat&128)) tspr->z -= mulscale22(B_LITTLE32(longptr[5]),nyrepeat);
yoff = (int)((signed char)((picanm[sprite[tspr->owner].picnum]>>16)&255))+((int)tspr->yoffset);
yoff = (int32_t)((int8_t)((picanm[sprite[tspr->owner].picnum]>>16)&255))+((int32_t)tspr->yoffset);
tspr->z -= mulscale14(yoff,nyrepeat);
 
globvis = globalvisibility;
if (sec->visibility != 0) globvis = mulscale4(globvis,(int)((unsigned char)(sec->visibility+16)));
if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16)));
 
if ((searchit >= 1) && (yp > (4<<8)) && (searchy >= lwall[searchx]) && (searchy < swall[searchx]))
{
4037,11 → 4037,11
}
}
 
i = (int)tspr->ang+1536;
i = (int32_t)tspr->ang+1536;
#if defined(POLYMOST) && defined(USE_OPENGL)
i += spriteext[tspr->owner].angoff;
#endif
drawvox(tspr->x,tspr->y,tspr->z,i,(int)tspr->xrepeat,(int)tspr->yrepeat,vtilenum,tspr->shade,tspr->pal,lwall,swall);
drawvox(tspr->x,tspr->y,tspr->z,i,(int32_t)tspr->xrepeat,(int32_t)tspr->yrepeat,vtilenum,tspr->shade,tspr->pal,lwall,swall);
}
#endif
if (automapping == 1) show2dsprite[spritenum>>3] |= pow2char[spritenum&7];
4051,9 → 4051,9
//
// drawmaskwall (internal)
//
static void drawmaskwall(short damaskwallcnt)
static void drawmaskwall(int16_t damaskwallcnt)
{
int i, j, k, x, z, sectnum, z1, z2, lx, rx;
int32_t i, j, k, x, z, sectnum, z1, z2, lx, rx;
sectortype *sec, *nsec;
walltype *wal;
 
4084,24 → 4084,24
z1 = max(nsec->ceilingz,sec->ceilingz);
z2 = min(nsec->floorz,sec->floorz);
 
wallmost(uwall,z,sectnum,(char)0);
wallmost(uplc,z,(int)wal->nextsector,(char)0);
wallmost(uwall,z,sectnum,(uint8_t)0);
wallmost(uplc,z,(int32_t)wal->nextsector,(uint8_t)0);
for (x=xb1[z];x<=xb2[z];x++) if (uplc[x] > uwall[x]) uwall[x] = uplc[x];
wallmost(dwall,z,sectnum,(char)1);
wallmost(dplc,z,(int)wal->nextsector,(char)1);
wallmost(dwall,z,sectnum,(uint8_t)1);
wallmost(dplc,z,(int32_t)wal->nextsector,(uint8_t)1);
for (x=xb1[z];x<=xb2[z];x++) if (dplc[x] < dwall[x]) dwall[x] = dplc[x];
prepwall(z,wal);
 
globalorientation = (int)wal->cstat;
globalorientation = (int32_t)wal->cstat;
globalpicnum = wal->overpicnum;
if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
globalxpanning = (int)wal->xpanning;
globalypanning = (int)wal->ypanning;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(short)thewall[z]+16384);
globalshade = (int)wal->shade;
globalxpanning = (int32_t)wal->xpanning;
globalypanning = (int32_t)wal->ypanning;
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(int16_t)thewall[z]+16384);
globalshade = (int32_t)wal->shade;
globvis = globalvisibility;
if (sec->visibility != 0) globvis = mulscale4(globvis,(int)((unsigned char)(sec->visibility+16)));
globalpal = (int)wal->pal;
if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16)));
globalpal = (int32_t)wal->pal;
globalshiftval = (picsiz[globalpicnum]>>4);
if (pow2long[globalshiftval] != tilesizy[globalpicnum]) globalshiftval++;
globalshiftval = 32-globalshiftval;
4168,11 → 4168,11
//
// fillpolygon (internal)
//
static void fillpolygon(int npoints)
static void fillpolygon(int32_t npoints)
{
int z, zz, x1, y1, x2, y2, miny, maxy, y, xinc, cnt;
int ox, oy, bx, by, day1, day2;
short *ptr, *ptr2;
int32_t z, zz, x1, y1, x2, y2, miny, maxy, y, xinc, cnt;
int32_t ox, oy, bx, by, day1, day2;
int16_t *ptr, *ptr2;
intptr_t p;
 
#if defined POLYMOST && defined USE_OPENGL
4276,10 → 4276,10
//
// clippoly (internal)
//
static int clippoly(int npoints, int clipstat)
static int32_t clippoly(int32_t npoints, int32_t clipstat)
{
int z, zz, s1, s2, t, npoints2, start2, z1, z2, z3, z4, splitcnt;
int cx1, cy1, cx2, cy2;
int32_t z, zz, s1, s2, t, npoints2, start2, z1, z2, z3, z4, splitcnt;
int32_t cx1, cy1, cx2, cy2;
 
cx1 = windowx1;
cy1 = windowy1;
4494,9 → 4494,9
//
//Assume npoints=4 with polygon on &nrx1,&nry1
//JBF 20031206: Thanks to Ken's hunting, s/(rx1|ry1|rx2|ry2)/n\1/ in this function
static int clippoly4(int cx1, int cy1, int cx2, int cy2)
static int32_t clippoly4(int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2)
{
int n, nn, z, zz, x, x1, x2, y, y1, y2, t;
int32_t n, nn, z, zz, x, x1, x2, y, y1, y2, t;
 
nn = 0; z = 0;
do
4552,17 → 4552,17
// dorotatesprite (internal)
//
//JBF 20031206: Thanks to Ken's hunting, s/(rx1|ry1|rx2|ry2)/n\1/ in this function
static void dorotatesprite(int sx, int sy, int z, short a, short picnum, signed char dashade, char dapalnum, char dastat, int cx1, int cy1, int cx2, int cy2, int uniqid)
static void dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, int8_t dashade, char dapalnum, char dastat, int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2, int32_t uniqid)
{
int cosang, sinang, v, nextv, dax1, dax2, oy, bx, by;
int i, x, y, x1, y1, x2, y2, gx1, gy1 ;
int32_t cosang, sinang, v, nextv, dax1, dax2, oy, bx, by;
int32_t i, x, y, x1, y1, x2, y2, gx1, gy1 ;
intptr_t p, bufplc, palookupoffs;
int xsiz, ysiz, xoff, yoff, npoints, yplc, yinc, lx, rx;
int xv, yv, xv2, yv2;
int32_t xsiz, ysiz, xoff, yoff, npoints, yplc, yinc, lx, rx;
int32_t xv, yv, xv2, yv2;
#ifndef ENGINE_USING_A_C
char bad;
int ny1, ny2, xx, xend;
int qlinemode=0, y1ve[4], y2ve[4], u4, d4;
int32_t ny1, ny2, xx, xend;
int32_t qlinemode=0, y1ve[4], y2ve[4], u4, d4;
#endif
 
UNREFERENCED_PARAMETER(uniqid);
4584,8 → 4584,8
if (dastat&16) { xoff = 0; yoff = 0; }
else
{
xoff = (int)((signed char)((picanm[picnum]>>8)&255))+(xsiz>>1);
yoff = (int)((signed char)((picanm[picnum]>>16)&255))+(ysiz>>1);
xoff = (int32_t)((int8_t)((picanm[picnum]>>8)&255))+(xsiz>>1);
yoff = (int32_t)((int8_t)((picanm[picnum]>>16)&255))+(ysiz>>1);
}
 
if (dastat&4) yoff = ysiz-yoff;
4673,7 → 4673,7
bufplc = waloff[picnum];
 
if (palookup[dapalnum] == NULL) dapalnum = 0;
palookupoffs = FP_OFF(palookup[dapalnum]) + (getpalookup(0L,(int)dashade)<<8);
palookupoffs = FP_OFF(palookup[dapalnum]) + (getpalookup(0L,(int32_t)dashade)<<8);
 
i = divscale32(1L,z);
xv = mulscale14(sinang,i);
5045,13 → 5045,13
//
static void initksqrt(void)
{
int i, j, k;
int32_t i, j, k;
 
j = 1; k = 0;
for (i=0;i<4096;i++)
{
if (i >= j) { j <<= 2; k++; }
sqrtable[i] = (unsigned short)(msqrtasm((i<<18)+131072)<<1);
sqrtable[i] = (uint16_t)(msqrtasm((i<<18)+131072)<<1);
shlookup[i] = (k<<1)+((10-k)<<8);
if (i < 256) shlookup[i+4096] = ((k+6)<<1)+((10-(k+6))<<8);
}
5063,7 → 5063,7
//
static void dosetaspect(void)
{
int i, j, k, x, xinc;
int32_t i, j, k, x, xinc;
 
if (xyaspect != oxyaspect)
{
5086,8 → 5086,8
for (i=0;i<xdimen;i++)
{
j = (x&65535); k = (x>>16); x += xinc;
if (j != 0) j = mulscale16((int)radarang[k+1]-(int)radarang[k],j);
radarang2[i] = (short)(((int)radarang[k]+j)>>6);
if (j != 0) j = mulscale16((int32_t)radarang[k+1]-(int32_t)radarang[k],j);
radarang2[i] = (int16_t)(((int32_t)radarang[k]+j)>>6);
}
#ifdef SUPERBUILD
for (i=1;i<65536;i++) distrecip[i] = divscale20(xdimen,i);
5103,7 → 5103,7
//
static void calcbritable(void)
{
int i,j;
int32_t i,j;
double a,b;
for (i=0;i<16;i++)
{
5110,13 → 5110,13
a = (double)8 / ((double)i+8);
b = (double)255 / pow((double)255,a);
for (j=0;j<256;j++) // JBF 20040207: full 8bit precision
britable[i][j] = (char)(pow((double)j,a)*b);
britable[i][j] = (uint8_t)(pow((double)j,a)*b);
}
}
 
static int loadtables(void)
static int32_t loadtables(void)
{
int i, fil;
int32_t i, fil;
 
if (tablesloaded == 0)
{
5152,9 → 5152,9
//
// initfastcolorlookup (internal)
//
static void initfastcolorlookup(int rscale, int gscale, int bscale)
static void initfastcolorlookup(int32_t rscale, int32_t gscale, int32_t bscale)
{
int i, j, x, y, z;
int32_t i, j, x, y, z;
char *pal1;
 
j = 0;
5195,7 → 5195,7
//
static void loadpalette(void)
{
int fil;
int32_t fil;
 
if (paletteloaded != 0) return;
if ((fil = kopen4load("palette.dat",0)) == -1) return;
5226,9 → 5226,9
//
// getclosestcol (internal)
//
int getclosestcol(int r, int g, int b)
int32_t getclosestcol(int32_t r, int32_t g, int32_t b)
{
int i, j, k, dist, mindist, retcol;
int32_t i, j, k, dist, mindist, retcol;
char *pal1;
 
j = (r>>3)*FASTPALGRIDSIZ*FASTPALGRIDSIZ+(g>>3)*FASTPALGRIDSIZ+(b>>3)+FASTPALGRIDSIZ*FASTPALGRIDSIZ+FASTPALGRIDSIZ+1;
5278,9 → 5278,9
//
// insertspritesect (internal)
//
static int insertspritesect(short sectnum)
static int32_t insertspritesect(int16_t sectnum)
{
short blanktouse;
int16_t blanktouse;
 
if ((sectnum >= MAXSECTORS) || (headspritesect[MAXSECTORS] == -1))
return(-1); //list full
5306,9 → 5306,9
//
// insertspritestat (internal)
//
static int insertspritestat(short statnum)
static int32_t insertspritestat(int16_t statnum)
{
short blanktouse;
int16_t blanktouse;
 
if ((statnum >= MAXSTATUS) || (headspritestat[MAXSTATUS] == -1))
return(-1); //list full
5334,7 → 5334,7
//
// deletespritesect (internal)
//
static int deletespritesect(short deleteme)
static int32_t deletespritesect(int16_t deleteme)
{
if (sprite[deleteme].sectnum == MAXSECTORS)
return(-1);
5358,7 → 5358,7
//
// deletespritestat (internal)
//
static int deletespritestat(short deleteme)
static int32_t deletespritestat(int16_t deleteme)
{
if (sprite[deleteme].statnum == MAXSTATUS)
return(-1);
5382,11 → 5382,11
//
// lintersect (internal)
//
static int lintersect(int x1, int y1, int z1, int x2, int y2, int z2, int x3,
int y3, int x4, int y4, int *intx, int *inty, int *intz)
static int32_t lintersect(int32_t x1, int32_t y1, int32_t z1, int32_t x2, int32_t y2, int32_t z2, int32_t x3,
int32_t y3, int32_t x4, int32_t y4, int32_t *intx, int32_t *inty, int32_t *intz)
{
//p1 to p2 is a line segment
int x21, y21, x34, y34, x31, y31, bot, topt, topu, t;
int32_t x21, y21, x34, y34, x31, y31, bot, topt, topu, t;
 
x21 = x2-x1; x34 = x3-x4;
y21 = y2-y1; y34 = y3-y4;
5415,11 → 5415,11
//
// rintersect (internal)
//
static int rintersect(int x1, int y1, int z1, int vx, int vy, int vz, int x3,
int y3, int x4, int y4, int *intx, int *inty, int *intz)
static int32_t rintersect(int32_t x1, int32_t y1, int32_t z1, int32_t vx, int32_t vy, int32_t vz, int32_t x3,
int32_t y3, int32_t x4, int32_t y4, int32_t *intx, int32_t *inty, int32_t *intz)
{
//p1 towards p2 is a ray
int x34, y34, x31, y31, bot, topt, topu, t;
int32_t x34, y34, x31, y31, bot, topt, topu, t;
 
x34 = x3-x4; y34 = y3-y4;
bot = vx*y34 - vy*x34;
5447,9 → 5447,9
//
// keepaway (internal)
//
static void keepaway(int *x, int *y, int w)
static void keepaway(int32_t *x, int32_t *y, int32_t w)
{
int dx, dy, ox, oy, x1, y1;
int32_t dx, dy, ox, oy, x1, y1;
char first;
 
x1 = clipit[w].x1; dx = clipit[w].x2-x1;
5468,10 → 5468,10
//
// raytrace (internal)
//
static int raytrace(int x3, int y3, int *x4, int *y4)
static int32_t raytrace(int32_t x3, int32_t y3, int32_t *x4, int32_t *y4)
{
int x1, y1, x2, y2, bot, topu, nintx, ninty, cnt, z, hitwall;
int x21, y21, x43, y43;
int32_t x1, y1, x2, y2, bot, topu, nintx, ninty, cnt, z, hitwall;
int32_t x21, y21, x43, y43;
 
hitwall = -1;
for (z=clipnum-1;z>=0;z--)
5510,7 → 5510,7
 
#if !defined _WIN32 && defined DEBUGGINGAIDS
#include <signal.h>
static void sighandler(int sig, const siginfo_t *info, void *ctx)
static void sighandler(int32_t sig, const siginfo_t *info, void *ctx)
{
const char *s;
UNREFERENCED_PARAMETER(ctx);
5550,7 → 5550,7
//
// preinitengine
//
static int preinitcalled = 0;
static int32_t preinitcalled = 0;
 
#define DYNALLOC_ARRAYS
 
5563,7 → 5563,7
static spritetype tsprite_s[MAXSPRITESONSCREEN];
#endif
 
int preinitengine(void)
int32_t preinitengine(void)
{
char *e;
if (initsystem()) exit(1);
5612,9 → 5612,9
//
// initengine
//
int initengine(void)
int32_t initengine(void)
{
int i, j;
int32_t i, j;
 
#if !defined _WIN32 && defined DEBUGGINGAIDS
struct sigaction sigact, oldact;
5662,11 → 5662,11
 
for (i=0;i<MAXPALOOKUPS;i++) palookup[i] = NULL;
 
clearbuf(&waloff[0],(int)MAXTILES,0L);
clearbuf(&waloff[0],(int32_t)MAXTILES,0L);
 
clearbuf(&show2dsector[0],(int)((MAXSECTORS+3)>>5),0L);
clearbuf(&show2dsprite[0],(int)((MAXSPRITES+3)>>5),0L);
clearbuf(&show2dwall[0],(int)((MAXWALLS+3)>>5),0L);
clearbuf(&show2dsector[0],(int32_t)((MAXSECTORS+3)>>5),0L);
clearbuf(&show2dsprite[0],(int32_t)((MAXSPRITES+3)>>5),0L);
clearbuf(&show2dwall[0],(int32_t)((MAXWALLS+3)>>5),0L);
automapping = 0;
 
pointhighlight = -1;
5694,7 → 5694,7
//
void uninitengine(void)
{
int i;
int32_t i;
 
//OSD_Printf("cacheresets = %d, cacheinvalidates = %d\n", cacheresets, cacheinvalidates);
 
5744,7 → 5744,7
//
void initspritelists(void)
{
int i;
int32_t i;
 
for (i=0;i<MAXSECTORS;i++) //Init doubly-linked sprite sector lists
headspritesect[i] = -1;
5776,11 → 5776,11
//
// drawrooms
//
void drawrooms(int daposx, int daposy, int daposz,
short daang, int dahoriz, short dacursectnum)
void drawrooms(int32_t daposx, int32_t daposy, int32_t daposz,
int16_t daang, int32_t dahoriz, int16_t dacursectnum)
{
int i, j, z, cz, fz, closest;
short *shortptr1, *shortptr2;
int32_t i, j, z, cz, fz, closest;
int16_t *shortptr1, *shortptr2;
 
beforedrawrooms = 0;
indrawroomsandmasks = 1;
5810,11 → 5810,11
if ((xyaspect != oxyaspect) || (xdimen != oxdimen) || (viewingrange != oviewingrange))
dosetaspect();
 
//clearbufbyte(&gotsector[0],(int)((numsectors+7)>>3),0L);
Bmemset(&gotsector[0],0,(int)((numsectors+7)>>3));
//clearbufbyte(&gotsector[0],(int32_t)((numsectors+7)>>3),0L);
Bmemset(&gotsector[0],0,(int32_t)((numsectors+7)>>3));
 
shortptr1 = (short *)&startumost[windowx1];
shortptr2 = (short *)&startdmost[windowx1];
shortptr1 = (int16_t *)&startumost[windowx1];
shortptr2 = (int16_t *)&startdmost[windowx1];
i = xdimen-1;
do
{
5903,7 → 5903,7
 
while ((numbunches > 0) && (numhits > 0))
{
clearbuf(&tempbuf[0],(int)((numbunches+3)>>2),0L);
clearbuf(&tempbuf[0],(int32_t)((numbunches+3)>>2),0L);
tempbuf[0] = 1;
 
closest = 0; //Almost works, but not quite :(
5940,11 → 5940,11
// UTILITY TYPES AND FUNCTIONS FOR DRAWMASKS OCCLUSION TREE
typedef struct s_maskleaf
{
int index;
int32_t index;
_point2d p1, p2;
_equation maskeq, p1eq, p2eq;
struct s_maskleaf* branch[MAXWALLSB];
int drawing;
int32_t drawing;
} _maskleaf;
 
_maskleaf maskleaves[MAXWALLSB];
5970,10 → 5970,10
return (ret);
}
 
int wallvisible(short wallnum)
int32_t wallvisible(int16_t wallnum)
{
// 1 if wall is in front of player 0 otherwise
int a1, a2;
int32_t a1, a2;
walltype *w1, *w2;
 
w1 = &wall[wallnum];
6005,7 → 6005,7
}
 
// check if a point that's on the line is within the segment boundaries
int pointonmask(_point2d point, _maskleaf* wall)
int32_t pointonmask(_point2d point, _maskleaf* wall)
{
if ((min(wall->p1.x, wall->p2.x) <= point.x) && (point.x <= max(wall->p1.x, wall->p2.x)) && (min(wall->p1.y, wall->p2.y) <= point.y) && (point.y <= max(wall->p1.y, wall->p2.y)))
return (1);
6013,7 → 6013,7
}
 
// returns 1 if wall2 is hidden by wall1
int wallobstructswall(_maskleaf* wall1, _maskleaf* wall2)
int32_t wallobstructswall(_maskleaf* wall1, _maskleaf* wall2)
{
_point2d cross;
 
6039,7 → 6039,7
// recursive mask drawing function
void drawmaskleaf(_maskleaf* wall)
{
int i;
int32_t i;
 
wall->drawing = 1;
i = 0;
6057,7 → 6057,7
drawmaskwall(wall->index);
}
 
int sameside(_equation* eq, _point2d* p1, _point2d* p2)
int32_t sameside(_equation* eq, _point2d* p1, _point2d* p2)
{
float sign1, sign2;
 
6075,7 → 6075,7
}
 
#ifdef USE_OPENGL
void drawpeel(int peel)
void drawpeel(int32_t peel)
{
bglBindTexture(GL_TEXTURE_RECTANGLE, peels[peel]);
bglBegin(GL_QUADS);
6096,7 → 6096,7
//
void drawmasks(void)
{
int i, j, k, l, gap, xs, ys, xp, yp, yoff, yspan;
int32_t i, j, k, l, gap, xs, ys, xp, yp, yoff, yspan;
// PLAG: sorting stuff
_equation maskeq, p1eq, p2eq;
_point2d dot, dot2, middle, pos, spr;
6166,7 → 6166,7
spritesz[k] = tspriteptr[k]->z;
if ((tspriteptr[k]->cstat&48) != 32)
{
yoff = (int)((signed char)((picanm[tspriteptr[k]->picnum]>>16)&255))+((int)tspriteptr[k]->yoffset);
yoff = (int32_t)((int8_t)((picanm[tspriteptr[k]->picnum]>>16)&255))+((int32_t)tspriteptr[k]->yoffset);
spritesz[k] -= ((yoff*tspriteptr[k]->yrepeat)<<2);
yspan = (tilesizy[tspriteptr[k]->picnum]*tspriteptr[k]->yrepeat<<2);
if (!(tspriteptr[k]->cstat&128)) spritesz[k] -= (yspan>>1);
6411,20 → 6411,20
//
// drawmapview
//
void drawmapview(int dax, int day, int zoome, short ang)
void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
{
walltype *wal;
sectortype *sec;
spritetype *spr;
int tilenum, xoff, yoff, i, j, k, l, cosang, sinang, xspan, yspan;
int xrepeat, yrepeat, x, y, x1, y1, x2, y2, x3, y3, x4, y4, bakx1, baky1;
int s, w, ox, oy, startwall, cx1, cy1, cx2, cy2;
int bakgxvect, bakgyvect, sortnum, gap, npoints;
int xvect, yvect, xvect2, yvect2, daslope;
int32_t tilenum, xoff, yoff, i, j, k, l, cosang, sinang, xspan, yspan;
int32_t xrepeat, yrepeat, x, y, x1, y1, x2, y2, x3, y3, x4, y4, bakx1, baky1;
int32_t s, w, ox, oy, startwall, cx1, cy1, cx2, cy2;
int32_t bakgxvect, bakgyvect, sortnum, gap, npoints;
int32_t xvect, yvect, xvect2, yvect2, daslope;
 
beforedrawrooms = 0;
 
clearbuf(&gotsector[0],(int)((numsectors+31)>>5),0L);
clearbuf(&gotsector[0],(int32_t)((numsectors+31)>>5),0L);
 
cx1 = (windowx1<<12); cy1 = (windowy1<<12);
cx2 = ((windowx2+1)<<12)-1; cy2 = ((windowy2+1)<<12)-1;
6495,7 → 6495,7
 
gotsector[s>>3] |= pow2char[s&7];
 
globalorientation = (int)sec->floorstat;
globalorientation = (int32_t)sec->floorstat;
if ((globalorientation&1) != 0) continue;
 
globalpal = sec->floorpal;
6510,12 → 6510,12
if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
setgotpic(globalpicnum);
if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) continue;
if ((picanm[globalpicnum]&192) != 0) globalpicnum += animateoffs((short)globalpicnum,s);
if ((picanm[globalpicnum]&192) != 0) globalpicnum += animateoffs((int16_t)globalpicnum,s);
if (waloff[globalpicnum] == 0) loadtile(globalpicnum);
globalbufplc = waloff[globalpicnum];
globalshade = max(min(sec->floorshade,numpalookups-1),0);
globvis = globalhisibility;
if (sec->visibility != 0) globvis = mulscale4(globvis,(int)((unsigned char)(sec->visibility+16)));
if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16)));
globalpolytype = 0;
if ((globalorientation&64) == 0)
{
6560,8 → 6560,8
asm2 = (globalx2<<globalyshift);
globalx1 <<= globalxshift;
globaly2 <<= globalyshift;
globalposx = (globalposx<<(20+globalxshift))+(((int)sec->floorxpanning)<<24);
globalposy = (globalposy<<(20+globalyshift))-(((int)sec->floorypanning)<<24);
globalposx = (globalposx<<(20+globalxshift))+(((int32_t)sec->floorxpanning)<<24);
globalposy = (globalposy<<(20+globalyshift))-(((int32_t)sec->floorypanning)<<24);
 
fillpolygon(npoints);
}
6584,8 → 6584,8
npoints = 0;
 
tilenum = spr->picnum;
xoff = (int)((signed char)((picanm[tilenum]>>8)&255))+((int)spr->xoffset);
yoff = (int)((signed char)((picanm[tilenum]>>16)&255))+((int)spr->yoffset);
xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
yoff = (int32_t)((int8_t)((picanm[tilenum]>>16)&255))+((int32_t)spr->yoffset);
if ((spr->cstat&4) > 0) xoff = -xoff;
if ((spr->cstat&8) > 0) yoff = -yoff;
 
6644,17 → 6644,17
if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
setgotpic(globalpicnum);
if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) continue;
if ((picanm[globalpicnum]&192) != 0) globalpicnum += animateoffs((short)globalpicnum,s);
if ((picanm[globalpicnum]&192) != 0) globalpicnum += animateoffs((int16_t)globalpicnum,s);
if (waloff[globalpicnum] == 0) loadtile(globalpicnum);
globalbufplc = waloff[globalpicnum];
if ((sector[spr->sectnum].ceilingstat&1) > 0)
globalshade = ((int)sector[spr->sectnum].ceilingshade);
globalshade = ((int32_t)sector[spr->sectnum].ceilingshade);
else
globalshade = ((int)sector[spr->sectnum].floorshade);
globalshade = ((int32_t)sector[spr->sectnum].floorshade);
globalshade = max(min(globalshade+spr->shade+6,numpalookups-1),0);
asm3 = FP_OFF(palookup[spr->pal]+(globalshade<<8));
globvis = globalhisibility;
if (sec->visibility != 0) globvis = mulscale4(globvis,(int)((unsigned char)(sec->visibility+16)));
if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16)));
globalpolytype = ((spr->cstat&2)>>1)+1;
 
//relative alignment stuff
6703,10 → 6703,10
//
// loadboard
//
int loadboard(char *filename, char fromwhere, int *daposx, int *daposy, int *daposz,
short *daang, short *dacursectnum)
int32_t loadboard(char *filename, char fromwhere, int32_t *daposx, int32_t *daposy, int32_t *daposz,
int16_t *daang, int16_t *dacursectnum)
{
short fil, i, numsprites;
int16_t fil, i, numsprites;
 
i = strlen(filename)-1;
if (filename[i] == 255) { filename[i] = 0; fromwhere = 1; } // JBF 20040119: "compatibility"
6729,9 → 6729,9
#define MYMAXWALLS (mapversion==7l?MAXWALLSV7:MAXWALLSV8)
#define MYMAXSPRITES (mapversion==7l?MAXSPRITESV7:MAXSPRITESV8)
 
clearbuf(&show2dsector[0],(int)((MYMAXSECTORS+3)>>5),0L);
clearbuf(&show2dsprite[0],(int)((MYMAXSPRITES+3)>>5),0L);
clearbuf(&show2dwall[0],(int)((MYMAXWALLS+3)>>5),0L);
clearbuf(&show2dsector[0],(int32_t)((MYMAXSECTORS+3)>>5),0L);
clearbuf(&show2dsprite[0],(int32_t)((MYMAXSPRITES+3)>>5),0L);
clearbuf(&show2dwall[0],(int32_t)((MYMAXWALLS+3)>>5),0L);
 
kread(fil,daposx,4); *daposx = B_LITTLE32(*daposx);
kread(fil,daposy,4); *daposy = B_LITTLE32(*daposy);
6855,79 → 6855,79
#endif
struct BPACK sectortypev5
{
short unsigned int wallptr, wallnum;
short ceilingpicnum, floorpicnum;
short ceilingheinum, floorheinum;
int ceilingz, floorz;
signed char ceilingshade, floorshade;
uint16_t wallptr, wallnum;
int16_t ceilingpicnum, floorpicnum;
int16_t ceilingheinum, floorheinum;
int32_t ceilingz, floorz;
int8_t ceilingshade, floorshade;
char ceilingxpanning, floorxpanning;
char ceilingypanning, floorypanning;
char ceilingstat, floorstat;
char ceilingpal, floorpal;
char visibility;
short lotag, hitag;
short extra;
int16_t lotag, hitag;
int16_t extra;
};
struct BPACK walltypev5
{
int x, y;
short point2;
short picnum, overpicnum;
signed char shade;
short cstat;
unsigned char xrepeat, yrepeat, xpanning, ypanning;
short nextsector1, nextwall1;
short nextsector2, nextwall2;
short lotag, hitag;
short extra;
int32_t x, y;
int16_t point2;
int16_t picnum, overpicnum;
int8_t shade;
int16_t cstat;
char xrepeat, yrepeat, xpanning, ypanning;
int16_t nextsector1, nextwall1;
int16_t nextsector2, nextwall2;
int16_t lotag, hitag;
int16_t extra;
};
struct BPACK spritetypev5
{
int x, y, z;
int32_t x, y, z;
char cstat;
signed char shade;
unsigned char xrepeat, yrepeat;
short picnum, ang, xvel, yvel, zvel, owner;
short sectnum, statnum;
short lotag, hitag;
short extra;
int8_t shade;
char xrepeat, yrepeat;
int16_t picnum, ang, xvel, yvel, zvel, owner;
int16_t sectnum, statnum;
int16_t lotag, hitag;
int16_t extra;
};
struct BPACK sectortypev6
{
unsigned short wallptr, wallnum;
short ceilingpicnum, floorpicnum;
short ceilingheinum, floorheinum;
int ceilingz, floorz;
signed char ceilingshade, floorshade;
uint16_t wallptr, wallnum;
int16_t ceilingpicnum, floorpicnum;
int16_t ceilingheinum, floorheinum;
int32_t ceilingz, floorz;
int8_t ceilingshade, floorshade;
char ceilingxpanning, floorxpanning;
char ceilingypanning, floorypanning;
char ceilingstat, floorstat;
char ceilingpal, floorpal;
char visibility;
short lotag, hitag, extra;
int16_t lotag, hitag, extra;
};
struct BPACK walltypev6
{
int x, y;
short point2, nextsector, nextwall;
short picnum, overpicnum;
signed char shade;
int32_t x, y;
int16_t point2, nextsector, nextwall;
int16_t picnum, overpicnum;
int8_t shade;
char pal;
short cstat;
unsigned char xrepeat, yrepeat, xpanning, ypanning;
short lotag, hitag, extra;
int16_t cstat;
char xrepeat, yrepeat, xpanning, ypanning;
int16_t lotag, hitag, extra;
};
struct BPACK spritetypev6
{
int x, y, z;
short cstat;
signed char shade;
int32_t x, y, z;
int16_t cstat;
int8_t shade;
char pal, clipdist;
unsigned char xrepeat, yrepeat;
signed char xoffset, yoffset;
short picnum, ang, xvel, yvel, zvel, owner;
short sectnum, statnum;
short lotag, hitag, extra;
char xrepeat, yrepeat;
int8_t xoffset, yoffset;
int16_t picnum, ang, xvel, yvel, zvel, owner;
int16_t sectnum, statnum;
int16_t lotag, hitag, extra;
};
#ifdef _MSC_VER
#pragma pack()
6939,9 → 6939,9
 
#undef BPACK
 
static short sectorofwallv5(short theline)
static int16_t sectorofwallv5(int16_t theline)
{
short i, startwall, endwall, sucksect;
int16_t i, startwall, endwall, sucksect;
 
sucksect = -1;
for (i=0;i<numsectors;i++)
6983,7 → 6983,7
to->extra = from->extra;
}
 
static void convertv5wallv6(struct walltypev5 *from, struct walltypev6 *to, int i)
static void convertv5wallv6(struct walltypev5 *from, struct walltypev6 *to, int32_t i)
{
to->x = from->x;
to->y = from->y;
6993,7 → 6993,7
to->picnum = from->picnum;
to->overpicnum = from->overpicnum;
to->shade = from->shade;
to->pal = sector[sectorofwallv5((short)i)].floorpal;
to->pal = sector[sectorofwallv5((int16_t)i)].floorpal;
to->cstat = from->cstat;
to->xrepeat = from->xrepeat;
to->yrepeat = from->yrepeat;
7006,7 → 7006,7
 
static void convertv5sprv6(struct spritetypev5 *from, struct spritetypev6 *to)
{
short j;
int16_t j;
to->x = from->x;
to->y = from->y;
to->z = from->z;
7044,7 → 7044,7
to->wallptr = from->wallptr;
to->wallnum = from->wallnum;
to->ceilingpicnum = from->ceilingpicnum;
to->ceilingheinum = max(min(((int)from->ceilingheinum)<<5,32767),-32768);
to->ceilingheinum = max(min(((int32_t)from->ceilingheinum)<<5,32767),-32768);
if ((from->ceilingstat&2) == 0) to->ceilingheinum = 0;
to->ceilingshade = from->ceilingshade;
to->ceilingpal = from->ceilingpal;
7051,7 → 7051,7
to->ceilingxpanning = from->ceilingxpanning;
to->ceilingypanning = from->ceilingypanning;
to->floorpicnum = from->floorpicnum;
to->floorheinum = max(min(((int)from->floorheinum)<<5,32767),-32768);
to->floorheinum = max(min(((int32_t)from->floorheinum)<<5,32767),-32768);
if ((from->floorstat&2) == 0) to->floorheinum = 0;
to->floorshade = from->floorshade;
to->floorpal = from->floorpal;
7116,10 → 7116,10
 
// Powerslave uses v6
// Witchaven 1 and TekWar use v5
int loadoldboard(char *filename, char fromwhere, int *daposx, int *daposy, int *daposz,
short *daang, short *dacursectnum)
int32_t loadoldboard(char *filename, char fromwhere, int32_t *daposx, int32_t *daposy, int32_t *daposz,
int16_t *daang, int16_t *dacursectnum)
{
short fil, i, numsprites;
int16_t fil, i, numsprites;
struct sectortypev5 v5sect;
struct walltypev5 v5wall;
struct spritetypev5 v5spr;
7137,9 → 7137,9
 
initspritelists();
 
clearbuf(&show2dsector[0],(int)((MAXSECTORS+3)>>5),0L);
clearbuf(&show2dsprite[0],(int)((MAXSPRITES+3)>>5),0L);
clearbuf(&show2dwall[0],(int)((MAXWALLS+3)>>5),0L);
clearbuf(&show2dsector[0],(int32_t)((MAXSECTORS+3)>>5),0L);
clearbuf(&show2dsprite[0],(int32_t)((MAXSPRITES+3)>>5),0L);
clearbuf(&show2dwall[0],(int32_t)((MAXWALLS+3)>>5),0L);
 
kread(fil,daposx,4); *daposx = B_LITTLE32(*daposx);
kread(fil,daposy,4); *daposy = B_LITTLE32(*daposy);
7313,7 → 7313,7
// loadmaphack
//
#if defined(POLYMOST) && defined(USE_OPENGL)
int loadmaphack(char *filename)
int32_t loadmaphack(char *filename)
{
enum
{
7332,7 → 7332,7
T_AWAY2,
};
 
static struct { char *text; int tokenid; } legaltokens[] =
static struct { char *text; int32_t tokenid; } legaltokens[] =
{
{ "sprite", T_SPRITE },
{ "angleoff", T_ANGOFF },
7355,8 → 7355,8
 
scriptfile *script;
char *tok, *cmdtokptr;
int i;
int whichsprite = -1;
int32_t i;
int32_t whichsprite = -1;
 
script = scriptfile_fromfile(filename);
if (!script) return -1;
7387,7 → 7387,7
break;
case T_ANGOFF: // angoff <xx>
{
int ang;
int32_t ang;
if (scriptfile_getnumber(script, &ang)) break;
 
if (whichsprite < 0)
7397,7 → 7397,7
script->filename, scriptfile_getlinum(script,cmdtokptr));
break;
}
spriteext[whichsprite].angoff = (short)ang;
spriteext[whichsprite].angoff = (int16_t)ang;
}
break;
case T_NOMODEL: // notmd
7422,7 → 7422,7
break;
case T_PITCH: // pitch <xx>
{
int pitch;
int32_t pitch;
if (scriptfile_getnumber(script, &pitch)) break;
 
if (whichsprite < 0)
7432,12 → 7432,12
script->filename, scriptfile_getlinum(script,cmdtokptr));
break;
}
spriteext[whichsprite].pitch = (short)pitch;
spriteext[whichsprite].pitch = (int16_t)pitch;
}
break;
case T_ROLL: // roll <xx>
{
int roll;
int32_t roll;
if (scriptfile_getnumber(script, &roll)) break;
 
if (whichsprite < 0)
7447,12 → 7447,12
script->filename, scriptfile_getlinum(script,cmdtokptr));
break;
}
spriteext[whichsprite].roll = (short)roll;
spriteext[whichsprite].roll = (int16_t)roll;
}
break;
case T_MDXOFF: // mdxoff <xx>
{
int i;
int32_t i;
if (scriptfile_getnumber(script, &i)) break;
 
if (whichsprite < 0)
7467,7 → 7467,7
break;
case T_MDYOFF: // mdyoff <xx>
{
int i;
int32_t i;
if (scriptfile_getnumber(script, &i)) break;
 
if (whichsprite < 0)
7482,7 → 7482,7
break;
case T_MDZOFF: // mdzoff <xx>
{
int i;
int32_t i;
if (scriptfile_getnumber(script, &i)) break;
 
if (whichsprite < 0)
7526,7 → 7526,7
return 0;
}
#else
int loadmaphack(char *filename) { UNREFERENCED_PARAMETER(filename); return -1; }
int32_t loadmaphack(char *filename) { UNREFERENCED_PARAMETER(filename); return -1; }
#endif
 
 
7533,11 → 7533,11
//
// saveboard
//
int saveboard(char *filename, int *daposx, int *daposy, int *daposz,
short *daang, short *dacursectnum)
int32_t saveboard(char *filename, int32_t *daposx, int32_t *daposy, int32_t *daposz,
int16_t *daang, int16_t *dacursectnum)
{
short fil, i, j, numsprites, ts;
int tl;
int16_t fil, i, j, numsprites, ts;
int32_t tl;
sectortype *tsect = NULL;
walltype *twall = NULL;
spritetype *tspri = NULL;
7707,9 → 7707,9
//
// JBF: davidoption now functions as a windowed-mode flag (0 == windowed, 1 == fullscreen)
extern char videomodereset;
int setgamemode(char davidoption, int daxdim, int daydim, int dabpp)
int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t dabpp)
{
int i, j;
int32_t i, j;
 
#if defined(USE_OPENGL) && defined(POLYMOST)
extern char nogl;
7791,7 → 7791,7
//
void nextpage(void)
{
int i;
int32_t i;
permfifotype *per;
 
//char snotbuf[32];
7853,7 → 7853,7
omdtims = mdtims; mdtims = getticks();
 
{
int i;
int32_t i;
for (i=0;i<MAXSPRITES;i++)
if ((mdpause&&spriteext[i].mdanimtims)||(spriteext[i].flags & SPREXT_NOMDANIM))
spriteext[i].mdanimtims+=mdtims-omdtims;
7868,10 → 7868,10
//
// loadpics
//
int loadpics(char *filename, int askedsize)
int32_t loadpics(char *filename, int32_t askedsize)
{
int offscount, localtilestart, localtileend, dasiz;
short fil, i, j, k;
int32_t offscount, localtilestart, localtileend, dasiz;
int16_t fil, i, j, k;
 
Bstrcpy(artfilename,filename);
 
7918,7 → 7918,7
{
tilefilenum[i] = k;
tilefileoffs[i] = offscount;
dasiz = (int)(tilesizx[i]*tilesizy[i]);
dasiz = (int32_t)(tilesizx[i]*tilesizy[i]);
offscount += dasiz;
artsize += ((dasiz+15)&0xfffffff0);
}
7928,12 → 7928,12
}
while (k != numtilefiles && k < 64);
 
clearbuf(&gotpic[0],(int)((MAXTILES+31)>>5),0L);
clearbuf(&gotpic[0],(int32_t)((MAXTILES+31)>>5),0L);
 
//try dpmi_DETERMINEMAXREALALLOC!
 
//cachesize = min((int)((Bgetsysmemsize()/100)*60),max(artsize,askedsize));
if (Bgetsysmemsize() <= (unsigned int)askedsize)
//cachesize = min((int32_t)((Bgetsysmemsize()/100)*60),max(artsize,askedsize));
if (Bgetsysmemsize() <= (uint32_t)askedsize)
cachesize = (Bgetsysmemsize()/100)*60;
else
cachesize = askedsize;
7948,10 → 7948,10
{
j = 15;
while ((j > 1) && (pow2long[j] > tilesizx[i])) j--;
picsiz[i] = ((char)j);
picsiz[i] = ((uint8_t)j);
j = 15;
while ((j > 1) && (pow2long[j] > tilesizy[i])) j--;
picsiz[i] += ((char)(j<<4));
picsiz[i] += ((uint8_t)(j<<4));
}
 
artfil = -1;
7968,13 → 7968,13
char cachedebug = 0;
char faketile[MAXTILES];
char *faketiledata[MAXTILES];
int h_xsize[MAXTILES], h_ysize[MAXTILES];
signed char h_xoffs[MAXTILES], h_yoffs[MAXTILES];
int32_t h_xsize[MAXTILES], h_ysize[MAXTILES];
int8_t h_xoffs[MAXTILES], h_yoffs[MAXTILES];
 
void loadtile(short tilenume)
void loadtile(int16_t tilenume)
{
char *ptr;
int i, dasiz;
int32_t i, dasiz;
 
if ((unsigned)tilenume >= (unsigned)MAXTILES) return;
dasiz = tilesizx[tilenume]*tilesizy[tilenume];
8024,7 → 8024,7
}
}
 
void checktile(short tilenume)
void checktile(int16_t tilenume)
{
if (!waloff[tilenume])
loadtile(tilenume);
8033,9 → 8033,9
//
// allocatepermanenttile
//
int allocatepermanenttile(short tilenume, int xsiz, int ysiz)
int32_t allocatepermanenttile(int16_t tilenume, int32_t xsiz, int32_t ysiz)
{
int j, dasiz;
int32_t j, dasiz;
 
if ((xsiz <= 0) || (ysiz <= 0) || ((unsigned)tilenume >= (unsigned)MAXTILES))
return(0);
8050,9 → 8050,9
picanm[tilenume] = 0;
 
j = 15; while ((j > 1) && (pow2long[j] > xsiz)) j--;
picsiz[tilenume] = ((char)j);
picsiz[tilenume] = ((uint8_t)j);
j = 15; while ((j > 1) && (pow2long[j] > ysiz)) j--;
picsiz[tilenume] += ((char)(j<<4));
picsiz[tilenume] += ((uint8_t)(j<<4));
 
return(waloff[tilenume]);
}
8061,11 → 8061,11
//
// copytilepiece
//
void copytilepiece(int tilenume1, int sx1, int sy1, int xsiz, int ysiz,
int tilenume2, int sx2, int sy2)
void copytilepiece(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz,
int32_t tilenume2, int32_t sx2, int32_t sy2)
{
char *ptr1, *ptr2, dat;
int xsiz1, ysiz1, xsiz2, ysiz2, i, j, x1, y1, x2, y2;
int32_t xsiz1, ysiz1, xsiz2, ysiz2, i, j, x1, y1, x2, y2;
 
xsiz1 = tilesizx[tilenume1]; ysiz1 = tilesizy[tilenume1];
xsiz2 = tilesizx[tilenume2]; ysiz2 = tilesizy[tilenume2];
8103,9 → 8103,9
// qloadkvx
//
#ifdef SUPERBUILD
int qloadkvx(int voxindex, char *filename)
int32_t qloadkvx(int32_t voxindex, char *filename)
{
int i, fil, dasiz, lengcnt, lengtot;
int32_t i, fil, dasiz, lengcnt, lengtot;
char *ptr;
 
if ((fil = kopen4load(filename,0)) == -1) return -1;
8143,10 → 8143,10
//
// clipinsidebox
//
int clipinsidebox(int x, int y, short wallnum, int walldist)
int32_t clipinsidebox(int32_t x, int32_t y, int16_t wallnum, int32_t walldist)
{
walltype *wal;
int x1, y1, x2, y2, r;
int32_t x1, y1, x2, y2, r;
 
r = (walldist<<1);
wal = &wall[wallnum]; x1 = wal->x+walldist-x; y1 = wal->y+walldist-y;
8173,9 → 8173,9
//
// clipinsideboxline
//
int clipinsideboxline(int x, int y, int x1, int y1, int x2, int y2, int walldist)
int32_t clipinsideboxline(int32_t x, int32_t y, int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t walldist)
{
int r;
int32_t r;
 
r = (walldist<<1);
 
8203,11 → 8203,11
//
// inside
//
int inside(int x, int y, short sectnum)
int32_t inside(int32_t x, int32_t y, int16_t sectnum)
{
walltype *wal;
int i, x1, y1, x2, y2;
unsigned int cnt;
int32_t i, x1, y1, x2, y2;
uint32_t cnt;
 
if ((sectnum < 0) || (sectnum >= numsectors)) return(-1);
 
8232,7 → 8232,7
//
// getangle
//
int getangle(int xvect, int yvect)
int32_t getangle(int32_t xvect, int32_t yvect)
{
if ((xvect|yvect) == 0) return(0);
if (xvect == 0) return(512+((yvect<0)<<10));
8248,7 → 8248,7
//
// ksqrt
//
int ksqrt(int num)
int32_t ksqrt(int32_t num)
{
return(nsqrtasm(num));
}
8257,7 → 8257,7
//
// krecip
//
int krecip(int num)
int32_t krecip(int32_t num)
{
return(krecipasm(num));
}
8265,9 → 8265,9
//
// setsprite
//
int setsprite(short spritenum, int newx, int newy, int newz)
int32_t setsprite(int16_t spritenum, int32_t newx, int32_t newy, int32_t newz)
{
short tempsectnum;
int16_t tempsectnum;
 
sprite[spritenum].x = newx;
sprite[spritenum].y = newy;
8284,9 → 8284,9
return(0);
}
 
int setspritez(short spritenum, int newx, int newy, int newz)
int32_t setspritez(int16_t spritenum, int32_t newx, int32_t newy, int32_t newz)
{
short tempsectnum;
int16_t tempsectnum;
 
sprite[spritenum].x = newx;
sprite[spritenum].y = newy;
8306,7 → 8306,7
//
// insertsprite
//
int insertsprite(short sectnum, short statnum)
int32_t insertsprite(int16_t sectnum, int16_t statnum)
{
insertspritestat(statnum);
return(insertspritesect(sectnum));
8316,7 → 8316,7
//
// deletesprite
//
int deletesprite(short spritenum)
int32_t deletesprite(int16_t spritenum)
{
deletespritestat(spritenum);
return(deletespritesect(spritenum));
8326,7 → 8326,7
//
// changespritesect
//
int changespritesect(short spritenum, short newsectnum)
int32_t changespritesect(int16_t spritenum, int16_t newsectnum)
{
if ((newsectnum < 0) || (newsectnum > MAXSECTORS)) return(-1);
if (sprite[spritenum].sectnum == newsectnum) return(0);
8340,7 → 8340,7
//
// changespritestat
//
int changespritestat(short spritenum, short newstatnum)
int32_t changespritestat(int16_t spritenum, int16_t newstatnum)
{
if ((newstatnum < 0) || (newstatnum > MAXSTATUS)) return(-1);
if (sprite[spritenum].statnum == newstatnum) return(0);
8354,11 → 8354,11
//
// nextsectorneighborz
//
int nextsectorneighborz(short sectnum, int thez, short topbottom, short direction)
int32_t nextsectorneighborz(int16_t sectnum, int32_t thez, int16_t topbottom, int16_t direction)
{
walltype *wal;
int i, testz, nextz;
short sectortouse;
int32_t i, testz, nextz;
int16_t sectortouse;
 
if (direction == 1) nextz = 0x7fffffff; else nextz = 0x80000000;
 
8423,12 → 8423,12
//
// cansee
//
int cansee(int x1, int y1, int z1, short sect1, int x2, int y2, int z2, short sect2)
int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1, int32_t x2, int32_t y2, int32_t z2, int16_t sect2)
{
sectortype *sec;
walltype *wal, *wal2;
int i, cnt, nexts, x, y, z, cz, fz, dasectnum, dacnt, danum;
int x21, y21, z21, x31, y31, x34, y34, bot, t;
int32_t i, cnt, nexts, x, y, z, cz, fz, dasectnum, dacnt, danum;
int32_t x21, y21, z21, x31, y31, x34, y34, bot, t;
 
if ((x1 == x2) && (y1 == y2)) return(sect1 == sect2);
 
8456,9 → 8456,9
y = y1 + mulscale24(y21,t);
z = z1 + mulscale24(z21,t);
 
getzsofslope((short)dasectnum,x,y,&cz,&fz);
getzsofslope((int16_t)dasectnum,x,y,&cz,&fz);
if ((z <= cz) || (z >= fz)) return(0);
getzsofslope((short)nexts,x,y,&cz,&fz);
getzsofslope((int16_t)nexts,x,y,&cz,&fz);
if ((z <= cz) || (z >= fz)) return(0);
 
for (i=danum-1;i>=0;i--) if (clipsectorlist[i] == nexts) break;
8473,20 → 8473,20
//
// hitscan
//
int hitscan(int xs, int ys, int zs, short sectnum, int vx, int vy, int vz,
short *hitsect, short *hitwall, short *hitsprite,
int *hitx, int *hity, int *hitz, unsigned int cliptype)
int32_t hitscan(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int32_t vx, int32_t vy, int32_t vz,
int16_t *hitsect, int16_t *hitwall, int16_t *hitsprite,
int32_t *hitx, int32_t *hity, int32_t *hitz, uint32_t cliptype)
{
sectortype *sec;
walltype *wal, *wal2;
spritetype *spr;
int z, zz, x1, y1=0, z1=0, x2, y2, x3, y3, x4, y4, intx, inty, intz;
int topt, topu, bot, dist, offx, offy, cstat;
int i, j, k, l, tilenum, xoff, yoff, dax, day, daz, daz2;
int ang, cosang, sinang, xspan, yspan, xrepeat, yrepeat;
int dawalclipmask, dasprclipmask;
short tempshortcnt, tempshortnum, dasector, startwall, endwall;
short nextsector;
int32_t z, zz, x1, y1=0, z1=0, x2, y2, x3, y3, x4, y4, intx, inty, intz;
int32_t topt, topu, bot, dist, offx, offy, cstat;
int32_t i, j, k, l, tilenum, xoff, yoff, dax, day, daz, daz2;
int32_t ang, cosang, sinang, xspan, yspan, xrepeat, yrepeat;
int32_t dawalclipmask, dasprclipmask;
int16_t tempshortcnt, tempshortnum, dasector, startwall, endwall;
int16_t nextsector;
char clipyou;
 
*hitsect = -1; *hitwall = -1; *hitsprite = -1;
8632,7 → 8632,7
 
i = (tilesizy[spr->picnum]*spr->yrepeat<<2);
if (cstat&128) z1 += (i>>1);
if (picanm[spr->picnum]&0x00ff0000) z1 -= ((int)((signed char)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
if (picanm[spr->picnum]&0x00ff0000) z1 -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
if ((intz > z1) || (intz < z1-i)) continue;
topu = vx*(y1-ys) - vy*(x1-xs);
 
8653,7 → 8653,7
//These lines get the 2 points of the rotated sprite
//Given: (x1, y1) starts out as the center point
tilenum = spr->picnum;
xoff = (int)((signed char)((picanm[tilenum]>>8)&255))+((int)spr->xoffset);
xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
if ((cstat&4) > 0) xoff = -xoff;
k = spr->ang; l = spr->xrepeat;
dax = sintable[k&2047]*l; day = sintable[(k+1536)&2047]*l;
8670,7 → 8670,7
 
k = ((tilesizy[spr->picnum]*spr->yrepeat)<<2);
if (cstat&128) daz = spr->z+(k>>1); else daz = spr->z;
if (picanm[spr->picnum]&0x00ff0000) daz -= ((int)((signed char)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
if ((intz < daz) && (intz > daz-k))
{
*hitsect = dasector; *hitwall = -1; *hitsprite = z;
8685,9 → 8685,9
if ((zs > intz) == ((cstat&8)==0)) continue;
 
#if 1 // Abyss crash prevention code ((intz-zs)*zx overflowing a 8-bit word)
zz=(int)((intz-zs)*vx);
zz=(int32_t)((intz-zs)*vx);
intx = xs+scale(zz,1,vz);
zz=(int)((intz-zs)*vy);
zz=(int32_t)((intz-zs)*vy);
inty = ys+scale(zz,1,vz);
#else
intx = xs+scale(intz-zs,vx,vz);
8697,8 → 8697,8
if (klabs(intx-xs)+klabs(inty-ys) > klabs((*hitx)-xs)+klabs((*hity)-ys)) continue;
 
tilenum = spr->picnum;
xoff = (int)((signed char)((picanm[tilenum]>>8)&255))+((int)spr->xoffset);
yoff = (int)((signed char)((picanm[tilenum]>>16)&255))+((int)spr->yoffset);
xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
yoff = (int32_t)((int8_t)((picanm[tilenum]>>16)&255))+((int32_t)spr->yoffset);
if ((cstat&4) > 0) xoff = -xoff;
if ((cstat&8) > 0) yoff = -yoff;
 
8757,14 → 8757,14
//
// neartag
//
int neartag(int xs, int ys, int zs, short sectnum, short ange, short *neartagsector, short *neartagwall, short *neartagsprite, int *neartaghitdist, int neartagrange, char tagsearch)
int32_t neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, int16_t *neartagsector, int16_t *neartagwall, int16_t *neartagsprite, int32_t *neartaghitdist, int32_t neartagrange, char tagsearch)
{
walltype *wal, *wal2;
spritetype *spr;
int i, z, zz, xe, ye, ze, x1, y1, z1, x2, y2, intx, inty, intz;
int topt, topu, bot, dist, offx, offy, vx, vy, vz;
short tempshortcnt, tempshortnum, dasector, startwall, endwall;
short nextsector, good;
int32_t i, z, zz, xe, ye, ze, x1, y1, z1, x2, y2, intx, inty, intz;
int32_t topt, topu, bot, dist, offx, offy, vx, vy, vz;
int16_t tempshortcnt, tempshortnum, dasector, startwall, endwall;
int16_t nextsector, good;
 
*neartagsector = -1; *neartagwall = -1; *neartagsprite = -1;
*neartaghitdist = 0;
8842,7 → 8842,7
intz = zs+scale(vz,topt,bot);
i = tilesizy[spr->picnum]*spr->yrepeat;
if (spr->cstat&128) z1 += (i<<1);
if (picanm[spr->picnum]&0x00ff0000) z1 -= ((int)((signed char)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
if (picanm[spr->picnum]&0x00ff0000) z1 -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
if ((intz <= z1) && (intz >= z1-(i<<2)))
{
topu = vx*(y1-ys) - vy*(x1-xs);
8880,9 → 8880,9
//
// dragpoint
//
void dragpoint(short pointhighlight, int dax, int day)
void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day)
{
short cnt, tempshort;
int16_t cnt, tempshort;
 
wall[pointhighlight].x = dax;
wall[pointhighlight].y = day;
8932,9 → 8932,9
//
// lastwall
//
int lastwall(short point)
int32_t lastwall(int16_t point)
{
int i, j, cnt;
int32_t i, j, cnt;
 
if ((point > 0) && (wall[point-1].point2 == point)) return(point-1);
i = point;
8962,25 → 8962,25
} \
} \
int clipmoveboxtracenum = 3;
int32_t clipmoveboxtracenum = 3;
 
//
// clipmove
//
int clipmove(int *x, int *y, int *z, short *sectnum,
int xvect, int yvect,
int walldist, int ceildist, int flordist, unsigned int cliptype)
int32_t clipmove(int32_t *x, int32_t *y, int32_t *z, int16_t *sectnum,
int32_t xvect, int32_t yvect,
int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype)
{
walltype *wal, *wal2;
spritetype *spr;
sectortype *sec, *sec2;
int i, j, tempint1, tempint2;
int oxvect, oyvect, goalx, goaly, intx, inty, lx, ly, retval;
int k, l, clipsectcnt, startwall, endwall, cstat, dasect;
int x1, y1, x2, y2, cx, cy, rad, xmin, ymin, xmax, ymax, daz, daz2;
int bsz, dax, day, xoff, yoff, xspan, yspan, cosang, sinang, tilenum;
int xrepeat, yrepeat, gx, gy, dx, dy, dasprclipmask, dawalclipmask;
int hitwall, cnt, clipyou;
int32_t i, j, tempint1, tempint2;
int32_t oxvect, oyvect, goalx, goaly, intx, inty, lx, ly, retval;
int32_t k, l, clipsectcnt, startwall, endwall, cstat, dasect;
int32_t x1, y1, x2, y2, cx, cy, rad, xmin, ymin, xmax, ymax, daz, daz2;
int32_t bsz, dax, day, xoff, yoff, xspan, yspan, cosang, sinang, tilenum;
int32_t xrepeat, yrepeat, gx, gy, dx, dy, dasprclipmask, dawalclipmask;
int32_t hitwall, cnt, clipyou;
 
if (((xvect|yvect) == 0) || (*sectnum < 0)) return(0);
retval = 0;
9035,7 → 9035,7
{
if (rintersect(*x,*y,0,gx,gy,0,x1,y1,x2,y2,&dax,&day,&daz) == 0)
dax = *x, day = *y;
daz = getflorzofslope((short)dasect,dax,day);
daz = getflorzofslope((int16_t)dasect,dax,day);
daz2 = getflorzofslope(wal->nextsector,dax,day);
 
sec2 = &sector[wal->nextsector];
9044,7 → 9044,7
if ((*z) >= daz2-(flordist-1)) clipyou = 1;
if (clipyou == 0)
{
daz = getceilzofslope((short)dasect,dax,day);
daz = getceilzofslope((int16_t)dasect,dax,day);
daz2 = getceilzofslope(wal->nextsector,dax,day);
if (daz2 > daz+(1<<8))
if ((sec2->ceilingstat&1) == 0)
9056,15 → 9056,15
{
//Add 2 boxes at endpoints
bsz = walldist; if (gx < 0) bsz = -bsz;
addclipline(x1-bsz,y1-bsz,x1-bsz,y1+bsz,(short)j+32768);
addclipline(x2-bsz,y2-bsz,x2-bsz,y2+bsz,(short)j+32768);
addclipline(x1-bsz,y1-bsz,x1-bsz,y1+bsz,(int16_t)j+32768);
addclipline(x2-bsz,y2-bsz,x2-bsz,y2+bsz,(int16_t)j+32768);
bsz = walldist; if (gy < 0) bsz = -bsz;
addclipline(x1+bsz,y1-bsz,x1-bsz,y1-bsz,(short)j+32768);
addclipline(x2+bsz,y2-bsz,x2-bsz,y2-bsz,(short)j+32768);
addclipline(x1+bsz,y1-bsz,x1-bsz,y1-bsz,(int16_t)j+32768);
addclipline(x2+bsz,y2-bsz,x2-bsz,y2-bsz,(int16_t)j+32768);
 
dax = walldist; if (dy > 0) dax = -dax;
day = walldist; if (dx < 0) day = -day;
addclipline(x1+dax,y1+day,x2+dax,y2+day,(short)j+32768);
addclipline(x1+dax,y1+day,x2+dax,y2+day,(int16_t)j+32768);
}
else
{
9087,13 → 9087,13
{
k = ((tilesizy[spr->picnum]*spr->yrepeat)<<2);
if (cstat&128) daz = spr->z+(k>>1); else daz = spr->z;
if (picanm[spr->picnum]&0x00ff0000) daz -= ((int)((signed char)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
if (((*z) < daz+ceildist) && ((*z) > daz-k-flordist))
{
bsz = (spr->clipdist<<2)+walldist; if (gx < 0) bsz = -bsz;
addclipline(x1-bsz,y1-bsz,x1-bsz,y1+bsz,(short)j+49152);
addclipline(x1-bsz,y1-bsz,x1-bsz,y1+bsz,(int16_t)j+49152);
bsz = (spr->clipdist<<2)+walldist; if (gy < 0) bsz = -bsz;
addclipline(x1+bsz,y1-bsz,x1-bsz,y1-bsz,(short)j+49152);
addclipline(x1+bsz,y1-bsz,x1-bsz,y1-bsz,(int16_t)j+49152);
}
}
break;
9100,7 → 9100,7
case 16:
k = ((tilesizy[spr->picnum]*spr->yrepeat)<<2);
if (cstat&128) daz = spr->z+(k>>1); else daz = spr->z;
if (picanm[spr->picnum]&0x00ff0000) daz -= ((int)((signed char)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
daz2 = daz-k;
daz += ceildist; daz2 -= flordist;
if (((*z) < daz) && ((*z) > daz2))
9108,7 → 9108,7
//These lines get the 2 points of the rotated sprite
//Given: (x1, y1) starts out as the center point
tilenum = spr->picnum;
xoff = (int)((signed char)((picanm[tilenum]>>8)&255))+((int)spr->xoffset);
xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
if ((cstat&4) > 0) xoff = -xoff;
k = spr->ang; l = spr->xrepeat;
dax = sintable[k&2047]*l; day = sintable[(k+1536)&2047]*l;
9122,19 → 9122,19
 
if ((x1-(*x))*(y2-(*y)) >= (x2-(*x))*(y1-(*y))) //Front
{
addclipline(x1+dax,y1+day,x2+day,y2-dax,(short)j+49152);
addclipline(x1+dax,y1+day,x2+day,y2-dax,(int16_t)j+49152);
}
else
{
if ((cstat&64) != 0) continue;
addclipline(x2-dax,y2-day,x1-day,y1+dax,(short)j+49152);
addclipline(x2-dax,y2-day,x1-day,y1+dax,(int16_t)j+49152);
}
 
//Side blocker
if ((x2-x1)*((*x)-x1) + (y2-y1)*((*y)-y1) < 0)
{ addclipline(x1-day,y1+dax,x1+dax,y1+day,(short)j+49152); }
{ addclipline(x1-day,y1+dax,x1+dax,y1+day,(int16_t)j+49152); }
else if ((x1-x2)*((*x)-x2) + (y1-y2)*((*y)-y2) < 0)
{ addclipline(x2+day,y2-dax,x2-dax,y2-day,(short)j+49152); }
{ addclipline(x2+day,y2-dax,x2-dax,y2-day,(int16_t)j+49152); }
}
}
break;
9147,8 → 9147,8
if (((*z) > spr->z) == ((cstat&8)==0)) continue;
 
tilenum = spr->picnum;
xoff = (int)((signed char)((picanm[tilenum]>>8)&255))+((int)spr->xoffset);
yoff = (int)((signed char)((picanm[tilenum]>>16)&255))+((int)spr->yoffset);
xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
yoff = (int32_t)((int8_t)((picanm[tilenum]>>16)&255))+((int32_t)spr->yoffset);
if ((cstat&4) > 0) xoff = -xoff;
if ((cstat&8) > 0) yoff = -yoff;
 
9173,23 → 9173,23
if ((rxi[0]-(*x))*(ryi[1]-(*y)) < (rxi[1]-(*x))*(ryi[0]-(*y)))
{
if (clipinsideboxline(cx,cy,rxi[1],ryi[1],rxi[0],ryi[0],rad) != 0)
addclipline(rxi[1]-day,ryi[1]+dax,rxi[0]+dax,ryi[0]+day,(short)j+49152);
addclipline(rxi[1]-day,ryi[1]+dax,rxi[0]+dax,ryi[0]+day,(int16_t)j+49152);
}
else if ((rxi[2]-(*x))*(ryi[3]-(*y)) < (rxi[3]-(*x))*(ryi[2]-(*y)))
{
if (clipinsideboxline(cx,cy,rxi[3],ryi[3],rxi[2],ryi[2],rad) != 0)
addclipline(rxi[3]+day,ryi[3]-dax,rxi[2]-dax,ryi[2]-day,(short)j+49152);
addclipline(rxi[3]+day,ryi[3]-dax,rxi[2]-dax,ryi[2]-day,(int16_t)j+49152);
}
 
if ((rxi[1]-(*x))*(ryi[2]-(*y)) < (rxi[2]-(*x))*(ryi[1]-(*y)))
{
if (clipinsideboxline(cx,cy,rxi[2],ryi[2],rxi[1],ryi[1],rad) != 0)
addclipline(rxi[2]-dax,ryi[2]-day,rxi[1]-day,ryi[1]+dax,(short)j+49152);
addclipline(rxi[2]-dax,ryi[2]-day,rxi[1]-day,ryi[1]+dax,(int16_t)j+49152);
}
else if ((rxi[3]-(*x))*(ryi[0]-(*y)) < (rxi[0]-(*x))*(ryi[3]-(*y)))
{
if (clipinsideboxline(cx,cy,rxi[0],ryi[0],rxi[3],ryi[3],rad) != 0)
addclipline(rxi[0]+dax,ryi[0]+day,rxi[3]+day,ryi[3]-dax,(short)j+49152);
addclipline(rxi[0]+dax,ryi[0]+day,rxi[3]+day,ryi[3]-dax,(int16_t)j+49152);
}
}
break;
9259,7 → 9259,7
if (inside(*x,*y,j) == 1)
{
if (sector[j].ceilingstat&2)
tempint2 = (getceilzofslope((short)j,*x,*y)-(*z));
tempint2 = (getceilzofslope((int16_t)j,*x,*y)-(*z));
else
tempint2 = (sector[j].ceilingz-(*z));
 
9271,7 → 9271,7
else
{
if (sector[j].floorstat&2)
tempint2 = ((*z)-getflorzofslope((short)j,*x,*y));
tempint2 = ((*z)-getflorzofslope((int16_t)j,*x,*y));
else
tempint2 = ((*z)-sector[j].floorz);
 
9292,14 → 9292,14
//
// pushmove
//
int pushmove(int *x, int *y, int *z, short *sectnum,
int walldist, int ceildist, int flordist, unsigned int cliptype)
int32_t pushmove(int32_t *x, int32_t *y, int32_t *z, int16_t *sectnum,
int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype)
{
sectortype *sec, *sec2;
walltype *wal;
int i, j, k, t, dx, dy, dax, day, daz, daz2, bad, dir;
int dasprclipmask, dawalclipmask;
short startwall, endwall, clipsectcnt;
int32_t i, j, k, t, dx, dy, dax, day, daz, daz2, bad, dir;
int32_t dasprclipmask, dawalclipmask;
int16_t startwall, endwall, clipsectcnt;
char bad2;
 
if ((*sectnum) < 0) return(-1);
9330,7 → 9330,7
{
t = ((tilesizy[spr->picnum]*spr->yrepeat)<<2);
if (spr->cstat&128) daz = spr->z+(t>>1); else daz = spr->z;
if (picanm[spr->picnum]&0x00ff0000) daz -= ((int)((signed char)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
if (((*z) < daz+ceildist) && ((*z) > daz-t-flordist))
{
t = (spr->clipdist<<2)+walldist;
9431,10 → 9431,10
//
// updatesector[z]
//
void updatesector(int x, int y, short *sectnum)
void updatesector(int32_t x, int32_t y, int16_t *sectnum)
{
walltype *wal;
int i, j;
int32_t i, j;
 
if (inside(x,y,*sectnum) == 1) return;
 
9446,7 → 9446,7
{
i = wal->nextsector;
if (i >= 0)
if (inside(x,y,(short)i) == 1)
if (inside(x,y,(int16_t)i) == 1)
{
*sectnum = i;
return;
9458,7 → 9458,7
}
 
for (i=numsectors-1;i>=0;i--)
if (inside(x,y,(short)i) == 1)
if (inside(x,y,(int16_t)i) == 1)
{
*sectnum = i;
return;
9467,10 → 9467,10
*sectnum = -1;
}
 
void updatesectorz(int x, int y, int z, short *sectnum)
void updatesectorz(int32_t x, int32_t y, int32_t z, int16_t *sectnum)
{
walltype *wal;
int i, j, cz, fz;
int32_t i, j, cz, fz;
 
getzsofslope(*sectnum, x, y, &cz, &fz);
if ((z >= cz) && (z <= fz))
9487,7 → 9487,7
{
getzsofslope(i, x, y, &cz, &fz);
if ((z >= cz) && (z <= fz))
if (inside(x,y,(short)i) == 1)
if (inside(x,y,(int16_t)i) == 1)
{ *sectnum = i; return; }
}
wal++; j--;
9499,7 → 9499,7
{
getzsofslope(i, x, y, &cz, &fz);
if ((z >= cz) && (z <= fz))
if (inside(x,y,(short)i) == 1)
if (inside(x,y,(int16_t)i) == 1)
{ *sectnum = i; return; }
}
 
9510,9 → 9510,9
//
// rotatepoint
//
void rotatepoint(int xpivot, int ypivot, int x, int y, short daang, int *x2, int *y2)
void rotatepoint(int32_t xpivot, int32_t ypivot, int32_t x, int32_t y, int16_t daang, int32_t *x2, int32_t *y2)
{
int dacos, dasin;
int32_t dacos, dasin;
 
dacos = sintable[(daang+2560)&2047];
dasin = sintable[(daang+2048)&2047];
9527,7 → 9527,7
// getmousevalues
//
 
void getmousevalues(int *mousx, int *mousy, int *bstatus)
void getmousevalues(int32_t *mousx, int32_t *mousy, int32_t *bstatus)
{
readmousexy(mousx,mousy);
readmousebstatus(bstatus);
9537,11 → 9537,11
//
// krand
//
int krand(void)
int32_t krand(void)
{
// randomseed = (randomseed*27584621)+1;
randomseed = (randomseed * 1664525ul) + 221297ul;
return(((unsigned int)randomseed)>>16);
return(((uint32_t)randomseed)>>16);
}
 
 
9548,18 → 9548,18
//
// getzrange
//
void getzrange(int x, int y, int z, short sectnum,
int *ceilz, int *ceilhit, int *florz, int *florhit,
int walldist, unsigned int cliptype)
void getzrange(int32_t x, int32_t y, int32_t z, int16_t sectnum,
int32_t *ceilz, int32_t *ceilhit, int32_t *florz, int32_t *florhit,
int32_t walldist, uint32_t cliptype)
{
sectortype *sec;
walltype *wal, *wal2;
spritetype *spr;
int clipsectcnt, startwall, endwall, tilenum, xoff, yoff, dax, day;
int xmin, ymin, xmax, ymax, i, j, k, l, daz, daz2, dx, dy;
int x1, y1, x2, y2, x3, y3, x4, y4, ang, cosang, sinang;
int xspan, yspan, xrepeat, yrepeat, dasprclipmask, dawalclipmask;
short cstat;
int32_t clipsectcnt, startwall, endwall, tilenum, xoff, yoff, dax, day;
int32_t xmin, ymin, xmax, ymax, i, j, k, l, daz, daz2, dx, dy;
int32_t x1, y1, x2, y2, x3, y3, x4, y4, ang, cosang, sinang;
int32_t xspan, yspan, xrepeat, yrepeat, dasprclipmask, dawalclipmask;
int16_t cstat;
char clipyou;
 
if (sectnum < 0)
9626,7 → 9626,7
if (dax >= day) continue;
 
//It actually got here, through all the continue's!!!
getzsofslope((short)k,x,y,&daz,&daz2);
getzsofslope((int16_t)k,x,y,&daz,&daz2);
if (daz > *ceilz) { *ceilz = daz; *ceilhit = k+16384; }
if (daz2 < *florz) { *florz = daz2; *florhit = k+16384; }
}
9655,7 → 9655,7
daz = spr->z;
k = ((tilesizy[spr->picnum]*spr->yrepeat)<<1);
if (cstat&128) daz += k;
if (picanm[spr->picnum]&0x00ff0000) daz -= ((int)((signed char)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
daz2 = daz - (k<<1);
clipyou = 1;
}
9662,7 → 9662,7
break;
case 16:
tilenum = spr->picnum;
xoff = (int)((signed char)((picanm[tilenum]>>8)&255))+((int)spr->xoffset);
xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
if ((cstat&4) > 0) xoff = -xoff;
k = spr->ang; l = spr->xrepeat;
dax = sintable[k&2047]*l; day = sintable[(k+1536)&2047]*l;
9673,7 → 9673,7
{
daz = spr->z; k = ((tilesizy[spr->picnum]*spr->yrepeat)<<1);
if (cstat&128) daz += k;
if (picanm[spr->picnum]&0x00ff0000) daz -= ((int)((signed char)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
daz2 = daz-(k<<1);
clipyou = 1;
}
9685,8 → 9685,8
if ((z > daz) == ((cstat&8)==0)) continue;
 
tilenum = spr->picnum;
xoff = (int)((signed char)((picanm[tilenum]>>8)&255))+((int)spr->xoffset);
yoff = (int)((signed char)((picanm[tilenum]>>16)&255))+((int)spr->yoffset);
xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
yoff = (int32_t)((int8_t)((picanm[tilenum]>>16)&255))+((int32_t)spr->yoffset);
if ((cstat&4) > 0) xoff = -xoff;
if ((cstat&8) > 0) yoff = -yoff;
 
9747,9 → 9747,9
//
// setview
//
void setview(int x1, int y1, int x2, int y2)
void setview(int32_t x1, int32_t y1, int32_t x2, int32_t y2)
{
int i;
int32_t i;
 
windowx1 = x1; wx1 = (x1<<12);
windowy1 = y1; wy1 = (y1<<12);
9760,7 → 9760,7
xdimenrecip = divscale32(1L,xdimen);
ydimen = (y2-y1)+1;
 
setaspect(65536L,(int)divscale16(ydim*320L,xdim*200L));
setaspect(65536L,(int32_t)divscale16(ydim*320L,xdim*200L));
 
for (i=0;i<windowx1;i++) { startumost[i] = 1, startdmost[i] = 0; }
for (i=windowx1;i<=windowx2;i++)
9778,7 → 9778,7
//
// setaspect
//
void setaspect(int daxrange, int daaspect)
void setaspect(int32_t daxrange, int32_t daaspect)
{
viewingrange = daxrange;
viewingrangerecip = divscale32(1L,daxrange);
9802,14 → 9802,14
//
// rotatesprite
//
void rotatesprite(int sx, int sy, int z, short a, short picnum, signed char dashade, char dapalnum, char dastat, int cx1, int cy1, int cx2, int cy2)
void rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, int8_t dashade, char dapalnum, char dastat, int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2)
{
int i;
int32_t i;
permfifotype *per, *per2;
 
if ((cx1 > cx2) || (cy1 > cy2)) return;
if (z <= 16) return;
if (picanm[picnum]&192) picnum += animateoffs(picnum,(short)0xc000);
if (picanm[picnum]&192) picnum += animateoffs(picnum,(int16_t)0xc000);
if ((tilesizx[picnum] <= 0) || (tilesizy[picnum] <= 0)) return;
 
if (((dastat&128) == 0) || (numpages < 2) || (beforedrawrooms != 0))
9881,9 → 9881,9
//
// makepalookup
//
void makepalookup(int palnum, char *remapbuf, signed char r, signed char g, signed char b, char dastat)
void makepalookup(int32_t palnum, char *remapbuf, int8_t r, int8_t g, int8_t b, char dastat)
{
int i, j, palscale;
int32_t i, j, palscale;
char *ptr, *ptr2;
 
if (paletteloaded == 0) return;
9922,9 → 9922,9
for (j=0;j<256;j++)
{
ptr = (char *)&palette[remapbuf[j]*3];
*ptr2++ = getclosestcol((int)ptr[0]+mulscale16(r-ptr[0],palscale),
(int)ptr[1]+mulscale16(g-ptr[1],palscale),
(int)ptr[2]+mulscale16(b-ptr[2],palscale));
*ptr2++ = getclosestcol((int32_t)ptr[0]+mulscale16(r-ptr[0],palscale),
(int32_t)ptr[1]+mulscale16(g-ptr[1],palscale),
(int32_t)ptr[2]+mulscale16(b-ptr[2],palscale));
}
}
#if defined(USE_OPENGL)
9938,7 → 9938,7
 
void setvgapalette(void)
{
int i;
int32_t i;
 
for (i=0;i<256;i++)
{
9954,12 → 9954,12
//
void setbrightness(char dabrightness, char *dapal, char noapply)
{
int i, k, j;
// unsigned int lastbright = curbrightness;
int32_t i, k, j;
// uint32_t lastbright = curbrightness;
 
if (!(noapply&4))
{
curbrightness = min(max((int)dabrightness,0),15);
curbrightness = min(max((int32_t)dabrightness,0),15);
// if (lastbright != (unsigned)curbrightness)
// vid_gamma = 1.0 + ((float)curbrightness / 10.0);
}
9986,8 → 9986,8
#if defined(POLYMOST) && defined(USE_OPENGL)
if (rendmode >= 3)
{
static unsigned int lastpalettesum = 0;
unsigned int newpalettesum = crc32once((unsigned char *)curpalettefaded, sizeof(curpalettefaded));
static uint32_t lastpalettesum = 0;
uint32_t newpalettesum = crc32once((uint8_t *)curpalettefaded, sizeof(curpalettefaded));
 
// only reset the textures if the preserve flag (bit 1 of noapply) is clear and
// either (a) the new palette is different to the last, or (b) the brightness
10010,7 → 10010,7
//
void setpalettefade(char r, char g, char b, char offset)
{
int i,k;
int32_t i,k;
palette_t p;
 
palfadergb.r = min(63,r) << 2;
10045,10 → 10045,10
//
// clearview
//
void clearview(int dacol)
void clearview(int32_t dacol)
{
intptr_t p;
int y, dx;
int32_t y, dx;
 
if (qsetmode != 200) return;
 
10091,7 → 10091,7
//
// clearallviews
//
void clearallviews(int dacol)
void clearallviews(int32_t dacol)
{
if (qsetmode != 200) return;
//dacol += (dacol<<8); dacol += (dacol<<16);
10130,7 → 10130,7
//
// plotpixel
//
void plotpixel(int x, int y, char col)
void plotpixel(int32_t x, int32_t y, char col)
{
#if defined(POLYMOST) && defined(USE_OPENGL)
if (rendmode >= 3 && qsetmode == 200)
10159,7 → 10159,7
#endif
 
begindrawing(); //{{{
drawpixel((void*)(ylookup[y]+x+frameplace),(int)col);
drawpixel((void*)(ylookup[y]+x+frameplace),(int32_t)col);
enddrawing(); //}}}
}
 
10167,7 → 10167,7
//
// getpixel
//
char getpixel(int x, int y)
char getpixel(int32_t x, int32_t y)
{
char r;
 
10187,9 → 10187,9
//
// setviewtotile
//
void setviewtotile(short tilenume, int xsiz, int ysiz)
void setviewtotile(int16_t tilenume, int32_t xsiz, int32_t ysiz)
{
int i, j;
int32_t i, j;
 
//DRAWROOMS TO TILE BACKUP&SET CODE
tilesizx[tilenume] = xsiz; tilesizy[tilenume] = ysiz;
10223,7 → 10223,7
extern char modechange;
void setviewback(void)
{
int i, j, k;
int32_t i, j, k;
 
if (setviewcnt <= 0) return;
setviewcnt--;
10255,9 → 10255,9
//
// squarerotatetile
//
void squarerotatetile(short tilenume)
void squarerotatetile(int16_t tilenume)
{
int i, j, k, xsiz, ysiz;
int32_t i, j, k, xsiz, ysiz;
char *ptr1, *ptr2;
 
xsiz = tilesizx[tilenume]; ysiz = tilesizy[tilenume];
10280,9 → 10280,9
//
// preparemirror
//
void preparemirror(int dax, int day, int daz, short daang, int dahoriz, short dawall, short dasector, int *tposx, int *tposy, short *tang)
void preparemirror(int32_t dax, int32_t day, int32_t daz, int16_t daang, int32_t dahoriz, int16_t dawall, int16_t dasector, int32_t *tposx, int32_t *tposy, int16_t *tang)
{
int i, j, x, y, dx, dy;
int32_t i, j, x, y, dx, dy;
 
UNREFERENCED_PARAMETER(daz);
UNREFERENCED_PARAMETER(dahoriz);
10305,7 → 10305,7
//
void completemirror(void)
{
int i, dy;
int32_t i, dy;
intptr_t p;
 
#ifdef POLYMOST
10336,9 → 10336,9
//
// sectorofwall
//
int sectorofwall(short theline)
int32_t sectorofwall(int16_t theline)
{
int i, gap;
int32_t i, gap;
 
if ((theline < 0) || (theline >= numwalls)) return(-1);
i = wall[theline].nextwall; if (i >= 0) return(wall[i].nextsector);
10358,9 → 10358,9
//
// getceilzofslope
//
int getceilzofslope(short sectnum, int dax, int day)
int32_t getceilzofslope(int16_t sectnum, int32_t dax, int32_t day)
{
int dx, dy, i, j;
int32_t dx, dy, i, j;
walltype *wal;
 
if (!(sector[sectnum].ceilingstat&2)) return(sector[sectnum].ceilingz);
10375,9 → 10375,9
//
// getflorzofslope
//
int getflorzofslope(short sectnum, int dax, int day)
int32_t getflorzofslope(int16_t sectnum, int32_t dax, int32_t day)
{
int dx, dy, i, j;
int32_t dx, dy, i, j;
walltype *wal;
 
if (!(sector[sectnum].floorstat&2)) return(sector[sectnum].floorz);
10392,9 → 10392,9
//
// getzsofslope
//
void getzsofslope(short sectnum, int dax, int day, int *ceilz, int *florz)
void getzsofslope(int16_t sectnum, int32_t dax, int32_t day, int32_t *ceilz, int32_t *florz)
{
int dx, dy, i, j;
int32_t dx, dy, i, j;
walltype *wal, *wal2;
sectortype *sec;
 
10415,9 → 10415,9
//
// alignceilslope
//
void alignceilslope(short dasect, int x, int y, int z)
void alignceilslope(int16_t dasect, int32_t x, int32_t y, int32_t z)
{
int i, dax, day;
int32_t i, dax, day;
walltype *wal;
 
wal = &wall[sector[dasect].wallptr];
10436,9 → 10436,9
//
// alignflorslope
//
void alignflorslope(short dasect, int x, int y, int z)
void alignflorslope(int16_t dasect, int32_t x, int32_t y, int32_t z)
{
int i, dax, day;
int32_t i, dax, day;
walltype *wal;
 
wal = &wall[sector[dasect].wallptr];
10457,9 → 10457,9
//
// loopnumofsector
//
int loopnumofsector(short sectnum, short wallnum)
int32_t loopnumofsector(int16_t sectnum, int16_t wallnum)
{
int i, numloops, startwall, endwall;
int32_t i, numloops, startwall, endwall;
 
numloops = 0;
startwall = sector[sectnum].wallptr;
10476,10 → 10476,10
//
// setfirstwall
//
void setfirstwall(short sectnum, short newfirstwall)
void setfirstwall(int16_t sectnum, int16_t newfirstwall)
{
int i, j, k, numwallsofloop;
int startwall, endwall, danumwalls, dagoalloop;
int32_t i, j, k, numwallsofloop;
int32_t startwall, endwall, danumwalls, dagoalloop;
 
startwall = sector[sectnum].wallptr;
danumwalls = sector[sectnum].wallnum;
10539,9 → 10539,9
//
// drawline256
//
void drawline256(int x1, int y1, int x2, int y2, char col)
void drawline256(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col)
{
int dx, dy, i, j, inc, plc, daend;
int32_t dx, dy, i, j, inc, plc, daend;
intptr_t p;
 
col = palookup[0][col];
10651,12 → 10651,12
//
// JBF: Had to add extra tests to make sure x-coordinates weren't winding up -'ve
// after clipping or crashes would ensue
unsigned int drawlinepat = 0xffffffff;
uint32_t drawlinepat = 0xffffffff;
 
void drawline16(int x1, int y1, int x2, int y2, char col)
void drawline16(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col)
{
int i, dx, dy, pinc, d;
unsigned int patc=0;
int32_t i, dx, dy, pinc, d;
uint32_t patc=0;
intptr_t p;
 
dx = x2-x1; dy = y2-y1;
10700,7 → 10700,7
p = (y1*bytesperline)+x1+frameplace;
if (dy == 0 && drawlinepat == 0xffffffff)
{
i = ((int)col<<24)|((int)col<<16)|((int)col<<8)|col;
i = ((int32_t)col<<24)|((int32_t)col<<16)|((int32_t)col<<8)|col;
clearbufbyte((void *)p, dx, i);
}
else
10737,11 → 10737,11
enddrawing(); //}}}
}
 
void drawcircle16(int x1, int y1, int r, char col)
void drawcircle16(int32_t x1, int32_t y1, int32_t r, char col)
{
#if 1
intptr_t p;
int xp, yp, xpbpl, ypbpl, d, de, dse, patc=0;
int32_t xp, yp, xpbpl, ypbpl, d, de, dse, patc=0;
 
if (r < 0) r = -r;
if (x1+r < 0 || x1-r >= xres) return;
10770,13 → 10770,13
 
if (drawlinepat & pow2long[(patc++)&31])
{
if ((unsigned int)y1 < (unsigned int)ydim16 && (unsigned int)(x1+r) < (unsigned int)xres)
if ((uint32_t)y1 < (uint32_t)ydim16 && (uint32_t)(x1+r) < (uint32_t)xres)
drawpixel((char *)(p+r), col); // a
if ((unsigned int)x1 < (unsigned int)xres && (unsigned int)(y1+r) < (unsigned int)ydim16)
if ((uint32_t)x1 < (uint32_t)xres && (uint32_t)(y1+r) < (uint32_t)ydim16)
drawpixel((char *)(p+(r*bytesperline)), col); // b
if ((unsigned int)y1 < (unsigned int)ydim16 && (unsigned int)(x1-r) < (unsigned int)xres)
if ((uint32_t)y1 < (uint32_t)ydim16 && (uint32_t)(x1-r) < (uint32_t)xres)
drawpixel((char *)(p-r), col); // c
if ((unsigned int)x1 < (unsigned int)xres && (unsigned int)(y1-r) < (unsigned int)ydim16)
if ((uint32_t)x1 < (uint32_t)xres && (uint32_t)(y1-r) < (uint32_t)ydim16)
drawpixel((char *)(p-(r*bytesperline)), col); // d
}
 
10802,21 → 10802,21
xpbpl = xp*bytesperline;
if (drawlinepat & pow2long[(patc++)&31])
{
if ((unsigned int)(x1+yp) < (unsigned int)xres && (unsigned int)(y1+xp) < (unsigned int)ydim16)
if ((uint32_t)(x1+yp) < (uint32_t)xres && (uint32_t)(y1+xp) < (uint32_t)ydim16)
drawpixel((char *)(p+yp+xpbpl), col); // 1
if ((unsigned int)(x1+xp) < (unsigned int)xres && (unsigned int)(y1+yp) < (unsigned int)ydim16)
if ((uint32_t)(x1+xp) < (uint32_t)xres && (uint32_t)(y1+yp) < (uint32_t)ydim16)
drawpixel((char *)(p+xp+ypbpl), col); // 2
if ((unsigned int)(x1-xp) < (unsigned int)xres && (unsigned int)(y1+yp) < (unsigned int)ydim16)
if ((uint32_t)(x1-xp) < (uint32_t)xres && (uint32_t)(y1+yp) < (uint32_t)ydim16)
drawpixel((char *)(p-xp+ypbpl), col); // 3
if ((unsigned int)(x1-yp) < (unsigned int)xres && (unsigned int)(y1+xp) < (unsigned int)ydim16)
if ((uint32_t)(x1-yp) < (uint32_t)xres && (uint32_t)(y1+xp) < (uint32_t)ydim16)
drawpixel((char *)(p-yp+xpbpl), col); // 4
if ((unsigned int)(x1-yp) < (unsigned int)xres && (unsigned int)(y1-xp) < (unsigned int)ydim16)
if ((uint32_t)(x1-yp) < (uint32_t)xres && (uint32_t)(y1-xp) < (uint32_t)ydim16)
drawpixel((char *)(p-yp-xpbpl), col); // 5
if ((unsigned int)(x1-xp) < (unsigned int)xres && (unsigned int)(y1-yp) < (unsigned int)ydim16)
if ((uint32_t)(x1-xp) < (uint32_t)xres && (uint32_t)(y1-yp) < (uint32_t)ydim16)
drawpixel((char *)(p-xp-ypbpl), col); // 6
if ((unsigned int)(x1+xp) < (unsigned int)xres && (unsigned int)(y1-yp) < (unsigned int)ydim16)
if ((uint32_t)(x1+xp) < (uint32_t)xres && (uint32_t)(y1-yp) < (uint32_t)ydim16)
drawpixel((char *)(p+xp-ypbpl), col); // 7
if ((unsigned int)(x1+yp) < (unsigned int)xres && (unsigned int)(y1-xp) < (unsigned int)ydim16)
if ((uint32_t)(x1+yp) < (uint32_t)xres && (uint32_t)(y1-xp) < (uint32_t)ydim16)
drawpixel((char *)(p+yp-xpbpl), col); // 8
}
}
10824,7 → 10824,7
enddrawing();
#else
// JonoF's rough approximation of a circle
int l,spx,spy,lpx,lpy,px,py;
int32_t l,spx,spy,lpx,lpy,px,py;
 
spx = lpx = x1+mulscale14(r,sintable[0]);
spy = lpy = y1+mulscale14(r,sintable[512]);
10911,7 → 10911,7
//
// qsetmodeany
//
void qsetmodeany(int daxdim, int daydim)
void qsetmodeany(int32_t daxdim, int32_t daydim)
{
if (daxdim < 640) daxdim = 640;
if (daydim < 480) daydim = 480;
10945,7 → 10945,7
//
void clear2dscreen(void)
{
int clearsz;
int32_t clearsz;
 
begindrawing(); //{{{
if (qsetmode == 350) clearsz = 350;
10961,7 → 10961,7
//
// draw2dgrid
//
void draw2dgrid(int posxe, int posye, short ange, int zoome, short gride)
void draw2dgrid(int32_t posxe, int32_t posye, int16_t ange, int32_t zoome, int16_t gride)
{
int64 i, xp1, yp1, xp2=0, yp2, tempy;
 
11024,14 → 11024,14
//
 
char spritecol2d[MAXTILES][2];
int showfirstwall=0;
int showheightindicators=2;
int circlewall=-1;
int32_t showfirstwall=0;
int32_t showheightindicators=2;
int32_t circlewall=-1;
 
void draw2dscreen(int posxe, int posye, short ange, int zoome, short gride)
void draw2dscreen(int32_t posxe, int32_t posye, int16_t ange, int32_t zoome, int16_t gride)
{
walltype *wal;
int i, j, xp1, yp1, xp2, yp2;
int32_t i, j, xp1, yp1, xp2, yp2;
intptr_t tempint;
char col;
 
11119,40 → 11119,40
 
drawline16(halfxdim16+xp1,midydim16+yp1,halfxdim16+xp2,midydim16+yp2,editorcolors[col]);
{
int k = getangle(xp1-xp2, yp1-yp2);
int dax = mulscale14(((wal->x+wall[wal->point2].x)>>1)-posxe,zoome);
int day = mulscale14(((wal->y+wall[wal->point2].y)>>1)-posye,zoome);
int32_t k = getangle(xp1-xp2, yp1-yp2);
int32_t dax = mulscale14(((wal->x+wall[wal->point2].x)>>1)-posxe,zoome);
int32_t day = mulscale14(((wal->y+wall[wal->point2].y)>>1)-posye,zoome);
 
if (wal->nextsector >= 0 && showheightindicators)
{
int ii = sector[sectorofwall(i)].floorz;
int jj = sector[wal->nextsector].floorz;
int32_t ii = sector[sectorofwall(i)].floorz;
int32_t jj = sector[wal->nextsector].floorz;
 
if (jj == ii && showheightindicators > 1)
{
int dax3 = mulscale11(sintable[(k+1024)&2047],zoome) / 2560;
int day3 = mulscale11(sintable[(k+512)&2047],zoome) / 2560;
int dax2 = mulscale11(sintable[(k+2048)&2047],zoome) / 2560;
int day2 = mulscale11(sintable[(k+1536)&2047],zoome) / 2560;
int32_t dax3 = mulscale11(sintable[(k+1024)&2047],zoome) / 2560;
int32_t day3 = mulscale11(sintable[(k+512)&2047],zoome) / 2560;
int32_t dax2 = mulscale11(sintable[(k+2048)&2047],zoome) / 2560;
int32_t day2 = mulscale11(sintable[(k+1536)&2047],zoome) / 2560;
drawline16(halfxdim16+dax+dax3,midydim16+day+day3,halfxdim16+dax+dax2,midydim16+day+day2,editorcolors[col]);
}
else if (jj > ii)
{
int dax2 = mulscale11(sintable[(k+1024)&2047],zoome) / 2560;
int day2 = mulscale11(sintable[(k+512)&2047],zoome) / 2560;
int32_t dax2 = mulscale11(sintable[(k+1024)&2047],zoome) / 2560;
int32_t day2 = mulscale11(sintable[(k+512)&2047],zoome) / 2560;
drawline16(halfxdim16+dax,midydim16+day,halfxdim16+dax+dax2,midydim16+day+day2,editorcolors[col]);
}
else if (jj < ii)
{
int dax2 = mulscale11(sintable[(k+2048)&2047],zoome) / 2560;
int day2 = mulscale11(sintable[(k+1536)&2047],zoome) / 2560;
int32_t dax2 = mulscale11(sintable[(k+2048)&2047],zoome) / 2560;
int32_t day2 = mulscale11(sintable[(k+1536)&2047],zoome) / 2560;
drawline16(halfxdim16+dax,midydim16+day,halfxdim16+dax+dax2,midydim16+day+day2,editorcolors[col]);
}
}
else if (showheightindicators > 1)
{
int dax2 = mulscale11(sintable[(k+2048)&2047],zoome) / 2560;
int day2 = mulscale11(sintable[(k+1536)&2047],zoome) / 2560;
int32_t dax2 = mulscale11(sintable[(k+2048)&2047],zoome) / 2560;
int32_t day2 = mulscale11(sintable[(k+1536)&2047],zoome) / 2560;
drawline16(halfxdim16+dax,midydim16+day,halfxdim16+dax+dax2,midydim16+day+day2,editorcolors[col]);
}
}
11160,7 → 11160,7
if (((halfxdim16+xp1) >= 2) && ((halfxdim16+xp1) <= xdim-3))
if (((midydim16+yp1) >= 2) && ((midydim16+yp1) <= ydim16-3))
{
int pointsize = 1;
int32_t pointsize = 1;
col = 15;
if (i == pointhighlight || ((pointhighlight < MAXWALLS) && (pointhighlight >= 0) && (wall[i].x == wall[pointhighlight].x) && (wall[i].y == wall[pointhighlight].y)))
{
11260,12 → 11260,12
 
if ((sprite[j].cstat&32) > 0)
{
int fx = mulscale10(mulscale6(tilesizx[sprite[j].picnum], sprite[j].xrepeat),zoome) >> 1;
int fy = mulscale10(mulscale6(tilesizy[sprite[j].picnum], sprite[j].yrepeat),zoome) >> 1;
int co[4][2], ii;
int sinang = sintable[(sprite[j].ang+512+1024)&2047];
int cosang = sintable[(sprite[j].ang+1024)&2047];
int r,s;
int32_t fx = mulscale10(mulscale6(tilesizx[sprite[j].picnum], sprite[j].xrepeat),zoome) >> 1;
int32_t fy = mulscale10(mulscale6(tilesizy[sprite[j].picnum], sprite[j].yrepeat),zoome) >> 1;
int32_t co[4][2], ii;
int32_t sinang = sintable[(sprite[j].ang+512+1024)&2047];
int32_t cosang = sintable[(sprite[j].ang+1024)&2047];
int32_t r,s;
 
 
co[0][0] = co[3][0] = -fx;
11307,7 → 11307,7
 
else if ((sprite[j].cstat&16) > 0)
{
int fx = mulscale6(tilesizx[sprite[j].picnum], sprite[j].xrepeat);
int32_t fx = mulscale6(tilesizx[sprite[j].picnum], sprite[j].xrepeat);
xp2 = mulscale11(sintable[(sprite[j].ang+2560)&2047],zoome) / 6144;
yp2 = mulscale11(sintable[(sprite[j].ang+2048)&2047],zoome) / 6144;
 
11372,7 → 11372,7
 
else if ((sprite[j].cstat&16) > 0)
{
int fx = mulscale6(tilesizx[sprite[j].picnum], sprite[j].xrepeat);
int32_t fx = mulscale6(tilesizx[sprite[j].picnum], sprite[j].xrepeat);
 
xp2 = mulscale11(sintable[(sprite[j].ang+2560)&2047],zoome) / 6144;
yp2 = mulscale11(sintable[(sprite[j].ang+2048)&2047],zoome) / 6144;
11391,12 → 11391,12
 
else if ((sprite[j].cstat&32) > 0)
{
int fx = mulscale10(mulscale6(tilesizx[sprite[j].picnum], sprite[j].xrepeat),zoome) >> 1;
int fy = mulscale10(mulscale6(tilesizy[sprite[j].picnum], sprite[j].yrepeat),zoome) >> 1;
int co[4][2], ii;
int sinang = sintable[(sprite[j].ang+512+1024)&2047];
int cosang = sintable[(sprite[j].ang+1024)&2047];
int r,s;
int32_t fx = mulscale10(mulscale6(tilesizx[sprite[j].picnum], sprite[j].xrepeat),zoome) >> 1;
int32_t fy = mulscale10(mulscale6(tilesizy[sprite[j].picnum], sprite[j].yrepeat),zoome) >> 1;
int32_t co[4][2], ii;
int32_t sinang = sintable[(sprite[j].ang+512+1024)&2047];
int32_t cosang = sintable[(sprite[j].ang+1024)&2047];
int32_t r,s;
 
co[0][0] = co[3][0] = -fx;
co[0][1] = co[1][1] = -fy;
11441,9 → 11441,9
//
// printext16
//
int printext16(int xpos, int ypos, short col, short backcol, char *name, char fontsize)
int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, char *name, char fontsize)
{
int stx, i, x, y, charxsiz, ocol = col, obackcol = backcol;
int32_t stx, i, x, y, charxsiz, ocol = col, obackcol = backcol;
char *fontptr, *letptr, *ptr;
char smallbuf[4];
stx = xpos;
11523,9 → 11523,9
for (x=charxsiz-1;x>=0;x--)
{
if (letptr[y]&pow2char[7-fontsize-x])
ptr[x] = (char)col;
ptr[x] = (uint8_t)col;
else if (backcol >= 0)
ptr[x] = (char)backcol;
ptr[x] = (uint8_t)backcol;
}
ptr -= bytesperline;
}
11540,9 → 11540,9
//
// printext256
//
void printext256(int xpos, int ypos, short col, short backcol, char *name, char fontsize)
void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, char *name, char fontsize)
{
int stx, i, x, y, charxsiz;
int32_t stx, i, x, y, charxsiz;
char *fontptr, *letptr, *ptr;
 
stx = xpos;
11555,8 → 11555,8
 
if (rendmode >= 3 && qsetmode == 200)
{
int xx, yy;
int lc=-1;
int32_t xx, yy;
int32_t lc=-1;
palette_t p,b;
 
if (gammabrightness)
11585,7 → 11585,7
if (name[i] == '^' && isdigit(name[i+1]))
{
char smallbuf[8];
int bi=0;
int32_t bi=0;
while (isdigit(name[i+1]) && bi<8)
{
smallbuf[bi++]=name[i+1];
11646,7 → 11646,7
if (name[i] == '^' && isdigit(name[i+1]))
{
char smallbuf[8];
int bi=0;
int32_t bi=0;
while (isdigit(name[i+1]) && bi<8)
{
smallbuf[bi++]=name[i+1];
11663,9 → 11663,9
for (x=charxsiz-1;x>=0;x--)
{
if (letptr[y]&pow2char[7-fontsize-x])
ptr[x] = (char)col;
ptr[x] = (uint8_t)col;
else if (backcol >= 0)
ptr[x] = (char)backcol;
ptr[x] = (uint8_t)backcol;
}
ptr -= ylookup[1];
}
11678,9 → 11678,9
//
// screencapture
//
int screencapture_tga(char *filename, char inverseit)
int32_t screencapture_tga(char *filename, char inverseit)
{
int i,j;
int32_t i,j;
char *ptr, head[18] = { 0,1,1,0,0,0,1,24,0,0,0,0,0/*wlo*/,0/*whi*/,0/*hlo*/,0/*hhi*/,8,0 };
//char palette[4*256];
char *fn = Bstrdup(filename), *inversebuf;
11761,7 → 11761,7
for (i=ydim-1; i>=0; i--)
{
copybuf(ptr+i*bytesperline, inversebuf, xdim >> 2);
for (j=0; j < (bytesperline>>2); j++)((int *)inversebuf)[j] ^= 0x0f0f0f0fL;
for (j=0; j < (bytesperline>>2); j++)((int32_t *)inversebuf)[j] ^= 0x0f0f0f0fL;
Bfwrite(inversebuf, xdim, 1, fil);
}
kfree(inversebuf);
11809,7 → 11809,7
}
 
// PCX is nasty, which is why I've lifted these functions from the PCX spec by ZSoft
static int writepcxbyte(char colour, unsigned char count, BFILE *fp)
static int32_t writepcxbyte(char colour, char count, BFILE *fp)
{
if (!count) return 0;
if (count == 1 && (colour & 0xc0) != 0xc0)
11825,11 → 11825,11
}
}
 
static void writepcxline(char *buf, int bytes, int step, BFILE *fp)
static void writepcxline(char *buf, int32_t bytes, int32_t step, BFILE *fp)
{
char ths, last;
int srcIndex;
unsigned char runCount;
int32_t srcIndex;
char runCount;
 
runCount = 1;
last = *buf;
11860,9 → 11860,9
if (bytes&1) writepcxbyte(0, 1, fp);
}
 
int screencapture_pcx(char *filename, char inverseit)
int32_t screencapture_pcx(char *filename, char inverseit)
{
int i,j,bpl;
int32_t i,j,bpl;
char *ptr, head[128];
//char palette[4*256];
char *fn = Bstrdup(filename), *inversebuf;
11935,7 → 11935,7
for (i=0; i<ydim; i++)
{
copybuf(ptr+i*bytesperline, inversebuf, xdim >> 2);
for (j=0; j < (bytesperline>>2); j++)((int *)inversebuf)[j] ^= 0x0f0f0f0fL;
for (j=0; j < (bytesperline>>2); j++)((int32_t *)inversebuf)[j] ^= 0x0f0f0f0fL;
writepcxline(inversebuf, xdim, 1, fil);
}
kfree(inversebuf);
11996,7 → 11996,7
return(0);
}
 
int screencapture(char *filename, char inverseit)
int32_t screencapture(char *filename, char inverseit)
{
if (captureformat == 0) return screencapture_tga(filename,inverseit);
else return screencapture_pcx(filename,inverseit);
12007,7 → 12007,7
//
// setrendermode
//
int setrendermode(int renderer)
int32_t setrendermode(int32_t renderer)
{
UNREFERENCED_PARAMETER(renderer);
#ifdef POLYMOST
12030,7 → 12030,7
//
// getrendermode
//
int getrendermode(void)
int32_t getrendermode(void)
{
#ifndef POLYMOST
return 0;
12044,7 → 12044,7
// setrollangle
//
#ifdef POLYMOST
void setrollangle(int rolla)
void setrollangle(int32_t rolla)
{
UNREFERENCED_PARAMETER(rolla);
if (rolla == 0) gtang = 0.0;
12067,11 → 12067,11
// bit 7: ignored (67% translucence, using clamping)
// clamping is for sprites, repeating is for walls
//
void invalidatetile(short tilenume, int pal, int how)
void invalidatetile(int16_t tilenume, int32_t pal, int32_t how)
{
#if defined(POLYMOST) && defined(USE_OPENGL)
int numpal, firstpal, np;
int hp;
int32_t numpal, firstpal, np;
int32_t hp;
 
if (rendmode < 3) return;