mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 11:10:39 +00:00
- removed unused subprojects.
# Conflicts: # source/kenbuild/src/StartupWinController.game.mm # source/kenbuild/src/bstub.cpp # source/kenbuild/src/common.cpp # source/kenbuild/src/config.cpp # source/kenbuild/src/game.cpp # source/kenbuild/src/game.h # source/kenbuild/src/startgtk.game.cpp # source/kenbuild/src/startwin.game.cpp # source/tools/src/wad2map.cpp
This commit is contained in:
parent
625586b729
commit
129cf2c76f
79 changed files with 0 additions and 26068 deletions
|
@ -1,2 +0,0 @@
|
|||
Bartosz Taudul <wolf.pld@gmail.com>
|
||||
Daniel Jungmann <el.3d.source@gmail.com>
|
|
@ -1,24 +0,0 @@
|
|||
Copyright (c) 2013, Bartosz Taudul <wolf.pld@gmail.com>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the <organization> nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -1,21 +0,0 @@
|
|||
#ifndef PROCESSRGB_H_
|
||||
#define PROCESSRGB_H_
|
||||
|
||||
#if !defined __cplusplus || __cplusplus < 201103L
|
||||
# include <stdint.h>
|
||||
#else
|
||||
# include <cstdint>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
uint64_t ProcessRGB( const uint8_t * src );
|
||||
uint64_t ProcessRGB_ETC2( const uint8_t * src );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,96 +0,0 @@
|
|||
#ifndef DARKRL__MATH_HPP__
|
||||
#define DARKRL__MATH_HPP__
|
||||
|
||||
#if defined __GNUC__
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
#endif
|
||||
#include <algorithm>
|
||||
#if defined __GNUC__
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#include "Types.hpp"
|
||||
|
||||
template<typename T>
|
||||
inline T AlignPOT( T val )
|
||||
{
|
||||
if( val == 0 ) return 1;
|
||||
val--;
|
||||
for( unsigned int i=1; i<sizeof( T ) * 8; i <<= 1 )
|
||||
{
|
||||
val |= val >> i;
|
||||
}
|
||||
return val + 1;
|
||||
}
|
||||
|
||||
inline int CountSetBits( uint32 val )
|
||||
{
|
||||
val -= ( val >> 1 ) & 0x55555555;
|
||||
val = ( ( val >> 2 ) & 0x33333333 ) + ( val & 0x33333333 );
|
||||
val = ( ( val >> 4 ) + val ) & 0x0f0f0f0f;
|
||||
val += val >> 8;
|
||||
val += val >> 16;
|
||||
return val & 0x0000003f;
|
||||
}
|
||||
|
||||
inline int CountLeadingZeros( uint32 val )
|
||||
{
|
||||
val |= val >> 1;
|
||||
val |= val >> 2;
|
||||
val |= val >> 4;
|
||||
val |= val >> 8;
|
||||
val |= val >> 16;
|
||||
return 32 - CountSetBits( val );
|
||||
}
|
||||
|
||||
inline float sRGB2linear( float v )
|
||||
{
|
||||
const float a = 0.055f;
|
||||
if( v <= 0.04045f )
|
||||
{
|
||||
return v / 12.92f;
|
||||
}
|
||||
else
|
||||
{
|
||||
return pow( ( v + a ) / ( 1 + a ), 2.4f );
|
||||
}
|
||||
}
|
||||
|
||||
inline float linear2sRGB( float v )
|
||||
{
|
||||
const float a = 0.055f;
|
||||
if( v <= 0.0031308f )
|
||||
{
|
||||
return 12.92f * v;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ( 1 + a ) * pow( v, 1/2.4f ) - a;
|
||||
}
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline T SmoothStep( T x )
|
||||
{
|
||||
return x*x*(3-2*x);
|
||||
}
|
||||
|
||||
inline uint8 clampu8( int32 val )
|
||||
{
|
||||
return std::min( std::max( 0, val ), 255 );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline T sq( T val )
|
||||
{
|
||||
return val * val;
|
||||
}
|
||||
|
||||
static inline int mul8bit( int a, int b )
|
||||
{
|
||||
int t = a*b + 128;
|
||||
return ( t + ( t >> 8 ) ) >> 8;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,51 +0,0 @@
|
|||
#ifndef PROCESSCOMMON_HPP__
|
||||
#define PROCESSCOMMON_HPP__
|
||||
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "Types.hpp"
|
||||
|
||||
template<class T>
|
||||
static size_t GetLeastError( const T* err, size_t num )
|
||||
{
|
||||
size_t idx = 0;
|
||||
for( size_t i=1; i<num; i++ )
|
||||
{
|
||||
if( err[i] < err[idx] )
|
||||
{
|
||||
idx = i;
|
||||
}
|
||||
}
|
||||
return idx;
|
||||
}
|
||||
|
||||
static uint64 FixByteOrder( uint64 d )
|
||||
{
|
||||
return ( ( d & 0x00000000FFFFFFFF ) ) |
|
||||
( ( d & 0xFF00000000000000 ) >> 24 ) |
|
||||
( ( d & 0x000000FF00000000 ) << 24 ) |
|
||||
( ( d & 0x00FF000000000000 ) >> 8 ) |
|
||||
( ( d & 0x0000FF0000000000 ) << 8 );
|
||||
}
|
||||
|
||||
template<class T, class S>
|
||||
static uint64 EncodeSelectors( uint64 d, const T terr[2][8], const S tsel[16][8], const uint32* id )
|
||||
{
|
||||
size_t tidx[2];
|
||||
tidx[0] = GetLeastError( terr[0], 8 );
|
||||
tidx[1] = GetLeastError( terr[1], 8 );
|
||||
|
||||
d |= tidx[0] << 26;
|
||||
d |= tidx[1] << 29;
|
||||
for( int i=0; i<16; i++ )
|
||||
{
|
||||
uint64 t = tsel[i][tidx[id[i]%2]];
|
||||
d |= ( t & 0x1 ) << ( i + 32 );
|
||||
d |= ( t & 0x2 ) << ( i + 47 );
|
||||
}
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,470 +0,0 @@
|
|||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "Math.hpp"
|
||||
#include "ProcessCommon.hpp"
|
||||
#include "ProcessRGB.h"
|
||||
#include "Tables.hpp"
|
||||
#include "Types.hpp"
|
||||
#include "Vector.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
static inline uint32 byteswap(uint32 l)
|
||||
{
|
||||
return ((l >> 8u) & 0xff00u) | ((l & 0xff00u) << 8u) | (l << 24u) | (l >> 24u);
|
||||
}
|
||||
|
||||
template<typename T, size_t size>
|
||||
struct simple_array
|
||||
{
|
||||
simple_array()
|
||||
{
|
||||
memset(data, 0, sizeof(data));
|
||||
}
|
||||
|
||||
T operator [](size_t i) const
|
||||
{
|
||||
return data[i];
|
||||
}
|
||||
T & operator [](size_t i)
|
||||
{
|
||||
return data[i];
|
||||
}
|
||||
|
||||
protected:
|
||||
T data[size];
|
||||
};
|
||||
|
||||
typedef simple_array<uint16, 4> v4i;
|
||||
|
||||
void Average( const uint8* data, v4i* a )
|
||||
{
|
||||
uint32 r[4];
|
||||
uint32 g[4];
|
||||
uint32 b[4];
|
||||
|
||||
memset(r, 0, sizeof(r));
|
||||
memset(g, 0, sizeof(g));
|
||||
memset(b, 0, sizeof(b));
|
||||
|
||||
for( int j=0; j<4; j++ )
|
||||
{
|
||||
for( int i=0; i<4; i++ )
|
||||
{
|
||||
int index = (j & 2) + (i >> 1);
|
||||
r[index] += *data++;
|
||||
g[index] += *data++;
|
||||
b[index] += *data++;
|
||||
data++;
|
||||
}
|
||||
}
|
||||
|
||||
a[0][0] = uint16( (r[2] + r[3] + 4) / 8 );
|
||||
a[0][1] = uint16( (g[2] + g[3] + 4) / 8 );
|
||||
a[0][2] = uint16( (b[2] + b[3] + 4) / 8 );
|
||||
a[0][3] = 0;
|
||||
a[1][0] = uint16( (r[0] + r[1] + 4) / 8 );
|
||||
a[1][1] = uint16( (g[0] + g[1] + 4) / 8 );
|
||||
a[1][2] = uint16( (b[0] + b[1] + 4) / 8 );
|
||||
a[1][3] = 0;
|
||||
a[2][0] = uint16( (r[1] + r[3] + 4) / 8 );
|
||||
a[2][1] = uint16( (g[1] + g[3] + 4) / 8 );
|
||||
a[2][2] = uint16( (b[1] + b[3] + 4) / 8 );
|
||||
a[2][3] = 0;
|
||||
a[3][0] = uint16( (r[0] + r[2] + 4) / 8 );
|
||||
a[3][1] = uint16( (g[0] + g[2] + 4) / 8 );
|
||||
a[3][2] = uint16( (b[0] + b[2] + 4) / 8 );
|
||||
a[3][3] = 0;
|
||||
}
|
||||
|
||||
void CalcErrorBlock( const uint8* data, uint err[4][4] )
|
||||
{
|
||||
uint terr[4][4];
|
||||
|
||||
memset(terr, 0, 16 * sizeof(uint));
|
||||
|
||||
for( int j=0; j<4; j++ )
|
||||
{
|
||||
for( int i=0; i<4; i++ )
|
||||
{
|
||||
int index = (j & 2) + (i >> 1);
|
||||
uint d = *data++;
|
||||
terr[index][0] += d;
|
||||
d = *data++;
|
||||
terr[index][1] += d;
|
||||
d = *data++;
|
||||
terr[index][2] += d;
|
||||
data++;
|
||||
}
|
||||
}
|
||||
|
||||
for( int i=0; i<3; i++ )
|
||||
{
|
||||
err[0][i] = terr[2][i] + terr[3][i];
|
||||
err[1][i] = terr[0][i] + terr[1][i];
|
||||
err[2][i] = terr[1][i] + terr[3][i];
|
||||
err[3][i] = terr[0][i] + terr[2][i];
|
||||
}
|
||||
for( int i=0; i<4; i++ )
|
||||
{
|
||||
err[i][3] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint CalcError( const uint block[4], const v4i& average )
|
||||
{
|
||||
uint err = 0x3FFFFFFF; // Big value to prevent negative values, but small enough to prevent overflow
|
||||
err -= block[0] * 2 * average[0];
|
||||
err -= block[1] * 2 * average[1];
|
||||
err -= block[2] * 2 * average[2];
|
||||
err += 8 * ( sq( average[0] ) + sq( average[1] ) + sq( average[2] ) );
|
||||
return err;
|
||||
}
|
||||
|
||||
void ProcessAverages( v4i* a )
|
||||
{
|
||||
for( int i=0; i<2; i++ )
|
||||
{
|
||||
for( int j=0; j<3; j++ )
|
||||
{
|
||||
int32 c1 = mul8bit( a[i*2+1][j], 31 );
|
||||
int32 c2 = mul8bit( a[i*2][j], 31 );
|
||||
|
||||
int32 diff = c2 - c1;
|
||||
if( diff > 3 ) diff = 3;
|
||||
else if( diff < -4 ) diff = -4;
|
||||
|
||||
int32 co = c1 + diff;
|
||||
|
||||
a[5+i*2][j] = ( c1 << 3 ) | ( c1 >> 2 );
|
||||
a[4+i*2][j] = ( co << 3 ) | ( co >> 2 );
|
||||
}
|
||||
}
|
||||
|
||||
for( int i=0; i<4; i++ )
|
||||
{
|
||||
a[i][0] = g_avg2[mul8bit( a[i][0], 15 )];
|
||||
a[i][1] = g_avg2[mul8bit( a[i][1], 15 )];
|
||||
a[i][2] = g_avg2[mul8bit( a[i][2], 15 )];
|
||||
}
|
||||
}
|
||||
|
||||
void EncodeAverages( uint64& _d, const v4i* a, size_t idx )
|
||||
{
|
||||
auto d = _d;
|
||||
d |= ( idx << 24 );
|
||||
size_t base = idx << 1;
|
||||
|
||||
if( ( idx & 0x2 ) == 0 )
|
||||
{
|
||||
for( int i=0; i<3; i++ )
|
||||
{
|
||||
d |= uint64( a[base+0][i] >> 4 ) << ( i*8 );
|
||||
d |= uint64( a[base+1][i] >> 4 ) << ( i*8 + 4 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for( int i=0; i<3; i++ )
|
||||
{
|
||||
d |= uint64( a[base+1][i] & 0xF8 ) << ( i*8 );
|
||||
int32 c = ( ( a[base+0][i] & 0xF8 ) - ( a[base+1][i] & 0xF8 ) ) >> 3;
|
||||
c &= ~0xFFFFFFF8;
|
||||
d |= ((uint64)c) << ( i*8 );
|
||||
}
|
||||
}
|
||||
_d = d;
|
||||
}
|
||||
|
||||
uint64 CheckSolid( const uint8* src )
|
||||
{
|
||||
const uint8* ptr = src + 4;
|
||||
for( int i=1; i<16; i++ )
|
||||
{
|
||||
if( memcmp( src, ptr, 4 ) != 0 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
ptr += 4;
|
||||
}
|
||||
|
||||
return 0x02000000 |
|
||||
( uint( src[0] & 0xF8 ) ) |
|
||||
( uint( src[1] & 0xF8 ) << 8 ) |
|
||||
( uint( src[2] & 0xF8 ) << 16 );
|
||||
}
|
||||
|
||||
void PrepareAverages( v4i a[8], const uint8* src, uint err[4] )
|
||||
{
|
||||
Average( src, a );
|
||||
ProcessAverages( a );
|
||||
|
||||
uint errblock[4][4];
|
||||
CalcErrorBlock( src, errblock );
|
||||
|
||||
for( int i=0; i<4; i++ )
|
||||
{
|
||||
err[i/2] += CalcError( errblock[i], a[i] );
|
||||
err[2+i/2] += CalcError( errblock[i], a[i+4] );
|
||||
}
|
||||
}
|
||||
|
||||
void FindBestFit( uint64 terr[2][8], uint16 tsel[16][8], v4i a[8], const uint32* id, const uint8* data )
|
||||
{
|
||||
for( size_t i=0; i<16; i++ )
|
||||
{
|
||||
uint16* sel = tsel[i];
|
||||
uint bid = id[i];
|
||||
uint64* ter = terr[bid%2];
|
||||
|
||||
uint8 r = *data++;
|
||||
uint8 g = *data++;
|
||||
uint8 b = *data++;
|
||||
data++;
|
||||
|
||||
int dr = a[bid][0] - r;
|
||||
int dg = a[bid][1] - g;
|
||||
int db = a[bid][2] - b;
|
||||
|
||||
int pix = dr * 77 + dg * 151 + db * 28;
|
||||
|
||||
for( int t=0; t<8; t++ )
|
||||
{
|
||||
const int64* tab = g_table256[t];
|
||||
uint idx = 0;
|
||||
uint64 err = sq( tab[0] + pix );
|
||||
for( int j=1; j<4; j++ )
|
||||
{
|
||||
uint64 local = sq( tab[j] + pix );
|
||||
if( local < err )
|
||||
{
|
||||
err = local;
|
||||
idx = j;
|
||||
}
|
||||
}
|
||||
*sel++ = idx;
|
||||
*ter++ += err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t convert6(float f)
|
||||
{
|
||||
int i = (std::min(std::max(static_cast<int>(f), 0), 1023) - 15) >> 1;
|
||||
return (i + 11 - ((i + 11) >> 7) - ((i + 4) >> 7)) >> 3;
|
||||
}
|
||||
|
||||
uint8_t convert7(float f)
|
||||
{
|
||||
int i = (std::min(std::max(static_cast<int>(f), 0), 1023) - 15) >> 1;
|
||||
return (i + 9 - ((i + 9) >> 8) - ((i + 6) >> 8)) >> 2;
|
||||
}
|
||||
|
||||
std::pair<uint64, uint64> Planar(const uint8* src)
|
||||
{
|
||||
int32 r = 0;
|
||||
int32 g = 0;
|
||||
int32 b = 0;
|
||||
|
||||
for (int i = 0; i < 16; ++i)
|
||||
{
|
||||
r += src[i * 4 + 0];
|
||||
g += src[i * 4 + 1];
|
||||
b += src[i * 4 + 2];
|
||||
}
|
||||
|
||||
int32 difRyz = 0;
|
||||
int32 difGyz = 0;
|
||||
int32 difByz = 0;
|
||||
int32 difRxz = 0;
|
||||
int32 difGxz = 0;
|
||||
int32 difBxz = 0;
|
||||
|
||||
const int32 scaling[] = { -255, -85, 85, 255 };
|
||||
|
||||
for (int i = 0; i < 16; ++i)
|
||||
{
|
||||
int32 difR = (static_cast<int>(src[i * 4 + 0]) << 4) - r;
|
||||
int32 difG = (static_cast<int>(src[i * 4 + 1]) << 4) - g;
|
||||
int32 difB = (static_cast<int>(src[i * 4 + 2]) << 4) - b;
|
||||
|
||||
difRyz += difR * scaling[i % 4];
|
||||
difGyz += difG * scaling[i % 4];
|
||||
difByz += difB * scaling[i % 4];
|
||||
|
||||
difRxz += difR * scaling[i / 4];
|
||||
difGxz += difG * scaling[i / 4];
|
||||
difBxz += difB * scaling[i / 4];
|
||||
}
|
||||
|
||||
const float scale = -4.0f / ((255 * 255 * 8.0f + 85 * 85 * 8.0f) * 16.0f);
|
||||
|
||||
float aR = difRxz * scale;
|
||||
float aG = difGxz * scale;
|
||||
float aB = difBxz * scale;
|
||||
|
||||
float bR = difRyz * scale;
|
||||
float bG = difGyz * scale;
|
||||
float bB = difByz * scale;
|
||||
|
||||
float dR = r * (4.0f / 16.0f);
|
||||
float dG = g * (4.0f / 16.0f);
|
||||
float dB = b * (4.0f / 16.0f);
|
||||
|
||||
// calculating the three colors RGBO, RGBH, and RGBV. RGB = df - af * x - bf * y;
|
||||
float cofR = fma(aR, 255.0f, fma(bR, 255.0f, dR));
|
||||
float cofG = fma(aG, 255.0f, fma(bG, 255.0f, dG));
|
||||
float cofB = fma(aB, 255.0f, fma(bB, 255.0f, dB));
|
||||
float chfR = fma(aR, -425.0f, fma(bR, 255.0f, dR));
|
||||
float chfG = fma(aG, -425.0f, fma(bG, 255.0f, dG));
|
||||
float chfB = fma(aB, -425.0f, fma(bB, 255.0f, dB));
|
||||
float cvfR = fma(aR, 255.0f, fma(bR, -425.0f, dR));
|
||||
float cvfG = fma(aG, 255.0f, fma(bG, -425.0f, dG));
|
||||
float cvfB = fma(aB, 255.0f, fma(bB, -425.0f, dB));
|
||||
|
||||
// convert to r6g7b6
|
||||
int32 coR = convert6(cofR);
|
||||
int32 coG = convert7(cofG);
|
||||
int32 coB = convert6(cofB);
|
||||
int32 chR = convert6(chfR);
|
||||
int32 chG = convert7(chfG);
|
||||
int32 chB = convert6(chfB);
|
||||
int32 cvR = convert6(cvfR);
|
||||
int32 cvG = convert7(cvfG);
|
||||
int32 cvB = convert6(cvfB);
|
||||
|
||||
// Error calculation
|
||||
auto ro0 = coR;
|
||||
auto go0 = coG;
|
||||
auto bo0 = coB;
|
||||
auto ro1 = (ro0 >> 4) | (ro0 << 2);
|
||||
auto go1 = (go0 >> 6) | (go0 << 1);
|
||||
auto bo1 = (bo0 >> 4) | (bo0 << 2);
|
||||
auto ro2 = (ro1 << 2) + 2;
|
||||
auto go2 = (go1 << 2) + 2;
|
||||
auto bo2 = (bo1 << 2) + 2;
|
||||
|
||||
auto rh0 = chR;
|
||||
auto gh0 = chG;
|
||||
auto bh0 = chB;
|
||||
auto rh1 = (rh0 >> 4) | (rh0 << 2);
|
||||
auto gh1 = (gh0 >> 6) | (gh0 << 1);
|
||||
auto bh1 = (bh0 >> 4) | (bh0 << 2);
|
||||
|
||||
auto rh2 = rh1 - ro1;
|
||||
auto gh2 = gh1 - go1;
|
||||
auto bh2 = bh1 - bo1;
|
||||
|
||||
auto rv0 = cvR;
|
||||
auto gv0 = cvG;
|
||||
auto bv0 = cvB;
|
||||
auto rv1 = (rv0 >> 4) | (rv0 << 2);
|
||||
auto gv1 = (gv0 >> 6) | (gv0 << 1);
|
||||
auto bv1 = (bv0 >> 4) | (bv0 << 2);
|
||||
|
||||
auto rv2 = rv1 - ro1;
|
||||
auto gv2 = gv1 - go1;
|
||||
auto bv2 = bv1 - bo1;
|
||||
|
||||
uint64 error = 0;
|
||||
|
||||
for (int i = 0; i < 16; ++i)
|
||||
{
|
||||
int32 cR = clampu8((rh2 * (i / 4) + rv2 * (i % 4) + ro2) >> 2);
|
||||
int32 cG = clampu8((gh2 * (i / 4) + gv2 * (i % 4) + go2) >> 2);
|
||||
int32 cB = clampu8((bh2 * (i / 4) + bv2 * (i % 4) + bo2) >> 2);
|
||||
|
||||
int32 difR = static_cast<int>(src[i * 4 + 0]) - cR;
|
||||
int32 difG = static_cast<int>(src[i * 4 + 1]) - cG;
|
||||
int32 difB = static_cast<int>(src[i * 4 + 2]) - cB;
|
||||
|
||||
int32 dif = difR * 38 + difG * 76 + difB * 14;
|
||||
|
||||
error += dif * dif;
|
||||
}
|
||||
|
||||
/**/
|
||||
uint32 rgbv = cvB | (cvG << 6) | (cvR << 13);
|
||||
uint32 rgbh = chB | (chG << 6) | (chR << 13);
|
||||
uint32 hi = rgbv | ((rgbh & 0x1FFF) << 19);
|
||||
uint32 lo = (chR & 0x1) | 0x2 | ((chR << 1) & 0x7C);
|
||||
lo |= ((coB & 0x07) << 7) | ((coB & 0x18) << 8) | ((coB & 0x20) << 11);
|
||||
lo |= ((coG & 0x3F) << 17) | ((coG & 0x40) << 18);
|
||||
lo |= coR << 25;
|
||||
|
||||
const auto idx = (coR & 0x20) | ((coG & 0x20) >> 1) | ((coB & 0x1E) >> 1);
|
||||
|
||||
lo |= g_flags[idx];
|
||||
|
||||
uint64 result = static_cast<uint32>(byteswap(lo));
|
||||
result |= static_cast<uint64>(static_cast<uint32>(byteswap(hi))) << 32;
|
||||
|
||||
return std::make_pair(result, error);
|
||||
}
|
||||
|
||||
template<class T, class S>
|
||||
uint64 EncodeSelectors( uint64 d, const T terr[2][8], const S tsel[16][8], const uint32* id, const uint64 value, const uint64 error)
|
||||
{
|
||||
size_t tidx[2];
|
||||
tidx[0] = GetLeastError( terr[0], 8 );
|
||||
tidx[1] = GetLeastError( terr[1], 8 );
|
||||
|
||||
if ((terr[0][tidx[0]] + terr[1][tidx[1]]) >= error)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
d |= tidx[0] << 26;
|
||||
d |= tidx[1] << 29;
|
||||
for( int i=0; i<16; i++ )
|
||||
{
|
||||
uint64 t = tsel[i][tidx[id[i]%2]];
|
||||
d |= ( t & 0x1 ) << ( i + 32 );
|
||||
d |= ( t & 0x2 ) << ( i + 47 );
|
||||
}
|
||||
|
||||
return FixByteOrder(d);
|
||||
}
|
||||
}
|
||||
|
||||
uint64 ProcessRGB( const uint8* src )
|
||||
{
|
||||
uint64 d = CheckSolid( src );
|
||||
if( d != 0 ) return d;
|
||||
|
||||
v4i a[8];
|
||||
uint err[4] = {};
|
||||
PrepareAverages( a, src, err );
|
||||
size_t idx = GetLeastError( err, 4 );
|
||||
EncodeAverages( d, a, idx );
|
||||
|
||||
uint64 terr[2][8] = {};
|
||||
uint16 tsel[16][8];
|
||||
auto id = g_id[idx];
|
||||
FindBestFit( terr, tsel, a, id, src );
|
||||
|
||||
return FixByteOrder( EncodeSelectors( d, terr, tsel, id ) );
|
||||
}
|
||||
|
||||
uint64 ProcessRGB_ETC2( const uint8* src )
|
||||
{
|
||||
auto result = Planar( src );
|
||||
|
||||
uint64 d = 0;
|
||||
|
||||
v4i a[8];
|
||||
uint err[4] = {};
|
||||
PrepareAverages( a, src, err );
|
||||
size_t idx = GetLeastError( err, 4 );
|
||||
EncodeAverages( d, a, idx );
|
||||
|
||||
uint64 terr[2][8] = {};
|
||||
uint16 tsel[16][8];
|
||||
auto id = g_id[idx];
|
||||
FindBestFit( terr, tsel, a, id, src );
|
||||
|
||||
return EncodeSelectors( d, terr, tsel, id, result.first, result.second );
|
||||
}
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
#include "Tables.hpp"
|
||||
|
||||
const int32 g_table[8][4] = {
|
||||
{ 2, 8, -2, -8 },
|
||||
{ 5, 17, -5, -17 },
|
||||
{ 9, 29, -9, -29 },
|
||||
{ 13, 42, -13, -42 },
|
||||
{ 18, 60, -18, -60 },
|
||||
{ 24, 80, -24, -80 },
|
||||
{ 33, 106, -33, -106 },
|
||||
{ 47, 183, -47, -183 }
|
||||
};
|
||||
|
||||
const int64 g_table256[8][4] = {
|
||||
{ 2*256, 8*256, -2*256, -8*256 },
|
||||
{ 5*256, 17*256, -5*256, -17*256 },
|
||||
{ 9*256, 29*256, -9*256, -29*256 },
|
||||
{ 13*256, 42*256, -13*256, -42*256 },
|
||||
{ 18*256, 60*256, -18*256, -60*256 },
|
||||
{ 24*256, 80*256, -24*256, -80*256 },
|
||||
{ 33*256, 106*256, -33*256, -106*256 },
|
||||
{ 47*256, 183*256, -47*256, -183*256 }
|
||||
};
|
||||
|
||||
const uint32 g_id[4][16] = {
|
||||
{ 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2 },
|
||||
{ 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4 },
|
||||
{ 7, 7, 6, 6, 7, 7, 6, 6, 7, 7, 6, 6, 7, 7, 6, 6 }
|
||||
};
|
||||
|
||||
const uint32 g_avg2[16] = {
|
||||
0x00,
|
||||
0x11,
|
||||
0x22,
|
||||
0x33,
|
||||
0x44,
|
||||
0x55,
|
||||
0x66,
|
||||
0x77,
|
||||
0x88,
|
||||
0x99,
|
||||
0xAA,
|
||||
0xBB,
|
||||
0xCC,
|
||||
0xDD,
|
||||
0xEE,
|
||||
0xFF
|
||||
};
|
||||
|
||||
const uint32 g_flags[64] = {
|
||||
0x80800402, 0x80800402, 0x80800402, 0x80800402,
|
||||
0x80800402, 0x80800402, 0x80800402, 0x8080E002,
|
||||
0x80800402, 0x80800402, 0x8080E002, 0x8080E002,
|
||||
0x80800402, 0x8080E002, 0x8080E002, 0x8080E002,
|
||||
0x80000402, 0x80000402, 0x80000402, 0x80000402,
|
||||
0x80000402, 0x80000402, 0x80000402, 0x8000E002,
|
||||
0x80000402, 0x80000402, 0x8000E002, 0x8000E002,
|
||||
0x80000402, 0x8000E002, 0x8000E002, 0x8000E002,
|
||||
0x00800402, 0x00800402, 0x00800402, 0x00800402,
|
||||
0x00800402, 0x00800402, 0x00800402, 0x0080E002,
|
||||
0x00800402, 0x00800402, 0x0080E002, 0x0080E002,
|
||||
0x00800402, 0x0080E002, 0x0080E002, 0x0080E002,
|
||||
0x00000402, 0x00000402, 0x00000402, 0x00000402,
|
||||
0x00000402, 0x00000402, 0x00000402, 0x0000E002,
|
||||
0x00000402, 0x00000402, 0x0000E002, 0x0000E002,
|
||||
0x00000402, 0x0000E002, 0x0000E002, 0x0000E002
|
||||
};
|
|
@ -1,15 +0,0 @@
|
|||
#ifndef TABLES_HPP__
|
||||
#define TABLES_HPP__
|
||||
|
||||
#include "Types.hpp"
|
||||
|
||||
extern const int32 g_table[8][4];
|
||||
extern const int64 g_table256[8][4];
|
||||
|
||||
extern const uint32 g_id[4][16];
|
||||
|
||||
extern const uint32 g_avg2[16];
|
||||
|
||||
extern const uint32 g_flags[64];
|
||||
|
||||
#endif
|
|
@ -1,21 +0,0 @@
|
|||
#ifndef DARKRL__TYPES_HPP__
|
||||
#define DARKRL__TYPES_HPP__
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
# include <stdint.h>
|
||||
#else
|
||||
# include <cstdint>
|
||||
#endif
|
||||
|
||||
typedef int8_t int8;
|
||||
typedef uint8_t uint8;
|
||||
typedef int16_t int16;
|
||||
typedef uint16_t uint16;
|
||||
typedef int32_t int32;
|
||||
typedef uint32_t uint32;
|
||||
typedef int64_t int64;
|
||||
typedef uint64_t uint64;
|
||||
|
||||
typedef unsigned int uint;
|
||||
|
||||
#endif
|
|
@ -1,222 +0,0 @@
|
|||
#ifndef DARKRL__VECTOR_HPP__
|
||||
#define DARKRL__VECTOR_HPP__
|
||||
|
||||
#include <assert.h>
|
||||
#include <algorithm>
|
||||
#include <math.h>
|
||||
|
||||
#include "Math.hpp"
|
||||
#include "Types.hpp"
|
||||
|
||||
template<class T>
|
||||
struct Vector2
|
||||
{
|
||||
Vector2() : x( 0 ), y( 0 ) {}
|
||||
Vector2( T v ) : x( v ), y( v ) {}
|
||||
Vector2( T _x, T _y ) : x( _x ), y( _y ) {}
|
||||
|
||||
bool operator==( const Vector2<T>& rhs ) const { return x == rhs.x && y == rhs.y; }
|
||||
bool operator!=( const Vector2<T>& rhs ) const { return !( *this == rhs ); }
|
||||
|
||||
Vector2<T>& operator+=( const Vector2<T>& rhs )
|
||||
{
|
||||
x += rhs.x;
|
||||
y += rhs.y;
|
||||
return *this;
|
||||
}
|
||||
Vector2<T>& operator-=( const Vector2<T>& rhs )
|
||||
{
|
||||
x -= rhs.x;
|
||||
y -= rhs.y;
|
||||
return *this;
|
||||
}
|
||||
Vector2<T>& operator*=( const Vector2<T>& rhs )
|
||||
{
|
||||
x *= rhs.x;
|
||||
y *= rhs.y;
|
||||
return *this;
|
||||
}
|
||||
|
||||
T x, y;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
Vector2<T> operator+( const Vector2<T>& lhs, const Vector2<T>& rhs )
|
||||
{
|
||||
return Vector2<T>( lhs.x + rhs.x, lhs.y + rhs.y );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Vector2<T> operator-( const Vector2<T>& lhs, const Vector2<T>& rhs )
|
||||
{
|
||||
return Vector2<T>( lhs.x - rhs.x, lhs.y - rhs.y );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Vector2<T> operator*( const Vector2<T>& lhs, const float& rhs )
|
||||
{
|
||||
return Vector2<T>( lhs.x * rhs, lhs.y * rhs );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Vector2<T> operator/( const Vector2<T>& lhs, const T& rhs )
|
||||
{
|
||||
return Vector2<T>( lhs.x / rhs, lhs.y / rhs );
|
||||
}
|
||||
|
||||
|
||||
typedef Vector2<int32> v2i;
|
||||
typedef Vector2<float> v2f;
|
||||
|
||||
|
||||
template<class T>
|
||||
struct Vector3
|
||||
{
|
||||
Vector3() : x( 0 ), y( 0 ), z( 0 ) {}
|
||||
Vector3( T v ) : x( v ), y( v ), z( v ) {}
|
||||
Vector3( T _x, T _y, T _z ) : x( _x ), y( _y ), z( _z ) {}
|
||||
template<class Y>
|
||||
Vector3( const Vector3<Y>& v ) : x( T( v.x ) ), y( T( v.y ) ), z( T( v.z ) ) {}
|
||||
|
||||
T Luminance() const { return T( x * 0.3f + y * 0.59f + z * 0.11f ); }
|
||||
void Clamp()
|
||||
{
|
||||
x = std::min( T(1), std::max( T(0), x ) );
|
||||
y = std::min( T(1), std::max( T(0), y ) );
|
||||
z = std::min( T(1), std::max( T(0), z ) );
|
||||
}
|
||||
|
||||
bool operator==( const Vector3<T>& rhs ) const { return x == rhs.x && y == rhs.y && z == rhs.z; }
|
||||
bool operator!=( const Vector2<T>& rhs ) const { return !( *this == rhs ); }
|
||||
|
||||
T& operator[]( uint idx ) { assert( idx < 3 ); return ((T*)this)[idx]; }
|
||||
const T& operator[]( uint idx ) const { assert( idx < 3 ); return ((T*)this)[idx]; }
|
||||
|
||||
Vector3<T> operator+=( const Vector3<T>& rhs )
|
||||
{
|
||||
x += rhs.x;
|
||||
y += rhs.y;
|
||||
z += rhs.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Vector3<T> operator*=( const Vector3<T>& rhs )
|
||||
{
|
||||
x *= rhs.x;
|
||||
y *= rhs.y;
|
||||
z *= rhs.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Vector3<T> operator*=( const float& rhs )
|
||||
{
|
||||
x *= rhs;
|
||||
y *= rhs;
|
||||
z *= rhs;
|
||||
return *this;
|
||||
}
|
||||
|
||||
T x, y, z;
|
||||
T padding;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
Vector3<T> operator+( const Vector3<T>& lhs, const Vector3<T>& rhs )
|
||||
{
|
||||
return Vector3<T>( lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Vector3<T> operator-( const Vector3<T>& lhs, const Vector3<T>& rhs )
|
||||
{
|
||||
return Vector3<T>( lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Vector3<T> operator*( const Vector3<T>& lhs, const Vector3<T>& rhs )
|
||||
{
|
||||
return Vector3<T>( lhs.x * rhs.x, lhs.y * rhs.y, lhs.z * rhs.z );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Vector3<T> operator*( const Vector3<T>& lhs, const float& rhs )
|
||||
{
|
||||
return Vector3<T>( T( lhs.x * rhs ), T( lhs.y * rhs ), T( lhs.z * rhs ) );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Vector3<T> operator/( const Vector3<T>& lhs, const T& rhs )
|
||||
{
|
||||
return Vector3<T>( lhs.x / rhs, lhs.y / rhs, lhs.z / rhs );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
bool operator<( const Vector3<T>& lhs, const Vector3<T>& rhs )
|
||||
{
|
||||
return lhs.Luminance() < rhs.Luminance();
|
||||
}
|
||||
|
||||
typedef Vector3<int32> v3i;
|
||||
typedef Vector3<float> v3f;
|
||||
typedef Vector3<uint8> v3b;
|
||||
|
||||
|
||||
static inline v3b v3f_to_v3b( const v3f& v )
|
||||
{
|
||||
return v3b( uint8( std::min( 1.f, v.x ) * 255 ), uint8( std::min( 1.f, v.y ) * 255 ), uint8( std::min( 1.f, v.z ) * 255 ) );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Vector3<T> Mix( const Vector3<T>& v1, const Vector3<T>& v2, float amount )
|
||||
{
|
||||
return v1 + ( v2 - v1 ) * amount;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline v3b Mix( const v3b& v1, const v3b& v2, float amount )
|
||||
{
|
||||
return v3b( v3f( v1 ) + ( v3f( v2 ) - v3f( v1 ) ) * amount );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Vector3<T> Desaturate( const Vector3<T>& v )
|
||||
{
|
||||
T l = v.Luminance();
|
||||
return Vector3<T>( l, l, l );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Vector3<T> Desaturate( const Vector3<T>& v, float mul )
|
||||
{
|
||||
T l = T( v.Luminance() * mul );
|
||||
return Vector3<T>( l, l, l );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Vector3<T> pow( const Vector3<T>& base, float exponent )
|
||||
{
|
||||
return Vector3<T>(
|
||||
pow( base.x, exponent ),
|
||||
pow( base.y, exponent ),
|
||||
pow( base.z, exponent ) );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Vector3<T> sRGB2linear( const Vector3<T>& v )
|
||||
{
|
||||
return Vector3<T>(
|
||||
sRGB2linear( v.x ),
|
||||
sRGB2linear( v.y ),
|
||||
sRGB2linear( v.z ) );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Vector3<T> linear2sRGB( const Vector3<T>& v )
|
||||
{
|
||||
return Vector3<T>(
|
||||
linear2sRGB( v.x ),
|
||||
linear2sRGB( v.y ),
|
||||
linear2sRGB( v.z ) );
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,71 +0,0 @@
|
|||
BUILD SOURCE CODE LICENSE TERMS: 06/20/2000
|
||||
|
||||
[1] I give you permission to make modifications to my Build source and
|
||||
distribute it, BUT:
|
||||
|
||||
[2] Any derivative works based on my Build source may be distributed ONLY
|
||||
through the INTERNET.
|
||||
|
||||
[3] Distribution of any derivative works MUST be done completely FREE of
|
||||
charge - no commercial exploitation whatsoever.
|
||||
|
||||
[4] Anything you distribute which uses a part of my Build Engine source
|
||||
code MUST include:
|
||||
|
||||
[A] The following message somewhere in the archive:
|
||||
|
||||
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
|
||||
// Ken Silverman's official web site: "http://www.advsys.net/ken"
|
||||
// See the included license file "BUILDLIC.TXT" for license info.
|
||||
|
||||
[B] This text file "BUILDLIC.TXT" along with it.
|
||||
|
||||
[C] Any source files that you modify must include this message as well:
|
||||
|
||||
// This file has been modified from Ken Silverman's original release
|
||||
|
||||
[5] The use of the Build Engine for commercial purposes will require an
|
||||
appropriate license arrangement with me. Contact information is
|
||||
on my web site.
|
||||
|
||||
[6] I take no responsibility for damage to your system.
|
||||
|
||||
[7] Technical support: Before contacting me with questions, please read
|
||||
and do ALL of the following!
|
||||
|
||||
[A] Look through ALL of my text files. There are 7 of them (including this
|
||||
one). I like to think that I wrote them for a reason. You will find
|
||||
many of your answers in the history section of BUILD.TXT and
|
||||
BUILD2.TXT (they're located inside SRC.ZIP).
|
||||
|
||||
[B] If that doesn't satisfy you, then try going to:
|
||||
|
||||
"http://www.advsys.net/ken/buildsrc"
|
||||
|
||||
where I will maintain a Build Source Code FAQ (or perhaps I might
|
||||
just provide a link to a good FAQ).
|
||||
|
||||
[C] I am willing to respond to questions, but ONLY if they come at a rate
|
||||
that I can handle.
|
||||
|
||||
PLEASE TRY TO AVOID ASKING DUPLICATE QUESTIONS!
|
||||
|
||||
As my line of defense, I will post my current policy about
|
||||
answering Build source questions (right below the E-mail address
|
||||
on my web site.) You can check there to see if I'm getting
|
||||
overloaded with questions or not.
|
||||
|
||||
If I'm too busy, it might say something like this:
|
||||
|
||||
I'm too busy to answer Build source questions right now.
|
||||
Sorry, but don't expect a reply from me any time soon.
|
||||
|
||||
If I'm open for Build source questions, please state your question
|
||||
clearly and don't include any unsolicited attachments unless
|
||||
they're really small (like less than 50k). Assume that I have
|
||||
a 28.8k modem. Also, don't leave out important details just
|
||||
to make your question appear shorter - making me guess what
|
||||
you're asking doesn't save me time!
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
-Ken S. (official web site: http://www.advsys.net/ken)
|
Binary file not shown.
Before Width: | Height: | Size: 26 KiB |
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 69 KiB |
Binary file not shown.
Before Width: | Height: | Size: 19 KiB |
Binary file not shown.
|
@ -1,71 +0,0 @@
|
|||
#define NEED_COMMCTRL_H
|
||||
#include "windows_inc.h"
|
||||
#include "startwin.editor.h"
|
||||
|
||||
RSRC_ICON ICON "build_icon.ico"
|
||||
RSRC_BMP BITMAP "build.bmp"
|
||||
|
||||
WIN_STARTWIN DIALOGEX DISCARDABLE 20, 40, 260, 200
|
||||
STYLE DS_MODALFRAME | DS_CENTER | DS_SETFONT | DS_FIXEDSYS | WS_OVERLAPPED | WS_CAPTION | WS_VISIBLE | WS_SYSMENU
|
||||
CAPTION "Startup"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "", WIN_STARTWIN_BITMAP, "STATIC", SS_BITMAP | WS_CHILD | WS_VISIBLE, 0, 0, 32, 32
|
||||
CONTROL "", WIN_STARTWIN_TABCTL, WC_TABCONTROL, WS_CLIPSIBLINGS | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 5, 250, 170
|
||||
CONTROL "&Start", WIN_STARTWIN_START, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 154, 180, 48, 14
|
||||
CONTROL "&Cancel", WIN_STARTWIN_CANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 207, 180, 48, 14
|
||||
|
||||
CONTROL "", WIN_STARTWIN_MESSAGES, "EDIT", ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VSCROLL, 0, 0, 32, 32
|
||||
END
|
||||
|
||||
WIN_STARTWINPAGE_CONFIG DIALOGEX DISCARDABLE 20, 40, 279, 168
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
|
||||
CAPTION "Dialog"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "&2D Video mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 8, 50, 8
|
||||
CONTROL "", IDC2DVMODE, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 6, 80, 56
|
||||
CONTROL "&Fullscreen", IDCFULLSCREEN, "BUTTON", BS_CHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 148, 8, 49, 10
|
||||
CONTROL "&3D Video mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 24, 50, 8
|
||||
CONTROL "", IDC3DVMODE, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 22, 80, 56
|
||||
CONTROL "&Always show configuration on start", IDCALWAYSSHOW, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 118, 116, 140, 8
|
||||
END
|
||||
|
||||
#define FILEVER 1,9,9,9
|
||||
#define PRODUCTVER 1,9,9,9
|
||||
#define STRFILEVER "2.0.0devel\0"
|
||||
#define STRPRODUCTVER "2.0.0devel\0"
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION FILEVER
|
||||
PRODUCTVERSION PRODUCTVER
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x3L
|
||||
#else
|
||||
FILEFLAGS 0x2L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "FileDescription", "Mapster32 for KenBuild"
|
||||
VALUE "FileVersion", STRFILEVER
|
||||
VALUE "InternalName", "Mapster32"
|
||||
VALUE "LegalCopyright", "Copyright © 2015 EDuke32 Developers, 2000, 2003 Ken Silverman"
|
||||
VALUE "OriginalFilename", "ekenbuild-editor.exe"
|
||||
VALUE "ProductName", "Mapster32"
|
||||
VALUE "ProductVersion", STRPRODUCTVER
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
1 24 "manifest.build.xml"
|
Binary file not shown.
Before Width: | Height: | Size: 26 KiB |
Binary file not shown.
|
@ -1,167 +0,0 @@
|
|||
/* GIMP RGBA C-Source image dump (game_icon.c) */
|
||||
|
||||
#include "sdl_inc.h"
|
||||
#include "sdlappicon.h"
|
||||
|
||||
static Uint8 sdlappicon_pixels[] = {
|
||||
"z_A\377\\J6\377\\J6\377\206t`\377\214zf\377\214zf\377\214zf\377\214zf\377"
|
||||
"\214zf\377\214zf\377\214zf\377\214zf\377\214zf\377\214zf\377\214zf\377\214"
|
||||
"zf\377\214zf\377\214zf\377\214zf\377\214zf\377\214zf\377\214zf\377\214zf"
|
||||
"\377\214zf\377\214zf\377\214zf\377\214zf\377\214zf\377\206t`\377\\J6\377"
|
||||
"\\J6\377z_A\377\\J6\377\40\40\40\377\40\40\40\377ttt\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377ttt\377\40\40\40\377\40\40\40\377\\J6\377\\J6\377fM3\377fM3\377t"
|
||||
"tt\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377ttt\377fM3\377fM3\377\\J6\377\\J6\377fM3\377"
|
||||
"fM3\377ttt\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377ttt\377fM3\377fM3\377\\J6\377\\J6\377"
|
||||
"\40\40\40\377\40\40\40\377\\\\\\\377@@@\377\200\200\200\377ddd\377hhh\377"
|
||||
"hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hh"
|
||||
"h\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377ddd\377|||\377@@@\377\\\\"
|
||||
"\\\377\40\40\40\377\40\40\40\377\\J6\377\\J6\377\40\40\40\377\40\40\40\377"
|
||||
"lll\377hhh\377\200\200\200\377hhh\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377lll\377jjj\377rrr\377lll\377lll\377vvv\377bbb\377lll\377\200"
|
||||
"\200\200\377lll\377hhh\377ttt\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377ppp\377xxx\377hhh\377lll\377\40\40\40\377\40\40\40\377\\J6\377\\"
|
||||
"J6\377\40\40\40\377\40\40\40\377ttt\377\200\200\200\377\200\200\200\377h"
|
||||
"hh\377\200\200\200\377\200\200\200\377\200\200\200\377lll\377jjj\377rrr\377"
|
||||
"jjj\377jjj\377\200\200\200\377lll\377lll\377\200\200\200\377lll\377|||\377"
|
||||
"lll\377\200\200\200\377\200\200\200\377\200\200\200\377ppp\377xxx\377\200"
|
||||
"\200\200\377ttt\377\40\40\40\377\40\40\40\377\\J6\377\\J6\377\40\40\40\377"
|
||||
"\40\40\40\377ttt\377\200\200\200\377\200\200\200\377hhh\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377vvv\377lll\377|||\377ppp\377ppp\377vvv\377"
|
||||
"lll\377vvv\377lll\377vvv\377lll\377~~~\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377ppp\377xxx\377\200\200\200\377ttt\377\40\40\40\377\40\40"
|
||||
"\40\377\\J6\377\\J6\377\40\40\40\377\40\40\40\377ttt\377\200\200\200\377"
|
||||
"\200\200\200\377ddd\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377"
|
||||
"hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hh"
|
||||
"h\377ddd\377xxx\377\200\200\200\377ttt\377\40\40\40\377\40\40\40\377\\J6"
|
||||
"\377\\J6\377\40\40\40\377\40\40\40\377ttt\377\200\200\200\377\200\200\200"
|
||||
"\377hhh\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377ppp\377xxx\377\200\200\200\377ttt\377\40\40\40\377\40\40\40\377\\"
|
||||
"J6\377\\J6\377\40\40\40\377\40\40\40\377ttt\377\200\200\200\377\200\200\200"
|
||||
"\377hhh\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377ppp\377xxx\377\200\200\200\377ttt\377\40\40\40\377\40\40\40\377\\"
|
||||
"J6\377\\J6\377\40\40\40\377\40\40\40\377ttt\377\200\200\200\377\200\200\200"
|
||||
"\377hhh\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377ppp\377xxx\377\200\200\200\377ttt\377\40\40\40\377\40\40\40\377\\"
|
||||
"J6\377\\J6\377\40\40\40\377\40\40\40\377ttt\377\200\200\200\377\200\200\200"
|
||||
"\377ddd\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377"
|
||||
"hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377ddd\377xx"
|
||||
"x\377\200\200\200\377ttt\377\40\40\40\377\40\40\40\377\\J6\377\\J6\377\40"
|
||||
"\40\40\377\40\40\40\377ttt\377\200\200\200\377\200\200\200\377hhh\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377ppp\377"
|
||||
"xxx\377\200\200\200\377ttt\377\40\40\40\377\40\40\40\377\\J6\377\\J6\377"
|
||||
"\40\40\40\377\40\40\40\377ttt\377\200\200\200\377\200\200\200\377hhh\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"ppp\377xxx\377\200\200\200\377ttt\377\40\40\40\377\40\40\40\377\\J6\377\\"
|
||||
"J6\377\40\40\40\377\40\40\40\377ttt\377\200\200\200\377\200\200\200\377h"
|
||||
"hh\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377ppp\377xxx\377\200\200\200\377ttt\377\40\40\40\377\40\40\40\377\\J6\377"
|
||||
"\\J6\377\40\40\40\377\40\40\40\377ttt\377\200\200\200\377\200\200\200\377"
|
||||
"lll\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hh"
|
||||
"h\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377xxx\377"
|
||||
"\200\200\200\377ttt\377\40\40\40\377\40\40\40\377\\J6\377\\J6\377\40\40\40"
|
||||
"\377\40\40\40\377ttt\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377ttt\377\40\40\40\377\40\40"
|
||||
"\40\377\\J6\377\\J6\377\40\40\40\377\40\40\40\377fff\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377fff\377\40\40\40\377\40\40\40\377\\J6\377\\J6\377\40\40\40\377\40"
|
||||
"\40\40\377<<<\377fff\377ttt\377ttt\377ttt\377ttt\377ttt\377ttt\377ttt\377"
|
||||
"ttt\377ttt\377ttt\377ttt\377ttt\377ttt\377ttt\377ttt\377ttt\377ttt\377tt"
|
||||
"t\377ttt\377ttt\377ttt\377ttt\377fff\377<<<\377\40\40\40\377\40\40\40\377"
|
||||
"\\J6\377\\J6\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\\J6\377\\J6\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\\J6\377\\J6\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377$$0\377>>>\377HHH\377DDD\377DDD\377"
|
||||
"FFF\377LLL\377HHH\377HHH\377JJJ\377LLL\377LLL\377LLL\377LLL\377JJJ\377@@"
|
||||
"@\377444\377444\377444\377444\377,,,\377\40\40\40\377\40\40\40\377\\J6\377"
|
||||
"\\J6\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377<<<\377rrr\377ppp\377VVV\377PPP\377RRR\377jjj\377"
|
||||
"xxx\377vvv\377ttt\377zzz\377|||\377xxx\377xxx\377zzz\377rrr\377PPP\377HH"
|
||||
"H\377HHH\377HHH\377FFF\377\40\40\40\377\40\40\40\377\\J6\377\\J6\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377DDD\377lll\377lll\377000\377\40\40\40\377\40\40\40\377TTT\377"
|
||||
"xxx\377ttt\377ttt\377xxx\377|||\377\200\200\200\377\200\200\200\377zzz\377"
|
||||
"ttt\377PPP\377HHH\377HHH\377HHH\377HHH\377\40\40\40\377\40\40\40\377\\J6"
|
||||
"\377\\J6\377(((\377```\377hhh\377ttt\377NNN\377VVV\377\40\40\40\377DDD\377"
|
||||
"hhh\377lll\377000\377\40\40\40\377\40\40\40\377TTT\377vvv\377vvv\377vvv\377"
|
||||
"|||\377xxx\377|||\377|||\377~~~\377vvv\377PPP\377HHH\377HHH\377HHH\377HH"
|
||||
"H\377\40\40\40\377\40\40\40\377\\J6\377\\J6\377```\377\250\250\250\377~~"
|
||||
"~\377\250\250\250\377lll\377|||\377\40\40\40\377DDD\377jjj\377lll\377000"
|
||||
"\377\40\40\40\377\40\40\40\377TTT\377ttt\377xxx\377xxx\377~~~\377|||\377"
|
||||
"xxx\377xxx\377\202\202\202\377|||\377PPP\377HHH\377HHH\377HHH\377HHH\377"
|
||||
"\40\40\40\377\40\40\40\377\\J6\377\\J6\377|||\377\200\200\200\377@@@\377"
|
||||
"\250\250\250\377\240\240\240\377|||\377\40\40\40\377FFF\377vvv\377rrr\377"
|
||||
"000\377\40\40\40\377\40\40\40\377TTT\377vvv\377zzz\377xxx\377~~~\377|||\377"
|
||||
"xxx\377|||\377\214\214\214\377~~~\377PPP\377HHH\377HHH\377HHH\377HHH\377"
|
||||
"\"\"\"\377:0%\377\\J6\377\\J6\377```\377\250\250\250\377~~~\377\250\250\250"
|
||||
"\377lll\377|||\377\40\40\40\377HHH\377xxx\377rrr\377000\377\40\40\40\377"
|
||||
"\40\40\40\377XXX\377\200\200\200\377\200\200\200\377\200\200\200\377\210"
|
||||
"\210\210\377\206\206\206\377~~~\377zzz\377\204\204\204\377ttt\377PPP\377"
|
||||
"HHH\377HHH\377HHH\377HHH\3770+%\377T@*\377hQ8\377tX:\3770,(\377```\377hh"
|
||||
"h\377ttt\377NNN\377VVV\377\40\40\40\377HHH\377xxx\377ppp\377000\377\40\40"
|
||||
"\40\377\40\40\40\377XXX\377|||\377zzz\377xxx\377\202\202\202\377\200\200"
|
||||
"\200\377\200\200\200\377|||\377\202\202\202\377ttt\377PPP\377HHH\377HHH\377"
|
||||
"HHH\377HHH\377$$$\377L9&\377\\J6\377\230tL\377fM3\377($\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377($\40\377`VL\377ttt\377ppp\377XXX"
|
||||
"\377XXX\377\\\\\\\377ttt\377|||\377ppp\377xxx\377|||\377xxx\377|||\377\206"
|
||||
"\206\206\377\202\202\202\377xxx\377PPP\377HHH\377HHH\377HHH\377FFF\377\40"
|
||||
"\40\40\377\40\40\40\377\\J6\377\230tL\377\230tL\377tX:\377\\J6\377\\J6\377"
|
||||
"\\J6\377\\J6\377tX:\377\216sU\377\200nZ\377\204r^\377\204r^\377\212xd\377"
|
||||
"\216|h\377\222\200l\377\214zf\377\210vb\377\210vb\377\210vb\377\210vb\377"
|
||||
"\212xd\377\220~j\377\214zf\377\210vb\377tbN\377p^J\377p^J\377p^J\377jXD\377"
|
||||
"\\J6\377\\J6\377z_A\377",
|
||||
};
|
||||
|
||||
struct sdlappicon sdlappicon = {
|
||||
32, 32,
|
||||
sdlappicon_pixels
|
||||
};
|
|
@ -1,687 +0,0 @@
|
|||
/* GIMP RGBA C-Source image dump (game_icon.c) */
|
||||
|
||||
#include "sdl_inc.h"
|
||||
#include "sdlappicon.h"
|
||||
|
||||
static Uint8 sdlappicon_pixels[] = {
|
||||
"\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0"
|
||||
"\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0"
|
||||
"\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0"
|
||||
"\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0"
|
||||
"\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0"
|
||||
"\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0"
|
||||
"\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0"
|
||||
"\230tL\0\230tL\0\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40"
|
||||
"\40\377hhh\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377hhh\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\230tL\0\230tL\0\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377hhh\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377hhh\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\230tL\0\230tL\0\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377hhh\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377hhh\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\230tL\0\230t"
|
||||
"L\0\40\40\40\377@0\40\377`H0\377`H0\377@0\40\377hhh\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377hhh\377@0\40"
|
||||
"\377`H0\377`H0\377@0\40\377\40\40\40\377\230tL\0\230tL\0\40\40\40\377`H0"
|
||||
"\377\230tL\0\230tL\0`H0\377hhh\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377hhh\377`H0\377\230tL\0\230tL\0`H"
|
||||
"0\377\40\40\40\377\230tL\0\230tL\0\40\40\40\377`H0\377\230tL\0\230tL\0`H"
|
||||
"0\377hhh\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377hhh\377`H0\377\230tL\0\230tL\0`H0\377\40\40\40\377\230"
|
||||
"tL\0\230tL\0\40\40\40\377@0\40\377`H0\377`H0\377@0\40\377hhh\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"hhh\377@0\40\377`H0\377`H0\377@0\40\377\40\40\40\377\230tL\0\230tL\0\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377hhh\377```\377"
|
||||
"@@@\377```\377\200\200\200\377\200\200\200\377```\377```\377```\377```\377"
|
||||
"```\377```\377```\377```\377```\377```\377```\377```\377```\377```\377``"
|
||||
"`\377```\377```\377```\377```\377```\377```\377```\377```\377```\377```\377"
|
||||
"```\377```\377```\377```\377```\377```\377```\377```\377```\377```\377``"
|
||||
"`\377```\377```\377```\377```\377\200\200\200\377\200\200\200\377```\377"
|
||||
"@@@\377```\377hhh\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\230tL\0\230tL\0\40\40\40\377\40\40\40\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377hhh\377@@@\377\40\40\40\377@@@\377\200\200\200\377\200"
|
||||
"\200\200\377```\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377"
|
||||
"ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377pp"
|
||||
"p\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377"
|
||||
"ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377```\377pp"
|
||||
"p\377\200\200\200\377@@@\377\40\40\40\377@@@\377hhh\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377\230tL\0\230tL\0\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377hhh\377```\377@@@\377"
|
||||
"```\377\200\200\200\377\200\200\200\377```\377ppp\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377XXX\377XXX\377XXX\377ppp\377\200\200\200\377XXX\377\200"
|
||||
"\200\200\377\200\200\200\377XXX\377\200\200\200\377XXX\377XXX\377XXX\377"
|
||||
"\200\200\200\377XXX\377\200\200\200\377\200\200\200\377\200\200\200\377X"
|
||||
"XX\377XXX\377XXX\377xxx\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377```\377ppp\377\200\200\200\377```\377@@@\377```\377hhh\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\230tL\0\230t"
|
||||
"L\0\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377hhh\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377```\377ppp\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377XXX\377\200\200"
|
||||
"\200\377xxx\377XXX\377\200\200\200\377XXX\377\200\200\200\377\200\200\200"
|
||||
"\377XXX\377\200\200\200\377\200\200\200\377XXX\377\200\200\200\377\200\200"
|
||||
"\200\377XXX\377\200\200\200\377\200\200\200\377\200\200\200\377XXX\377\200"
|
||||
"\200\200\377ppp\377XXX\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377```\377ppp\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377hhh\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\230tL\0\230tL\0\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377hhh\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377```\377ppp\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377XXX\377XXX\377XXX\377ppp\377\200\200\200\377XXX\377\200\200\200"
|
||||
"\377\200\200\200\377XXX\377\200\200\200\377\200\200\200\377XXX\377\200\200"
|
||||
"\200\377\200\200\200\377XXX\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377XXX\377\200\200\200\377\200\200\200\377XXX\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377```\377ppp\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377hhh\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\40\40\40\377\40\40\40\377\230tL\0\230tL\0\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377hhh\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377```\377ppp\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377XXX\377\200\200\200\377xxx\377XXX\377"
|
||||
"\200\200\200\377XXX\377xxx\377xxx\377XXX\377\200\200\200\377\200\200\200"
|
||||
"\377XXX\377\200\200\200\377\200\200\200\377XXX\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377XXX\377\200\200\200\377ppp\377XXX\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377```\377ppp\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377hhh\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377\230tL\0\230tL\0\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377hhh\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377```\377p"
|
||||
"pp\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377XXX\377XXX\377XXX\377ppp\377"
|
||||
"\200\200\200\377hhh\377XXX\377XXX\377hhh\377\200\200\200\377XXX\377XXX\377"
|
||||
"XXX\377\200\200\200\377XXX\377XXX\377XXX\377\200\200\200\377XXX\377XXX\377"
|
||||
"XXX\377xxx\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377```\377"
|
||||
"ppp\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377h"
|
||||
"hh\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\230"
|
||||
"tL\0\230tL\0\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377hhh\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377```\377ppp\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377```\377ppp\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377hhh\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377\230tL\0\230tL\0\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377hhh\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377```\377`"
|
||||
"``\377```\377```\377```\377```\377```\377```\377```\377```\377```\377```"
|
||||
"\377```\377```\377```\377```\377```\377```\377```\377```\377```\377```\377"
|
||||
"```\377```\377```\377```\377```\377```\377```\377```\377```\377```\377``"
|
||||
"`\377```\377```\377```\377```\377```\377```\377```\377ppp\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377hhh\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\230tL\0\230tL\0\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377hhh\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"```\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377pp"
|
||||
"p\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377"
|
||||
"ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377pp"
|
||||
"p\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377```\377ppp\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377hhh\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\230tL\0\230t"
|
||||
"L\0\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377hhh\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377```\377ppp\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377```\377ppp\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377hhh\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\230tL\0\230tL\0\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377hhh\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377```\377ppp\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377```\377ppp\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377hhh\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\230tL\0\230tL\0\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377hhh\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377```\377ppp\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377```\377"
|
||||
"ppp\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377h"
|
||||
"hh\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\230"
|
||||
"tL\0\230tL\0\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377hhh\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377```\377ppp\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377```\377ppp\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377hhh\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377\230tL\0\230tL\0\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377hhh\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377```\377p"
|
||||
"pp\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377```\377ppp\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377hhh\377\40\40\40\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\40\40\40\377\230tL\0\230tL\0\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377hhh\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377```\377ppp\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"```\377ppp\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377hhh\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\230tL\0\230tL\0\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377hhh\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377```\377```\377```\377```\377```\377```\377``"
|
||||
"`\377```\377```\377```\377```\377```\377```\377```\377```\377```\377```\377"
|
||||
"```\377```\377```\377```\377```\377```\377```\377```\377```\377```\377``"
|
||||
"`\377```\377```\377```\377```\377```\377```\377```\377```\377```\377```\377"
|
||||
"```\377```\377ppp\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377hhh\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\230tL\0\230tL\0\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377hhh\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377```\377ppp\377ppp\377ppp\377ppp\377ppp\377"
|
||||
"ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377pp"
|
||||
"p\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377"
|
||||
"ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377pp"
|
||||
"p\377ppp\377```\377ppp\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377hhh\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\230tL\0\230tL\0\40\40\40\377\40\40\40\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377hhh\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377```\377ppp\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377```\377ppp\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377hhh\377\40"
|
||||
"\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\230tL\0\230"
|
||||
"tL\0\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377hhh"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377```\377ppp\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377```\377ppp\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377hhh\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377\230tL\0\230tL\0\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377hhh\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377```\377p"
|
||||
"pp\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377```\377ppp\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377hhh\377\40\40\40\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\40\40\40\377\230tL\0\230tL\0\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377hhh\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377```\377ppp\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"```\377ppp\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377hhh\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\230tL\0\230tL\0\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377hhh\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377```\377ppp\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377```\377ppp\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377hhh\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\230tL\0\230t"
|
||||
"L\0\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377hhh\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377```\377ppp\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377```\377ppp\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377hhh\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\230tL\0\230tL\0\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377hhh\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377```\377```\377"
|
||||
"```\377```\377```\377```\377```\377```\377```\377```\377```\377```\377``"
|
||||
"`\377```\377```\377```\377```\377```\377```\377```\377```\377```\377```\377"
|
||||
"```\377```\377```\377```\377```\377```\377```\377```\377```\377```\377``"
|
||||
"`\377```\377```\377```\377```\377```\377```\377ppp\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377hhh\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377\230tL\0\230tL\0\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377hhh\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377p"
|
||||
"pp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp"
|
||||
"\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377"
|
||||
"ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377ppp\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377hhh\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\230tL\0\230t"
|
||||
"L\0\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377hhh\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377hhh\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40"
|
||||
"\40\377\230tL\0\230tL\0\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377hhh\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377hhh\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\230tL\0\230tL\0\40\40\40\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377```\377xxx\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377xxx\377```\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\230tL\0\230tL\0\40\40\40\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377PPP\377ppp\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377ppp\377PPP\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\230tL\0\230tL\0\40\40\40\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377888\377```\377ppp\377xxx\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377xxx\377ppp\377```\377888\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\230tL\0"
|
||||
"\230tL\0\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377888\377PPP\377```\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh"
|
||||
"\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377"
|
||||
"hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hh"
|
||||
"h\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377"
|
||||
"hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377hhh\377```\377PPP\377888\377\40"
|
||||
"\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\230tL\0\230tL\0\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\230tL\0\230tL\0\40\40\40\377\40\40\40\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\230tL\0\230tL\0\40\40\40\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\230tL\0\230tL\0\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\230tL\0\230tL\0\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\230tL\0"
|
||||
"\230tL\0\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\37700`"
|
||||
"\377PPP\377hhh\377ppp\377ppp\377hhh\377hhh\377hhh\377hhh\377hhh\377ppp\377"
|
||||
"xxx\377xxx\377ppp\377ppp\377ppp\377ppp\377ppp\377xxx\377xxx\377xxx\377xx"
|
||||
"x\377xxx\377xxx\377xxx\377xxx\377xxx\377xxx\377ppp\377hhh\377XXX\377HHH\377"
|
||||
"HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377@@@\377000\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\230tL\0\230tL\0"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377PPP\377hhh"
|
||||
"\377xxx\377xxx\377ppp\377hhh\377```\377```\377```\377```\377hhh\377ppp\377"
|
||||
"xxx\377xxx\377xxx\377xxx\377xxx\377ppp\377xxx\377xxx\377xxx\377xxx\377xx"
|
||||
"x\377xxx\377xxx\377xxx\377xxx\377xxx\377\200\200\200\377xxx\377hhh\377XX"
|
||||
"X\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377@@@\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\230tL\0\230t"
|
||||
"L\0\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377```\377"
|
||||
"ppp\377xxx\377ppp\377hhh\377PPP\377@@@\377@@@\377@@@\377@@@\377@@@\377PP"
|
||||
"P\377ppp\377xxx\377xxx\377xxx\377ppp\377ppp\377xxx\377xxx\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377xxx\377xxx\377xxx\377xxx\377xxx\377x"
|
||||
"xx\377xxx\377ppp\377XXX\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH"
|
||||
"\377HHH\377HHH\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\230tL\0\230tL\0\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377hhh\377ppp\377ppp\377ppp\377hhh\377@@@\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377@@@\377hhh\377xxx\377xxx\377"
|
||||
"xxx\377ppp\377ppp\377xxx\377xxx\377xxx\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377xxx\377x"
|
||||
"xx\377xxx\377ppp\377XXX\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH"
|
||||
"\377HHH\377HHH\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\230tL\0\230tL\0\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377hhh\377hhh\377hhh\377ppp\377hhh\377@@@\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377@@@\377hhh\377xxx\377xxx\377"
|
||||
"xxx\377ppp\377ppp\377xxx\377xxx\377xxx\377xxx\377xxx\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377xxx\377x"
|
||||
"xx\377ppp\377XXX\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH"
|
||||
"\377HHH\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\230tL\0\230tL\0\40\40\40\377\40\40\40\377\40\40\40\377@@@\377@@@\377"
|
||||
"@@@\377@@@\377@@@\377@@@\377\40\40\40\377@@@\377@@@\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377hhh\377hhh\377hhh\377ppp\377hhh\377@@@\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377@@@\377"
|
||||
"hhh\377xxx\377xxx\377xxx\377ppp\377ppp\377xxx\377xxx\377xxx\377xxx\377xx"
|
||||
"x\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200"
|
||||
"\200\200\377xxx\377xxx\377ppp\377XXX\377HHH\377HHH\377HHH\377HHH\377HHH\377"
|
||||
"HHH\377HHH\377HHH\377HHH\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\230tL\0\230tL\0\40\40\40\377\40\40\40\377@@@\377hhh"
|
||||
"\377\230\230\230\377\230\230\230\377\210\210\210\377\270\270\270\377\230"
|
||||
"\230\230\377@@@\377\230\230\230\377\270\270\270\377@@@\377\40\40\40\377\40"
|
||||
"\40\40\377\40\40\40\377hhh\377hhh\377hhh\377ppp\377hhh\377@@@\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377@@@\377hhh\377pp"
|
||||
"p\377xxx\377xxx\377xxx\377xxx\377xxx\377\200\200\200\377\200\200\200\377"
|
||||
"xxx\377xxx\377xxx\377xxx\377xxx\377xxx\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377ppp\377XXX\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377"
|
||||
"HHH\377HHH\377HHH\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\230tL\0\230tL\0\40\40\40\377@@@\377hhh\377\230\230\230\377"
|
||||
"\270\270\270\377\270\270\270\377\230\230\230\377\270\270\270\377\230\230"
|
||||
"\230\377@@@\377\230\230\230\377\270\270\270\377@@@\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377hhh\377hhh\377hhh\377ppp\377hhh\377@@@\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377@@@\377hhh\377ppp\377"
|
||||
"xxx\377xxx\377xxx\377xxx\377xxx\377\200\200\200\377\200\200\200\377\200\200"
|
||||
"\200\377xxx\377xxx\377xxx\377xxx\377xxx\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377ppp\377XXX\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377"
|
||||
"HHH\377HHH\377HHH\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\230tL\0\230tL\0\40\40\40\377@@@\377\230\230\230\377\270\270"
|
||||
"\270\377\230\230\230\377hhh\377@@@\377\270\270\270\377\230\230\230\377@@"
|
||||
"@\377\230\230\230\377\270\270\270\377@@@\377\40\40\40\377\40\40\40\377\40"
|
||||
"\40\40\377hhh\377hhh\377ppp\377ppp\377hhh\377@@@\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377\40\40\40\377\40\40\40\377@@@\377hhh\377ppp\377xxx\377x"
|
||||
"xx\377xxx\377xxx\377xxx\377xxx\377\200\200\200\377\200\200\200\377xxx\377"
|
||||
"xxx\377xxx\377xxx\377xxx\377\200\200\200\377\210\210\210\377\210\210\210"
|
||||
"\377xxx\377XXX\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377"
|
||||
"HHH\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\230tL\0\230tL\0\40\40\40\377@@@\377\270\270\270\377\230\230\230\377hhh\377"
|
||||
"@@@\377@@@\377\270\270\270\377\230\230\230\377\250\250\250\377\230\230\230"
|
||||
"\377\270\270\270\377@@@\377\40\40\40\377\40\40\40\377\40\40\40\377hhh\377"
|
||||
"ppp\377xxx\377xxx\377hhh\377@@@\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377@@@\377hhh\377ppp\377xxx\377xxx\377xxx\377xxx\377"
|
||||
"xxx\377xxx\377\200\200\200\377\200\200\200\377xxx\377xxx\377xxx\377xxx\377"
|
||||
"\200\200\200\377\210\210\210\377\220\220\220\377\210\210\210\377xxx\377X"
|
||||
"XX\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377\40"
|
||||
"\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\230tL\0\230"
|
||||
"tL\0\40\40\40\377@@@\377\270\270\270\377\230\230\230\377hhh\377@@@\377@@"
|
||||
"@\377\270\270\270\377\230\230\230\377\250\250\250\377\230\230\230\377\270"
|
||||
"\270\270\377@@@\377\40\40\40\377\40\40\40\377\40\40\40\377ppp\377xxx\377"
|
||||
"xxx\377xxx\377ppp\377@@@\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377@@@\377hhh\377xxx\377xxx\377xxx\377\200\200\200\377x"
|
||||
"xx\377xxx\377\200\200\200\377\200\200\200\377\200\200\200\377xxx\377xxx\377"
|
||||
"xxx\377xxx\377\200\200\200\377\210\210\210\377\220\220\220\377\210\210\210"
|
||||
"\377ppp\377XXX\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377"
|
||||
"HHH\377\40\40\40\377(((\377XD,\377P<(\377\40\40\40\377\230tL\0\230tL\0\40"
|
||||
"\40\40\377@@@\377\230\230\230\377\270\270\270\377\230\230\230\377hhh\377"
|
||||
"@@@\377\270\270\270\377\230\230\230\377@@@\377\230\230\230\377\270\270\270"
|
||||
"\377@@@\377\40\40\40\377\40\40\40\377\40\40\40\377ppp\377xxx\377xxx\377x"
|
||||
"xx\377ppp\377@@@\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377@@@\377ppp\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"\200\200\200\377\200\200\200\377\200\200\200\377\210\210\210\377\210\210"
|
||||
"\210\377\210\210\210\377\200\200\200\377\200\200\200\377xxx\377xxx\377\200"
|
||||
"\200\200\377\210\210\210\377\210\210\210\377\200\200\200\377ppp\377XXX\377"
|
||||
"HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377\40\40\40"
|
||||
"\377(((\377XD,\377P<(\377\40\40\40\377\230tL\0\230tL\0\40\40\40\377@@@\377"
|
||||
"hhh\377\230\230\230\377\270\270\270\377\270\270\270\377\230\230\230\377\270"
|
||||
"\270\270\377\230\230\230\377@@@\377\230\230\230\377\270\270\270\377@@@\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377ppp\377xxx\377xxx\377xxx\377hhh\377"
|
||||
"@@@\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"@@@\377ppp\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\210\210\210\377\210\210\210\377\210"
|
||||
"\210\210\377\210\210\210\377\200\200\200\377\200\200\200\377xxx\377xxx\377"
|
||||
"\200\200\200\377\200\200\200\377xxx\377hhh\377XXX\377HHH\377HHH\377HHH\377"
|
||||
"HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377\40\40\40\377XD,\377XD,\377P<("
|
||||
"\377P<(\377\230tL\0\230tL\0@0\40\377\40\40\40\377@@@\377hhh\377\230\230\230"
|
||||
"\377\230\230\230\377\210\210\210\377\270\270\270\377\230\230\230\377@@@\377"
|
||||
"\230\230\230\377\270\270\270\377@@@\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377ppp\377xxx\377xxx\377xxx\377hhh\377@@@\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377@@@\377ppp\377\200\200\200\377\200"
|
||||
"\200\200\377\200\200\200\377xxx\377xxx\377xxx\377\200\200\200\377\210\210"
|
||||
"\210\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377"
|
||||
"xxx\377xxx\377\200\200\200\377\200\200\200\377xxx\377hhh\377XXX\377HHH\377"
|
||||
"HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377\40\40\40\377000"
|
||||
"\377XD,\377P<(\377\40\40\40\377\230tL\0\230tL\0`H0\377@0\40\377\40\40\40"
|
||||
"\377@@@\377@@@\377@@@\377@@@\377@@@\377@@@\377\40\40\40\377@@@\377@@@\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377ppp\377xxx\377xxx\377"
|
||||
"xxx\377hhh\377@@@\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377@@@\377ppp\377xxx\377xxx\377xxx\377xxx\377xxx\377xxx\377\200"
|
||||
"\200\200\377\200\200\200\377\200\200\200\377\200\200\200\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377\200\200\200\377\210\210\210\377\200"
|
||||
"\200\200\377\200\200\200\377ppp\377XXX\377HHH\377HHH\377HHH\377HHH\377HH"
|
||||
"H\377HHH\377HHH\377HHH\377HHH\377\40\40\40\377\40\40\40\377H4$\377@0\40\377"
|
||||
"\40\40\40\377\230tL\0\230tL\0\230tL\0`H0\377@0\40\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377@0\40\377"
|
||||
"ppp\377xxx\377xxx\377xxx\377hhh\377PPP\377@@@\377@@@\377@@@\377@@@\377@@"
|
||||
"@\377PPP\377xxx\377\200\200\200\377xxx\377ppp\377ppp\377xxx\377xxx\377\200"
|
||||
"\200\200\377xxx\377xxx\377xxx\377xxx\377\200\200\200\377\200\200\200\377"
|
||||
"\210\210\210\377\210\210\210\377\200\200\200\377\200\200\200\377ppp\377X"
|
||||
"XX\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377HHH\377\40"
|
||||
"\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\230tL\0\230"
|
||||
"tL\0\230tL\0\230tL\0`H0\377@0\40\377\40\40\40\377\40\40\40\377\40\40\40\377"
|
||||
"\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40"
|
||||
"\377\40\40\40\377@0\40\377`H0\377ppp\377ppp\377ppp\377ppp\377ppp\377hhh\377"
|
||||
"hhh\377ppp\377ppp\377xxx\377xxx\377\200\200\200\377\210\210\210\377\200\200"
|
||||
"\200\377xxx\377ppp\377ppp\377xxx\377xxx\377\200\200\200\377xxx\377xxx\377"
|
||||
"xxx\377xxx\377\200\200\200\377\210\210\210\377\210\210\210\377\200\200\200"
|
||||
"\377\200\200\200\377\200\200\200\377ppp\377XXX\377HHH\377HHH\377HHH\377H"
|
||||
"HH\377HHH\377HHH\377HHH\377HHH\377@@@\377\40\40\40\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0"
|
||||
"`H0\377@0\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\40\40\40\377\40\40\40\377@0\40\377`H0\377\230tL\0pp"
|
||||
"p\377hhh\377hhh\377ppp\377ppp\377ppp\377ppp\377xxx\377\200\200\200\377\200"
|
||||
"\200\200\377\210\210\210\377\210\210\210\377\220\220\220\377\210\210\210"
|
||||
"\377xxx\377xxx\377xxx\377xxx\377xxx\377xxx\377xxx\377xxx\377xxx\377xxx\377"
|
||||
"\200\200\200\377\210\210\210\377\210\210\210\377\200\200\200\377\200\200"
|
||||
"\200\377\200\200\200\377ppp\377XXX\377HHH\377HHH\377HHH\377HHH\377HHH\377"
|
||||
"HHH\377HHH\377HHH\377000\377\40\40\40\377\40\40\40\377\40\40\40\377\40\40"
|
||||
"\40\377\40\40\40\377\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230"
|
||||
"tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230"
|
||||
"tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230"
|
||||
"tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230"
|
||||
"tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230"
|
||||
"tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230"
|
||||
"tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230tL\0\230"
|
||||
"tL\0\230tL\0\230tL\0\230tL\0\230tL\0",
|
||||
};
|
||||
|
||||
struct sdlappicon sdlappicon = {
|
||||
64, 64,
|
||||
sdlappicon_pixels
|
||||
};
|
Binary file not shown.
Before Width: | Height: | Size: 8.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB |
|
@ -1,69 +0,0 @@
|
|||
#define NEED_COMMCTRL_H
|
||||
#include "windows_inc.h"
|
||||
#include "startwin.game.h"
|
||||
|
||||
RSRC_ICON ICON "game_icon.ico"
|
||||
RSRC_BMP BITMAP "game.bmp"
|
||||
|
||||
WIN_STARTWIN DIALOGEX DISCARDABLE 20, 40, 260, 200
|
||||
STYLE DS_MODALFRAME | DS_CENTER | DS_SETFONT | DS_FIXEDSYS | WS_OVERLAPPED | WS_CAPTION | WS_VISIBLE | WS_SYSMENU
|
||||
CAPTION "Startup"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "", WIN_STARTWIN_BITMAP, "STATIC", SS_BITMAP | WS_CHILD | WS_VISIBLE, 0, 0, 32, 32
|
||||
CONTROL "", WIN_STARTWIN_TABCTL, WC_TABCONTROL, WS_CLIPSIBLINGS | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 5, 250, 170
|
||||
CONTROL "&Start", WIN_STARTWIN_START, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 154, 180, 48, 14
|
||||
CONTROL "&Cancel", WIN_STARTWIN_CANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 207, 180, 48, 14
|
||||
|
||||
CONTROL "", WIN_STARTWIN_MESSAGES, "EDIT", ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VSCROLL, 0, 0, 32, 32
|
||||
END
|
||||
|
||||
WIN_STARTWINPAGE_CONFIG DIALOGEX DISCARDABLE 20, 40, 279, 168
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
|
||||
CAPTION "Dialog"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "&Video mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 8, 50, 8
|
||||
CONTROL "", IDC3DVMODE, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 6, 80, 56
|
||||
CONTROL "&Fullscreen", IDCFULLSCREEN, "BUTTON", BS_CHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 148, 8, 49, 10
|
||||
CONTROL "&Always show configuration on start", IDCALWAYSSHOW, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 118, 116, 140, 8
|
||||
END
|
||||
|
||||
#define FILEVER 1,9,9,9
|
||||
#define PRODUCTVER 1,9,9,9
|
||||
#define STRFILEVER "2.0.0devel\0"
|
||||
#define STRPRODUCTVER "2.0.0devel\0"
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION FILEVER
|
||||
PRODUCTVERSION PRODUCTVER
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x3L
|
||||
#else
|
||||
FILEFLAGS 0x2L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "FileDescription", "KenBuild"
|
||||
VALUE "FileVersion", STRFILEVER
|
||||
VALUE "InternalName", "KenBuild"
|
||||
VALUE "LegalCopyright", "Copyright © 2015 EDuke32 Developers, 2000, 2003 Ken Silverman"
|
||||
VALUE "OriginalFilename", "ekenbuild.exe"
|
||||
VALUE "ProductName", "KenBuild"
|
||||
VALUE "ProductVersion", STRPRODUCTVER
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
1 24 "manifest.game.xml"
|
|
@ -1,41 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
|
||||
<dpiAware>true</dpiAware>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
<assemblyIdentity
|
||||
version="1.0.0.0"
|
||||
processorArchitecture="*"
|
||||
name="KenBuild.Mapster32"
|
||||
type="win32"
|
||||
/>
|
||||
<description>Mapster32 for KenBuild</description>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- Windows Vista -->
|
||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
|
||||
<!-- Windows 7 -->
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
||||
<!-- Windows 8 -->
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
||||
<!-- Windows 8.1 -->
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
|
@ -1,41 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
|
||||
<dpiAware>true</dpiAware>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
<assemblyIdentity
|
||||
version="1.0.0.0"
|
||||
processorArchitecture="*"
|
||||
name="KenBuild"
|
||||
type="win32"
|
||||
/>
|
||||
<description>KenBuild</description>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- Windows Vista -->
|
||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
|
||||
<!-- Windows 7 -->
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
||||
<!-- Windows 8 -->
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
||||
<!-- Windows 8.1 -->
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
|
@ -1,312 +0,0 @@
|
|||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#include "compat.h"
|
||||
#include "baselayer.h"
|
||||
#include "build.h"
|
||||
|
||||
static struct
|
||||
{
|
||||
int fullscreen;
|
||||
int xdim3d, ydim3d, bpp3d;
|
||||
int forcesetup;
|
||||
} settings;
|
||||
|
||||
@interface StartupWinController : NSWindowController
|
||||
{
|
||||
NSMutableArray *modeslist3d;
|
||||
|
||||
IBOutlet NSButton *alwaysShowButton;
|
||||
IBOutlet NSButton *fullscreenButton;
|
||||
IBOutlet NSTextView *messagesView;
|
||||
IBOutlet NSTabView *tabView;
|
||||
IBOutlet NSPopUpButton *videoMode3DPUButton;
|
||||
|
||||
IBOutlet NSButton *cancelButton;
|
||||
IBOutlet NSButton *startButton;
|
||||
}
|
||||
|
||||
- (void)dealloc;
|
||||
- (void)populateVideoModes:(BOOL)firstTime;
|
||||
|
||||
- (IBAction)alwaysShowClicked:(id)sender;
|
||||
- (IBAction)fullscreenClicked:(id)sender;
|
||||
|
||||
- (IBAction)cancel:(id)sender;
|
||||
- (IBAction)start:(id)sender;
|
||||
|
||||
- (void)setupRunMode;
|
||||
- (void)setupMessagesMode;
|
||||
- (void)putsMessage:(NSString *)str;
|
||||
- (void)setTitle:(NSString *)str;
|
||||
@end
|
||||
|
||||
@implementation StartupWinController
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[modeslist3d release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)populateVideoModes:(BOOL)firstTime
|
||||
{
|
||||
int i, mode3d, fullscreen = ([fullscreenButton state] == NSOnState);
|
||||
int idx3d = -1;
|
||||
int xdim = 0, ydim = 0, bpp = 0;
|
||||
|
||||
if (firstTime)
|
||||
{
|
||||
xdim = settings.xdim3d;
|
||||
ydim = settings.ydim3d;
|
||||
bpp = settings.bpp3d;
|
||||
}
|
||||
else
|
||||
{
|
||||
mode3d = [[modeslist3d objectAtIndex:[videoMode3DPUButton indexOfSelectedItem]] intValue];
|
||||
if (mode3d >= 0)
|
||||
{
|
||||
xdim = validmode[mode3d].xdim;
|
||||
ydim = validmode[mode3d].ydim;
|
||||
bpp = validmode[mode3d].bpp;
|
||||
}
|
||||
}
|
||||
|
||||
mode3d = checkvideomode(&xdim, &ydim, bpp, fullscreen, 1);
|
||||
if (mode3d < 0)
|
||||
{
|
||||
int i, cd[] = { 32, 24, 16, 15, 8, 0 };
|
||||
for (i=0; cd[i]; ) { if (cd[i] >= bpp) i++; else break; }
|
||||
for (; cd[i]; i++)
|
||||
{
|
||||
mode3d = checkvideomode(&xdim, &ydim, cd[i], fullscreen, 1);
|
||||
if (mode3d < 0) continue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
[modeslist3d release];
|
||||
[videoMode3DPUButton removeAllItems];
|
||||
|
||||
modeslist3d = [[NSMutableArray alloc] init];
|
||||
|
||||
for (i = 0; i < validmodecnt; i++)
|
||||
{
|
||||
if (fullscreen == validmode[i].fs)
|
||||
{
|
||||
if (i == mode3d) idx3d = [modeslist3d count];
|
||||
[modeslist3d addObject:[NSNumber numberWithInt:i]];
|
||||
[videoMode3DPUButton addItemWithTitle:[NSString stringWithFormat:@"%d %C %d %d-bpp",
|
||||
validmode[i].xdim, 0xd7, validmode[i].ydim, validmode[i].bpp]];
|
||||
}
|
||||
}
|
||||
|
||||
if (idx3d >= 0) [videoMode3DPUButton selectItemAtIndex:idx3d];
|
||||
}
|
||||
|
||||
- (IBAction)alwaysShowClicked:(id)sender
|
||||
{
|
||||
UNREFERENCED_PARAMETER(sender);
|
||||
}
|
||||
|
||||
- (IBAction)fullscreenClicked:(id)sender
|
||||
{
|
||||
[self populateVideoModes:NO];
|
||||
|
||||
UNREFERENCED_PARAMETER(sender);
|
||||
}
|
||||
|
||||
- (IBAction)cancel:(id)sender
|
||||
{
|
||||
[NSApp abortModal];
|
||||
|
||||
UNREFERENCED_PARAMETER(sender);
|
||||
}
|
||||
|
||||
- (IBAction)start:(id)sender
|
||||
{
|
||||
int mode = [[modeslist3d objectAtIndex:[videoMode3DPUButton indexOfSelectedItem]] intValue];
|
||||
if (mode >= 0)
|
||||
{
|
||||
settings.xdim3d = validmode[mode].xdim;
|
||||
settings.ydim3d = validmode[mode].ydim;
|
||||
settings.bpp3d = validmode[mode].bpp;
|
||||
settings.fullscreen = validmode[mode].fs;
|
||||
}
|
||||
|
||||
settings.forcesetup = [alwaysShowButton state] == NSOnState;
|
||||
|
||||
[NSApp stopModal];
|
||||
|
||||
UNREFERENCED_PARAMETER(sender);
|
||||
}
|
||||
|
||||
- (void)setupRunMode
|
||||
{
|
||||
getvalidmodes();
|
||||
|
||||
[fullscreenButton setState: (settings.fullscreen ? NSOnState : NSOffState)];
|
||||
[alwaysShowButton setState: (settings.forcesetup ? NSOnState : NSOffState)];
|
||||
[self populateVideoModes:YES];
|
||||
|
||||
// enable all the controls on the Configuration page
|
||||
NSEnumerator *enumerator = [[[[tabView tabViewItemAtIndex:0] view] subviews] objectEnumerator];
|
||||
NSControl *control;
|
||||
while (control = [enumerator nextObject]) [control setEnabled:true];
|
||||
|
||||
[cancelButton setEnabled:true];
|
||||
[startButton setEnabled:true];
|
||||
|
||||
[tabView selectTabViewItemAtIndex:0];
|
||||
[NSCursor unhide]; // Why should I need to do this?
|
||||
}
|
||||
|
||||
- (void)setupMessagesMode
|
||||
{
|
||||
[tabView selectTabViewItemAtIndex:1];
|
||||
|
||||
// disable all the controls on the Configuration page except "always show", so the
|
||||
// user can enable it if they want to while waiting for something else to happen
|
||||
NSEnumerator *enumerator = [[[[tabView tabViewItemAtIndex:0] view] subviews] objectEnumerator];
|
||||
NSControl *control;
|
||||
while (control = [enumerator nextObject])
|
||||
{
|
||||
if (control == alwaysShowButton) continue;
|
||||
[control setEnabled:false];
|
||||
}
|
||||
|
||||
[cancelButton setEnabled:false];
|
||||
[startButton setEnabled:false];
|
||||
}
|
||||
|
||||
- (void)putsMessage:(NSString *)str
|
||||
{
|
||||
NSRange end;
|
||||
NSTextStorage *text = [messagesView textStorage];
|
||||
BOOL shouldAutoScroll;
|
||||
|
||||
shouldAutoScroll = ((int)NSMaxY([messagesView bounds]) == (int)NSMaxY([messagesView visibleRect]));
|
||||
|
||||
end.location = [text length];
|
||||
end.length = 0;
|
||||
|
||||
[text beginEditing];
|
||||
[messagesView replaceCharactersInRange:end withString:str];
|
||||
[text endEditing];
|
||||
|
||||
if (shouldAutoScroll)
|
||||
{
|
||||
end.location = [text length];
|
||||
end.length = 0;
|
||||
[messagesView scrollRangeToVisible:end];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setTitle:(NSString *)str
|
||||
{
|
||||
[[self window] setTitle:str];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
static StartupWinController *startwin = nil;
|
||||
|
||||
int startwin_open(void)
|
||||
{
|
||||
if (startwin != nil) return 1;
|
||||
|
||||
startwin = [[StartupWinController alloc] initWithWindowNibName:@"startwin.game"];
|
||||
if (startwin == nil) return -1;
|
||||
|
||||
[startwin setupMessagesMode];
|
||||
[startwin showWindow:nil];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int startwin_close(void)
|
||||
{
|
||||
if (startwin == nil) return 1;
|
||||
|
||||
[startwin close];
|
||||
[startwin release];
|
||||
startwin = nil;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int startwin_puts(const char *s)
|
||||
{
|
||||
NSString *ns;
|
||||
|
||||
if (!s) return -1;
|
||||
if (startwin == nil) return 1;
|
||||
|
||||
ns = [[NSString alloc] initWithUTF8String:s];
|
||||
[startwin putsMessage:ns];
|
||||
[ns release];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int startwin_settitle(const char *s)
|
||||
{
|
||||
NSString *ns;
|
||||
|
||||
if (!s) return -1;
|
||||
if (startwin == nil) return 1;
|
||||
|
||||
ns = [[NSString alloc] initWithUTF8String:s];
|
||||
[startwin setTitle:ns];
|
||||
[ns release];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int startwin_idle(void *v)
|
||||
{
|
||||
if (startwin) [[startwin window] displayIfNeeded];
|
||||
UNREFERENCED_PARAMETER(v);
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern int xdimgame, ydimgame, bppgame, forcesetup;
|
||||
|
||||
int startwin_run(void)
|
||||
{
|
||||
int retval;
|
||||
|
||||
if (startwin == nil) return 0;
|
||||
|
||||
settings.fullscreen = fullscreen;
|
||||
settings.xdim3d = xdimgame;
|
||||
settings.ydim3d = ydimgame;
|
||||
settings.bpp3d = bppgame;
|
||||
settings.forcesetup = forcesetup;
|
||||
|
||||
[startwin setupRunMode];
|
||||
|
||||
switch ([NSApp runModalForWindow:[startwin window]])
|
||||
{
|
||||
#ifdef MAC_OS_X_VERSION_10_9
|
||||
case NSModalResponseStop: retval = 1; break;
|
||||
case NSModalResponseAbort: retval = 0; break;
|
||||
#else
|
||||
case NSRunStoppedResponse: retval = 1; break;
|
||||
case NSRunAbortedResponse: retval = 0; break;
|
||||
#endif
|
||||
default: retval = -1;
|
||||
}
|
||||
|
||||
[startwin setupMessagesMode];
|
||||
|
||||
if (retval)
|
||||
{
|
||||
fullscreen = settings.fullscreen;
|
||||
xdimgame = settings.xdim3d;
|
||||
ydimgame = settings.ydim3d;
|
||||
bppgame = settings.bpp3d;
|
||||
forcesetup = settings.forcesetup;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
|
@ -1,720 +0,0 @@
|
|||
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
|
||||
// Ken Silverman's official web site: "http://www.advsys.net/ken"
|
||||
// See the included license file "BUILDLIC.TXT" for license info.
|
||||
//
|
||||
// This file has been modified from Ken Silverman's original release
|
||||
// by Jonathon Fowler (jf@jonof.id.au)
|
||||
|
||||
#include "compat.h"
|
||||
#include "build.h"
|
||||
#include "editor.h"
|
||||
#include "pragmas.h"
|
||||
#include "baselayer.h"
|
||||
#include "names.h"
|
||||
#include "osd.h"
|
||||
#include "cache1d.h"
|
||||
#include "common.h"
|
||||
#include "m32script.h"
|
||||
|
||||
#include "common_game.h"
|
||||
|
||||
const char *AppProperName = "KenBuild Editor";
|
||||
const char *AppTechnicalName = "ekenbuild-editor";
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define DEFAULT_GAME_EXEC "ekenbuild.exe"
|
||||
#define DEFAULT_GAME_LOCAL_EXEC "ekenbuild.exe"
|
||||
#else
|
||||
#define DEFAULT_GAME_EXEC "ekenbuild"
|
||||
#define DEFAULT_GAME_LOCAL_EXEC "./ekenbuild"
|
||||
#endif
|
||||
|
||||
const char *DefaultGameExec = DEFAULT_GAME_EXEC;
|
||||
const char *DefaultGameLocalExec = DEFAULT_GAME_LOCAL_EXEC;
|
||||
|
||||
#define SETUPFILENAME "ekenbuild-editor.cfg"
|
||||
const char *defaultsetupfilename = SETUPFILENAME;
|
||||
char setupfilename[BMAX_PATH] = SETUPFILENAME;
|
||||
|
||||
static char tempbuf[256];
|
||||
|
||||
#define NUMOPTIONS 9
|
||||
char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0,0};
|
||||
unsigned char default_buildkeys[NUMBUILDKEYS] =
|
||||
{
|
||||
0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39,
|
||||
0x1e,0x2c,0xd1,0xc9,0x33,0x34,
|
||||
0x9c,0x1c,0xd,0xc,0xf,0x45
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//static int hang = 0;
|
||||
//static int rollangle = 0;
|
||||
|
||||
//Detecting 2D / 3D mode:
|
||||
// qsetmode is 200 in 3D mode
|
||||
// qsetmode is 350/480 in 2D mode
|
||||
//
|
||||
//You can read these variables when F5-F8 is pressed in 3D mode only:
|
||||
//
|
||||
// If (searchstat == 0) WALL searchsector=sector, searchwall=wall
|
||||
// If (searchstat == 1) CEILING searchsector=sector
|
||||
// If (searchstat == 2) FLOOR searchsector=sector
|
||||
// If (searchstat == 3) SPRITE searchsector=sector, searchwall=sprite
|
||||
// If (searchstat == 4) MASKED WALL searchsector=sector, searchwall=wall
|
||||
//
|
||||
// searchsector is the sector of the selected item for all 5 searchstat's
|
||||
//
|
||||
// searchwall is undefined if searchstat is 1 or 2
|
||||
// searchwall is the wall if searchstat = 0 or 4
|
||||
// searchwall is the sprite if searchstat = 3 (Yeah, I know - it says wall,
|
||||
// but trust me, it's the sprite number)
|
||||
|
||||
int averagefps;
|
||||
#define AVERAGEFRAMES 32
|
||||
static unsigned int frameval[AVERAGEFRAMES];
|
||||
static int framecnt = 0;
|
||||
|
||||
int nextvoxid = 0;
|
||||
|
||||
|
||||
const char *ExtGetVer(void)
|
||||
{
|
||||
return s_buildRev;
|
||||
}
|
||||
|
||||
int32_t ExtPreInit(int32_t argc,char const * const * argv)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(argc);
|
||||
UNREFERENCED_PARAMETER(argv);
|
||||
|
||||
OSD_SetLogFile("ekenbuild-editor.log");
|
||||
OSD_SetVersion(AppProperName,0,2);
|
||||
initprintf("%s %s\n", AppProperName, s_buildRev);
|
||||
PrintBuildInfo();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t ExtInit(void)
|
||||
{
|
||||
int rv = 0;
|
||||
|
||||
/*printf("------------------------------------------------------------------------------\n");
|
||||
printf(" BUILD.EXE copyright(c) 1996 by Ken Silverman. You are granted the\n");
|
||||
printf(" right to use this software for your personal use only. This is a\n");
|
||||
printf(" special version to be used with \"Happy Fun KenBuild\" and may not work\n");
|
||||
printf(" properly with other Build engine games. Please refer to license.doc\n");
|
||||
printf(" for distribution rights\n");
|
||||
printf("------------------------------------------------------------------------------\n");
|
||||
getch();
|
||||
*/
|
||||
|
||||
bpp = 8;
|
||||
if (loadsetup(setupfilename) < 0) buildputs("Configuration file not found, using defaults.\n"), rv = 1;
|
||||
Bmemcpy(buildkeys, default_buildkeys, NUMBUILDKEYS); //Trick to make build use setup.dat keys
|
||||
if (option[4] > 0) option[4] = 0;
|
||||
|
||||
kensplayerheight = 32;
|
||||
zmode = 0;
|
||||
|
||||
#ifdef _WIN32
|
||||
// allowtaskswitching(0);
|
||||
#endif
|
||||
return rv;
|
||||
}
|
||||
|
||||
int32_t ExtPostStartupWindow(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
initgroupfile(G_GrpFile());
|
||||
|
||||
//You can load your own palette lookup tables here if you just
|
||||
//copy the right code!
|
||||
for (i=0; i<256; i++)
|
||||
tempbuf[i] = ((i+32)&255); //remap colors for screwy palette sectors
|
||||
makepalookup(16,tempbuf,0,0,0,1);
|
||||
|
||||
if (initengine())
|
||||
{
|
||||
initprintf("There was a problem initializing the engine.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
Ken_InitMultiPsky();
|
||||
|
||||
tiletovox[PLAYER] = nextvoxid++;
|
||||
tiletovox[BROWNMONSTER] = nextvoxid++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ExtPostInit(void)
|
||||
{
|
||||
fillemptylookups();
|
||||
}
|
||||
|
||||
void ExtUnInit(void)
|
||||
{
|
||||
uninitgroupfile();
|
||||
writesetup(setupfilename);
|
||||
}
|
||||
|
||||
//static int daviewingrange, daaspect, horizval1, horizval2;
|
||||
void ExtPreCheckKeys(void)
|
||||
{
|
||||
int /*cosang, sinang, dx, dy, mindx,*/ i, j, k;
|
||||
|
||||
if (keystatus[0x3e]) //F4 - screen re-size
|
||||
{
|
||||
keystatus[0x3e] = 0;
|
||||
|
||||
//cycle through all vesa modes, then screen-buffer mode
|
||||
if (keystatus[0x2a]|keystatus[0x36])
|
||||
{
|
||||
setgamemode(!fullscreen, xdim, ydim, bpp);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
//cycle through all modes
|
||||
j=-1;
|
||||
|
||||
// work out a mask to select the mode
|
||||
for (i=0; i<validmodecnt; i++)
|
||||
if ((validmode[i].xdim == xdim) &&
|
||||
(validmode[i].ydim == ydim) &&
|
||||
(validmode[i].fs == fullscreen) &&
|
||||
(validmode[i].bpp == bpp))
|
||||
{ j=i; break; }
|
||||
|
||||
for (k=0; k<validmodecnt; k++)
|
||||
if (validmode[k].fs == fullscreen && validmode[k].bpp == bpp) break;
|
||||
|
||||
if (j==-1) j=k;
|
||||
else
|
||||
{
|
||||
j++;
|
||||
if (j==validmodecnt) j=k;
|
||||
}
|
||||
setgamemode(fullscreen,validmode[j].xdim,validmode[j].ydim,bpp);
|
||||
}
|
||||
}
|
||||
|
||||
if (keystatus[buildkeys[BK_MODE2D_3D]]) // Enter
|
||||
{
|
||||
getmessageleng = 0;
|
||||
getmessagetimeoff = 0;
|
||||
}
|
||||
|
||||
if (getmessageleng > 0)
|
||||
{
|
||||
if (!in3dmode())
|
||||
printmessage16("%s", getmessage);
|
||||
if (totalclock > getmessagetimeoff)
|
||||
getmessageleng = 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (keystatus[0x2a]|keystatus[0x36])
|
||||
{
|
||||
if (keystatus[0xcf]) hang = max(hang-1,-182);
|
||||
if (keystatus[0xc7]) hang = min(hang+1,182);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (keystatus[0xcf]) hang = max(hang-8,-182);
|
||||
if (keystatus[0xc7]) hang = min(hang+8,182);
|
||||
}
|
||||
if (keystatus[0x4c]) { hang = 0; horiz = 100; }
|
||||
if (hang != 0)
|
||||
{
|
||||
walock[4094] = 255;
|
||||
|
||||
// JBF 20031117: scale each dimension by a factor of 1.2, and work out
|
||||
// the aspect of the screen. Anywhere you see 'i' below was the value
|
||||
// '200' before I changed it. NOTE: This whole trick crashes in resolutions
|
||||
// above 800x600. I'm not sure why, and fixing it is not something I intend
|
||||
// to do in a real big hurry.
|
||||
dx = (xdim + (xdim >> 3) + (xdim >> 4) + (xdim >> 6)) & (~7);
|
||||
dy = (ydim + (ydim >> 3) + (ydim >> 4) + (ydim >> 6)) & (~7);
|
||||
i = scale(320,ydim,xdim);
|
||||
|
||||
if (waloff[4094] == 0) allocache(&waloff[4094],/*240L*384L*/ dx*dy,&walock[4094]);
|
||||
setviewtotile(4094,/*240L,384L*/ dy,dx);
|
||||
|
||||
cosang = sintable[(hang+512)&2047];
|
||||
sinang = sintable[hang&2047];
|
||||
|
||||
dx = dmulscale1(320,cosang,i,sinang); mindx = dx;
|
||||
dy = dmulscale1(-i,cosang,320,sinang);
|
||||
horizval1 = dy*(320>>1)/dx-1;
|
||||
|
||||
dx = dmulscale1(320,cosang,-i,sinang); mindx = min(dx,mindx);
|
||||
dy = dmulscale1(i,cosang,320,sinang);
|
||||
horizval2 = dy*(320>>1)/dx+1;
|
||||
|
||||
daviewingrange = divscale30(xdim>>1, mindx-16);
|
||||
daaspect = scale(daviewingrange,scale(320,tilesiz[4094].x,tilesiz[4094].y),horizval2+6-horizval1);
|
||||
setaspect(daviewingrange,scale(daaspect,ydim*320,xdim*i));
|
||||
horiz = 100-divscale15(horizval1+horizval2,daviewingrange);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#define MAXVOXMIPS 5
|
||||
extern intptr_t voxoff[][MAXVOXMIPS];
|
||||
void ExtAnalyzeSprites(int32_t ourx, int32_t oury, int32_t oura, int32_t smoothr)
|
||||
{
|
||||
int i, *longptr;
|
||||
uspritetype *tspr;
|
||||
|
||||
UNREFERENCED_PARAMETER(ourx);
|
||||
UNREFERENCED_PARAMETER(oury);
|
||||
UNREFERENCED_PARAMETER(oura);
|
||||
UNREFERENCED_PARAMETER(smoothr);
|
||||
|
||||
for (i=0,tspr=&tsprite[0]; i<spritesortcnt; i++,tspr++)
|
||||
{
|
||||
if (usevoxels && tiletovox[tspr->picnum] >= 0)
|
||||
{
|
||||
switch (tspr->picnum)
|
||||
{
|
||||
case PLAYER:
|
||||
if (!voxoff[tiletovox[PLAYER]][0])
|
||||
{
|
||||
if (qloadkvx(tiletovox[PLAYER],"voxel000.kvx"))
|
||||
{
|
||||
tiletovox[PLAYER] = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//tspr->cstat |= 48; tspr->picnum = tiletovox[tspr->picnum];
|
||||
longptr = (int *)voxoff[tiletovox[PLAYER]][0];
|
||||
tspr->xrepeat = scale(tspr->xrepeat,56,longptr[2]);
|
||||
tspr->yrepeat = scale(tspr->yrepeat,56,longptr[2]);
|
||||
tspr->shade -= 6;
|
||||
break;
|
||||
case BROWNMONSTER:
|
||||
if (!voxoff[tiletovox[BROWNMONSTER]][0])
|
||||
{
|
||||
if (qloadkvx(tiletovox[BROWNMONSTER],"voxel001.kvx"))
|
||||
{
|
||||
tiletovox[BROWNMONSTER] = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//tspr->cstat |= 48; tspr->picnum = tiletovox[tspr->picnum];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
tspr->shade += 6;
|
||||
if (sector[tspr->sectnum].ceilingstat&1)
|
||||
tspr->shade += sector[tspr->sectnum].ceilingshade;
|
||||
else
|
||||
tspr->shade += sector[tspr->sectnum].floorshade;
|
||||
}
|
||||
}
|
||||
|
||||
void ExtCheckKeys(void)
|
||||
{
|
||||
int i; //, p, y, dx, dy, cosang, sinang, bufplc, tsizy, tsizyup15;
|
||||
int j;
|
||||
|
||||
if (qsetmode == 200) //In 3D mode
|
||||
{
|
||||
#if 0
|
||||
if (hang != 0)
|
||||
{
|
||||
bufplc = waloff[4094]+(mulscale16(horiz-100,xdimenscale)+(tilesiz[4094].x>>1))*tilesiz[4094].y;
|
||||
setviewback();
|
||||
cosang = sintable[(hang+512)&2047];
|
||||
sinang = sintable[hang&2047];
|
||||
dx = dmulscale1(xdim,cosang,ydim,sinang);
|
||||
dy = dmulscale1(-ydim,cosang,xdim,sinang);
|
||||
|
||||
begindrawing();
|
||||
tsizy = tilesiz[4094].y;
|
||||
tsizyup15 = (tsizy<<15);
|
||||
dx = mulscale14(dx,daviewingrange);
|
||||
dy = mulscale14(dy,daaspect);
|
||||
sinang = mulscale14(sinang,daviewingrange);
|
||||
cosang = mulscale14(cosang,daaspect);
|
||||
p = ylookup[windowxy1.y]+frameplace+windowxy2.x+1;
|
||||
for (y=windowxy1.y; y<=windowxy2.y; y++)
|
||||
{
|
||||
i = divscale16(tsizyup15,dx);
|
||||
stretchhline(0,(xdim>>1)*i+tsizyup15,xdim>>2,i,mulscale32(i,dy)*tsizy+bufplc,p);
|
||||
dx -= sinang; dy += cosang; p += ylookup[1];
|
||||
}
|
||||
walock[4094] = 1;
|
||||
|
||||
Bsprintf(tempbuf,"%d",(hang*180)>>10);
|
||||
printext256(0L,8L,31,-1,tempbuf,1);
|
||||
enddrawing();
|
||||
}
|
||||
#endif
|
||||
if (keystatus[0xa]) setaspect(viewingrange+(viewingrange>>8),yxaspect+(yxaspect>>8));
|
||||
if (keystatus[0xb]) setaspect(viewingrange-(viewingrange>>8),yxaspect-(yxaspect>>8));
|
||||
if (keystatus[0xc]) setaspect(viewingrange,yxaspect-(yxaspect>>8));
|
||||
if (keystatus[0xd]) setaspect(viewingrange,yxaspect+(yxaspect>>8));
|
||||
//if (keystatus[0x38]) setrollangle(rollangle+=((keystatus[0x2a]|keystatus[0x36])*6+2));
|
||||
//if (keystatus[0xb8]) setrollangle(rollangle-=((keystatus[0x2a]|keystatus[0x36])*6+2));
|
||||
//if (keystatus[0x1d]|keystatus[0x9d]) setrollangle(rollangle=0);
|
||||
|
||||
begindrawing();
|
||||
|
||||
i = frameval[framecnt&(AVERAGEFRAMES-1)];
|
||||
j = frameval[framecnt&(AVERAGEFRAMES-1)] = getticks(); framecnt++;
|
||||
if (i != j) averagefps = (averagefps*3 + (AVERAGEFRAMES*1000)/(j-i))>>2;
|
||||
Bsprintf((char *)tempbuf,"%d",averagefps);
|
||||
printext256(0L,0L,31,-1,(char *)tempbuf,1);
|
||||
|
||||
enddrawing();
|
||||
editinput();
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void ExtCleanUp(void)
|
||||
{
|
||||
}
|
||||
|
||||
void ExtPreLoadMap(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void ExtSetupMapFilename(const char *mapname)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(mapname);
|
||||
}
|
||||
|
||||
void ExtLoadMap(const char *mapname)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(mapname);
|
||||
}
|
||||
|
||||
int32_t ExtPreSaveMap(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ExtSaveMap(const char *mapname)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(mapname);
|
||||
}
|
||||
|
||||
const char *ExtGetSectorCaption(short sectnum)
|
||||
{
|
||||
if ((sector[sectnum].lotag|sector[sectnum].hitag) == 0)
|
||||
{
|
||||
tempbuf[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Bsprintf((char *)tempbuf,"%hu,%hu",(unsigned short)sector[sectnum].hitag,
|
||||
(unsigned short)sector[sectnum].lotag);
|
||||
}
|
||||
return (char *)tempbuf;
|
||||
}
|
||||
|
||||
const char *ExtGetWallCaption(short wallnum)
|
||||
{
|
||||
if ((wall[wallnum].lotag|wall[wallnum].hitag) == 0)
|
||||
{
|
||||
tempbuf[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Bsprintf((char *)tempbuf,"%hu,%hu",(unsigned short)wall[wallnum].hitag,
|
||||
(unsigned short)wall[wallnum].lotag);
|
||||
}
|
||||
return (char *)tempbuf;
|
||||
}
|
||||
|
||||
const char *ExtGetSpriteCaption(short spritenum)
|
||||
{
|
||||
if ((sprite[spritenum].lotag|sprite[spritenum].hitag) == 0)
|
||||
{
|
||||
tempbuf[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Bsprintf((char *)tempbuf,"%hu,%hu",(unsigned short)sprite[spritenum].hitag,
|
||||
(unsigned short)sprite[spritenum].lotag);
|
||||
}
|
||||
return (char *)tempbuf;
|
||||
}
|
||||
|
||||
//printext16 parameters:
|
||||
//printext16(int xpos, int ypos, short col, short backcol,
|
||||
// char name[82], char fontsize)
|
||||
// xpos 0-639 (top left)
|
||||
// ypos 0-479 (top left)
|
||||
// col 0-15
|
||||
// backcol 0-15, -1 is transparent background
|
||||
// name
|
||||
// fontsize 0=8*8, 1=3*5
|
||||
|
||||
//drawline16 parameters:
|
||||
// drawline16(int x1, int y1, int x2, int y2, char col)
|
||||
// x1, x2 0-639
|
||||
// y1, y2 0-143 (status bar is 144 high, origin is top-left of STATUS BAR)
|
||||
// col 0-15
|
||||
|
||||
void ExtShowSectorData(short sectnum) //F5
|
||||
{
|
||||
int i;
|
||||
if (qsetmode == 200) //In 3D mode
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
begindrawing();
|
||||
clearmidstatbar16(); //Clear middle of status bar
|
||||
|
||||
Bsprintf((char *)tempbuf,"Sector %d",sectnum);
|
||||
printext16(8,ydim16+32,11,-1,(char *)tempbuf,0);
|
||||
|
||||
printext16(8,ydim16+48,11,-1,"8*8 font: ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789",0);
|
||||
printext16(8,ydim16+56,11,-1,"3*5 font: ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789",1);
|
||||
|
||||
i=ydim16; ydim16=ydim;
|
||||
drawline16(320,i+68,344,i+80,4); //Draw house
|
||||
drawline16(344,i+80,344,i+116,4);
|
||||
drawline16(344,i+116,296,i+116,4);
|
||||
drawline16(296,i+116,296,i+80,4);
|
||||
drawline16(296,i+80,320,i+68,4);
|
||||
ydim16=i;
|
||||
enddrawing();
|
||||
}
|
||||
}
|
||||
|
||||
void ExtShowWallData(short wallnum) //F6
|
||||
{
|
||||
if (qsetmode == 200) //In 3D mode
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
begindrawing();
|
||||
clearmidstatbar16(); //Clear middle of status bar
|
||||
|
||||
Bsprintf((char *)tempbuf,"Wall %d",wallnum);
|
||||
printext16(8,ydim16+32,11,-1,(char *)tempbuf,0);
|
||||
enddrawing();
|
||||
}
|
||||
}
|
||||
|
||||
void ExtShowSpriteData(short spritenum) //F6
|
||||
{
|
||||
if (qsetmode == 200) //In 3D mode
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
begindrawing();
|
||||
clearmidstatbar16(); //Clear middle of status bar
|
||||
|
||||
Bsprintf((char *)tempbuf,"Sprite %d",spritenum);
|
||||
printext16(8,ydim16+32,11,-1,(char *)tempbuf,0);
|
||||
enddrawing();
|
||||
}
|
||||
}
|
||||
|
||||
void ExtEditSectorData(short sectnum) //F7
|
||||
{
|
||||
short nickdata;
|
||||
|
||||
if (qsetmode == 200) //In 3D mode
|
||||
{
|
||||
//Ceiling
|
||||
if (searchstat == 1)
|
||||
sector[searchsector].ceilingpicnum++; //Just a stupid example
|
||||
|
||||
//Floor
|
||||
if (searchstat == 2)
|
||||
sector[searchsector].floorshade++; //Just a stupid example
|
||||
}
|
||||
else //In 2D mode
|
||||
{
|
||||
Bsprintf((char *)tempbuf,"Sector (%d) Nick's variable: ",sectnum);
|
||||
nickdata = 0;
|
||||
nickdata = getnumber16((char *)tempbuf,nickdata,65536L,0);
|
||||
|
||||
printmessage16(" "); //Clear message box (top right of status bar)
|
||||
ExtShowSectorData(sectnum);
|
||||
}
|
||||
}
|
||||
|
||||
void ExtEditWallData(short wallnum) //F8
|
||||
{
|
||||
short nickdata;
|
||||
|
||||
if (qsetmode == 200) //In 3D mode
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
Bsprintf((char *)tempbuf,"Wall (%d) Nick's variable: ",wallnum);
|
||||
nickdata = 0;
|
||||
nickdata = getnumber16((char *)tempbuf,nickdata,65536L,0);
|
||||
|
||||
printmessage16(" "); //Clear message box (top right of status bar)
|
||||
ExtShowWallData(wallnum);
|
||||
}
|
||||
}
|
||||
|
||||
void ExtEditSpriteData(short spritenum) //F8
|
||||
{
|
||||
short nickdata;
|
||||
|
||||
if (qsetmode == 200) //In 3D mode
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
Bsprintf((char *)tempbuf,"Sprite (%d) Nick's variable: ",spritenum);
|
||||
nickdata = 0;
|
||||
nickdata = getnumber16((char *)tempbuf,nickdata,65536L,0);
|
||||
printmessage16(" ");
|
||||
|
||||
printmessage16(" "); //Clear message box (top right of status bar)
|
||||
ExtShowSpriteData(spritenum);
|
||||
}
|
||||
}
|
||||
|
||||
void faketimerhandler(void)
|
||||
{
|
||||
sampletimer();
|
||||
}
|
||||
|
||||
void M32RunScript(const char *s) { UNREFERENCED_PARAMETER(s); }
|
||||
void G_Polymer_UnInit(void) { }
|
||||
void SetGamePalette(int32_t j) { UNREFERENCED_PARAMETER(j); }
|
||||
|
||||
int32_t AmbienceToggle, MixRate, ParentalLock;
|
||||
|
||||
int32_t taglab_linktags(int32_t spritep, int32_t num)
|
||||
{
|
||||
int32_t link = 0;
|
||||
|
||||
g_iReturnVar = link;
|
||||
VM_OnEvent(EVENT_LINKTAGS, spritep ? num : -1);
|
||||
link = g_iReturnVar;
|
||||
|
||||
return link;
|
||||
}
|
||||
|
||||
int32_t taglab_getnextfreetag(int32_t *duetoptr)
|
||||
{
|
||||
int32_t i, nextfreetag=1;
|
||||
int32_t obj = -1;
|
||||
|
||||
for (i=0; i<MAXSPRITES; i++)
|
||||
{
|
||||
int32_t tag;
|
||||
|
||||
if (sprite[i].statnum == MAXSTATUS)
|
||||
continue;
|
||||
|
||||
tag = select_sprite_tag(i);
|
||||
|
||||
if (tag != INT32_MIN && nextfreetag <= tag)
|
||||
{
|
||||
nextfreetag = tag+1;
|
||||
obj = 32768 + i;
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<numwalls; i++)
|
||||
{
|
||||
int32_t lt = taglab_linktags(0, i);
|
||||
|
||||
if ((lt&1) && nextfreetag <= wall[i].lotag)
|
||||
nextfreetag = wall[i].lotag+1, obj = i;
|
||||
if ((lt&2) && nextfreetag <= wall[i].hitag)
|
||||
nextfreetag = wall[i].hitag+1, obj = i;
|
||||
}
|
||||
|
||||
if (duetoptr != NULL)
|
||||
*duetoptr = obj;
|
||||
|
||||
if (nextfreetag < 32768)
|
||||
return nextfreetag;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t S_InvalidSound(int32_t num) {
|
||||
UNREFERENCED_PARAMETER(num); return 1;
|
||||
};
|
||||
int32_t S_CheckSoundPlaying(int32_t i, int32_t num) {
|
||||
UNREFERENCED_PARAMETER(i); UNREFERENCED_PARAMETER(num); return 0;
|
||||
};
|
||||
int32_t S_SoundsPlaying(int32_t i) {
|
||||
UNREFERENCED_PARAMETER(i); return -1;
|
||||
}
|
||||
int32_t S_SoundFlags(int32_t num) {
|
||||
UNREFERENCED_PARAMETER(num); return 0;
|
||||
};
|
||||
int32_t A_PlaySound(uint32_t num, int32_t i) {
|
||||
UNREFERENCED_PARAMETER(num); UNREFERENCED_PARAMETER(i); return 0;
|
||||
};
|
||||
void S_StopSound(int32_t num) {
|
||||
UNREFERENCED_PARAMETER(num);
|
||||
};
|
||||
void S_StopAllSounds(void) { }
|
||||
|
||||
//Just thought you might want my getnumber16 code
|
||||
/*
|
||||
getnumber16(char namestart[80], short num, int maxnumber)
|
||||
{
|
||||
char buffer[80];
|
||||
int j, k, n, danum, oldnum;
|
||||
|
||||
danum = (int)num;
|
||||
oldnum = danum;
|
||||
while ((keystatus[0x1c] != 2) && (keystatus[0x1] == 0)) //Enter, ESC
|
||||
{
|
||||
sprintf(&buffer,"%s%ld_ ",namestart,danum);
|
||||
printmessage16(buffer);
|
||||
|
||||
for(j=2;j<=11;j++) //Scan numbers 0-9
|
||||
if (keystatus[j] > 0)
|
||||
{
|
||||
keystatus[j] = 0;
|
||||
k = j-1;
|
||||
if (k == 10) k = 0;
|
||||
n = (danum*10)+k;
|
||||
if (n < maxnumber) danum = n;
|
||||
}
|
||||
if (keystatus[0xe] > 0) // backspace
|
||||
{
|
||||
danum /= 10;
|
||||
keystatus[0xe] = 0;
|
||||
}
|
||||
if (keystatus[0x1c] == 1) //L. enter
|
||||
{
|
||||
oldnum = danum;
|
||||
keystatus[0x1c] = 2;
|
||||
asksave = 1;
|
||||
}
|
||||
}
|
||||
keystatus[0x1c] = 0;
|
||||
keystatus[0x1] = 0;
|
||||
return((short)oldnum);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
* vim:ts=4:
|
||||
*/
|
|
@ -1,45 +0,0 @@
|
|||
|
||||
#include "compat.h"
|
||||
#include "build.h"
|
||||
|
||||
#include "names.h"
|
||||
#include "common_game.h"
|
||||
|
||||
static const char *defaultgrpfilename = "stuff.dat";
|
||||
static const char *defaultdeffilename = "kenbuild.def";
|
||||
|
||||
const char *G_DefaultGrpFile(void)
|
||||
{
|
||||
return defaultgrpfilename;
|
||||
}
|
||||
const char *G_GrpFile(void)
|
||||
{
|
||||
return defaultgrpfilename;
|
||||
}
|
||||
|
||||
const char *G_DefaultDefFile(void)
|
||||
{
|
||||
return defaultdeffilename;
|
||||
}
|
||||
const char *G_DefFile(void)
|
||||
{
|
||||
return defaultdeffilename;
|
||||
}
|
||||
|
||||
void Ken_InitMultiPsky(void)
|
||||
{
|
||||
// default
|
||||
psky_t * const defaultsky = E_DefinePsky(DEFAULTPSKY);
|
||||
defaultsky->lognumtiles = 1;
|
||||
defaultsky->horizfrac = 65536;
|
||||
|
||||
// DAYSKY
|
||||
psky_t * const daysky = E_DefinePsky(DAYSKY);
|
||||
daysky->lognumtiles = 1;
|
||||
daysky->horizfrac = 65536;
|
||||
|
||||
// NIGHTSKY
|
||||
psky_t * const nightsky = E_DefinePsky(NIGHTSKY);
|
||||
nightsky->lognumtiles = 3;
|
||||
nightsky->horizfrac = 65536;
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
|
||||
#include "compat.h"
|
||||
|
||||
extern const char *G_DefaultGrpFile(void);
|
||||
extern const char *G_GrpFile(void);
|
||||
|
||||
extern void Ken_InitMultiPsky(void);
|
|
@ -1,317 +0,0 @@
|
|||
// Evil and Nasty Configuration File Reader for KenBuild
|
||||
// by Jonathon Fowler
|
||||
|
||||
#include "compat.h"
|
||||
#include "build.h"
|
||||
#include "editor.h"
|
||||
#include "osd.h"
|
||||
|
||||
#ifdef RENDERTYPEWIN
|
||||
#include "winlayer.h"
|
||||
#endif
|
||||
#include "baselayer.h"
|
||||
|
||||
#if defined RENDERTYPESDL && defined SDL_TARGET && SDL_TARGET > 1
|
||||
# include "sdl_inc.h"
|
||||
#endif
|
||||
|
||||
static void Ken_SetDefaults()
|
||||
{
|
||||
#if defined RENDERTYPESDL && SDL_MAJOR_VERSION > 1
|
||||
uint32_t inited = SDL_WasInit(SDL_INIT_VIDEO);
|
||||
if (inited == 0)
|
||||
SDL_Init(SDL_INIT_VIDEO);
|
||||
else if (!(inited & SDL_INIT_VIDEO))
|
||||
SDL_InitSubSystem(SDL_INIT_VIDEO);
|
||||
|
||||
SDL_DisplayMode dm;
|
||||
if (SDL_GetDesktopDisplayMode(0, &dm) == 0)
|
||||
{
|
||||
xdimgame = xdim2d = dm.w;
|
||||
ydimgame = ydim2d = dm.h;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
xdimgame = xdim2d = 1024;
|
||||
ydimgame = ydim2d = 768;
|
||||
}
|
||||
}
|
||||
|
||||
static int 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)
|
||||
{
|
||||
char buf[1000], *k, *v, *eq;
|
||||
int x=0;
|
||||
|
||||
if (len < 1) return 0;
|
||||
|
||||
Brewind(fp);
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (!Bfgets(buf, 1000, fp)) return 0;
|
||||
|
||||
if (buf[0] == ';') continue;
|
||||
|
||||
eq = Bstrchr(buf, '=');
|
||||
if (!eq) continue;
|
||||
|
||||
k = buf;
|
||||
v = eq+1;
|
||||
|
||||
while (*k == ' ' || *k == '\t') k++;
|
||||
*(eq--) = 0;
|
||||
while ((*eq == ' ' || *eq == '\t') && eq>=k) *(eq--) = 0;
|
||||
|
||||
if (Bstrcasecmp(k, key)) continue;
|
||||
|
||||
while (*v == ' ' || *k == '\t') v++;
|
||||
eq = v + Bstrlen(v)-1;
|
||||
|
||||
while ((*eq == ' ' || *eq == '\t' || *eq == '\r' || *eq == '\n') && eq>=v) *(eq--) = 0;
|
||||
|
||||
value[--len] = 0;
|
||||
do value[x] = v[x]; while (v[x++] != 0 && len-- > 0);
|
||||
|
||||
return x-1;
|
||||
}
|
||||
}
|
||||
|
||||
extern short brightness;
|
||||
extern int fullscreen;
|
||||
extern unsigned char option[8];
|
||||
extern unsigned char keys[NUMBUILDKEYS];
|
||||
double msens;
|
||||
|
||||
/*
|
||||
* SETUP.DAT
|
||||
* 0 = video mode (0:chained 1:vesa 2:screen buffered 3/4/5:tseng/paradise/s3 6:red-blue)
|
||||
* 1 = sound (0:none)
|
||||
* 2 = music (0:none)
|
||||
* 3 = input (0:keyboard 1:+mouse)
|
||||
* 4 = multiplayer (0:single 1-4:com 5-11:ipx)
|
||||
* 5&0xf0 = com speed
|
||||
* 5&0x0f = com irq
|
||||
* 6&0xf0 = chained y-res
|
||||
* 6&0x0f = chained x-res or vesa mode
|
||||
* 7&0xf0 = sound samplerate
|
||||
* 7&0x01 = sound quality
|
||||
* 7&0x02 = 8/16 bit
|
||||
* 7&0x04 = mono/stereo
|
||||
*
|
||||
* bytes 8 to 26 are key settings:
|
||||
* 0 = Forward (0xc8)
|
||||
* 1 = Backward (0xd0)
|
||||
* 2 = Turn left (0xcb)
|
||||
* 3 = Turn right (0xcd)
|
||||
* 4 = Run (0x2a)
|
||||
* 5 = Strafe (0x9d)
|
||||
* 6 = Fire (0x1d)
|
||||
* 7 = Use (0x39)
|
||||
* 8 = Stand high (0x1e)
|
||||
* 9 = Stand low (0x2c)
|
||||
* 10 = Look up (0xd1)
|
||||
* 11 = Look down (0xc9)
|
||||
* 12 = Strafe left (0x33)
|
||||
* 13 = Strafe right (0x34)
|
||||
* 14 = 2D/3D switch (0x9c)
|
||||
* 15 = View cycle (0x1c)
|
||||
* 16 = 2D Zoom in (0xd)
|
||||
* 17 = 2D Zoom out (0xc)
|
||||
* 18 = Chat (0xf)
|
||||
*/
|
||||
|
||||
int Ken_loadsetup(const char *fn)
|
||||
{
|
||||
Ken_SetDefaults();
|
||||
|
||||
BFILE *fp;
|
||||
#define VL 32
|
||||
char val[VL];
|
||||
int i;
|
||||
|
||||
if ((fp = Bfopen(fn, "rt")) == NULL) return -1;
|
||||
|
||||
if (readconfig(fp, "forcesetup", val, VL) > 0) { if (Batoi(val) != 0) forcesetup = 1; else forcesetup = 0; }
|
||||
if (readconfig(fp, "fullscreen", val, VL) > 0) { if (Batoi(val) != 0) fullscreen = 1; else fullscreen = 0; }
|
||||
if (readconfig(fp, "resolution", val, VL) > 0)
|
||||
{
|
||||
i = Batoi(val) & 0x0f;
|
||||
if ((unsigned)i<13) { xdimgame = xdim2d = vesares[i][0]; ydimgame = ydim2d = vesares[i][1]; }
|
||||
}
|
||||
if (readconfig(fp, "xdim", val, VL) > 0) xdimgame = xdim2d = Batoi(val);
|
||||
if (readconfig(fp, "ydim", val, VL) > 0) ydimgame = xdim2d = Batoi(val);
|
||||
if (readconfig(fp, "samplerate", val, VL) > 0) option[7] = (Batoi(val) & 0x0f) << 4;
|
||||
if (readconfig(fp, "music", val, VL) > 0) { if (Batoi(val) != 0) option[2] = 1; else option[2] = 0; }
|
||||
if (readconfig(fp, "mouse", val, VL) > 0) { if (Batoi(val) != 0) option[3] = 1; else option[3] = 0; }
|
||||
if (readconfig(fp, "bpp", val, VL) > 0) bppgame = Batoi(val);
|
||||
if (readconfig(fp, "renderer", val, VL) > 0) { i = Batoi(val); setrendermode(i); }
|
||||
if (readconfig(fp, "brightness", val, VL) > 0) brightness = min(max(Batoi(val),0),15);
|
||||
|
||||
#ifdef RENDERTYPEWIN
|
||||
if (readconfig(fp, "maxrefreshfreq", val, VL) > 0) maxrefreshfreq = Batoi(val);
|
||||
#endif
|
||||
|
||||
option[0] = 1; // vesa all the way...
|
||||
option[1] = 1; // sound all the way...
|
||||
option[4] = 0; // no multiplayer
|
||||
option[5] = 0;
|
||||
|
||||
if (readconfig(fp, "keyforward", val, VL) > 0) keys[0] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keybackward", val, VL) > 0) keys[1] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keyturnleft", val, VL) > 0) keys[2] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keyturnright", val, VL) > 0) keys[3] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keyrun", val, VL) > 0) keys[4] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keystrafe", val, VL) > 0) keys[5] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keyfire", val, VL) > 0) keys[6] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keyuse", val, VL) > 0) keys[7] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keystandhigh", val, VL) > 0) keys[8] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keystandlow", val, VL) > 0) keys[9] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keylookup", val, VL) > 0) keys[10] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keylookdown", val, VL) > 0) keys[11] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keystrafeleft", val, VL) > 0) keys[12] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keystraferight", val, VL) > 0) keys[13] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "key2dmode", val, VL) > 0) keys[14] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keyviewcycle", val, VL) > 0) keys[15] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "key2dzoomin", val, VL) > 0) keys[16] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "key2dzoomout", val, VL) > 0) keys[17] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keychat", val, VL) > 0) keys[18] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keyconsole", val, VL) > 0) { keys[19] = Bstrtol(val, NULL, 16); OSD_CaptureKey(keys[19]); }
|
||||
|
||||
if (readconfig(fp, "mousesensitivity", val, VL) > 0) msens = Bstrtod(val, NULL);
|
||||
|
||||
Bfclose(fp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Ken_writesetup(const char *fn)
|
||||
{
|
||||
BFILE *fp;
|
||||
|
||||
fp = Bfopen(fn,"wt");
|
||||
if (!fp) return -1;
|
||||
|
||||
Bfprintf(fp,
|
||||
"; Always show configuration options on startup\n"
|
||||
"; 0 - No\n"
|
||||
"; 1 - Yes\n"
|
||||
"forcesetup = %d\n"
|
||||
"\n"
|
||||
"; Video mode selection\n"
|
||||
"; 0 - Windowed\n"
|
||||
"; 1 - Fullscreen\n"
|
||||
"fullscreen = %d\n"
|
||||
"\n"
|
||||
"; Video resolution\n"
|
||||
"xdim = %d\n"
|
||||
"ydim = %d\n"
|
||||
"\n"
|
||||
"; 3D-mode colour depth\n"
|
||||
"bpp = %d\n"
|
||||
"\n"
|
||||
#ifdef USE_OPENGL
|
||||
"; OpenGL mode options\n"
|
||||
"glusetexcache = %d\n"
|
||||
"\n"
|
||||
#endif
|
||||
#ifdef RENDERTYPEWIN
|
||||
"; Maximum OpenGL mode refresh rate (Windows only, in Hertz)\n"
|
||||
"maxrefreshfreq = %d\n"
|
||||
"\n"
|
||||
#endif
|
||||
"; 3D mode brightness setting\n"
|
||||
"; 0 - lowest\n"
|
||||
"; 15 - highest\n"
|
||||
"brightness = %d\n"
|
||||
"\n"
|
||||
"; Sound sample frequency\n"
|
||||
"; 0 - 6 KHz\n"
|
||||
"; 1 - 8 KHz\n"
|
||||
"; 2 - 11.025 KHz\n"
|
||||
"; 3 - 16 KHz\n"
|
||||
"; 4 - 22.05 KHz\n"
|
||||
"; 5 - 32 KHz\n"
|
||||
"; 6 - 44.1 KHz\n"
|
||||
"samplerate = %d\n"
|
||||
"\n"
|
||||
"; Music playback\n"
|
||||
"; 0 - Off\n"
|
||||
"; 1 - On\n"
|
||||
"music = %d\n"
|
||||
"\n"
|
||||
"; Enable mouse\n"
|
||||
"; 0 - No\n"
|
||||
"; 1 - Yes\n"
|
||||
"mouse = %d\n"
|
||||
"\n"
|
||||
"; Mouse sensitivity\n"
|
||||
"mousesensitivity = %g\n"
|
||||
"\n"
|
||||
"; Key Settings\n"
|
||||
"; Here's a map of all the keyboard scan codes: NOTE: values are listed in hex!\n"
|
||||
"; +---------------------------------------------------------------------------------------------+\n"
|
||||
"; | 01 3B 3C 3D 3E 3F 40 41 42 43 44 57 58 46 |\n"
|
||||
"; |ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 SCROLL |\n"
|
||||
"; | |\n"
|
||||
"; |29 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E D2 C7 C9 45 B5 37 4A |\n"
|
||||
"; | ` '1' '2' '3' '4' '5' '6' '7' '8' '9' '0' - = BACK INS HOME PGUP NUMLK KP/ KP* KP- |\n"
|
||||
"; | |\n"
|
||||
"; | 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 2B D3 CF D1 47 48 49 4E |\n"
|
||||
"; |TAB Q W E R T Y U I O P [ ] \\ DEL END PGDN KP7 KP8 KP9 KP+ |\n"
|
||||
"; | |\n"
|
||||
"; | 3A 1E 1F 20 21 22 23 24 25 26 27 28 1C 4B 4C 4D |\n"
|
||||
"; |CAPS A S D F G H J K L ; ' ENTER KP4 KP5 KP6 9C |\n"
|
||||
"; | KPENTER|\n"
|
||||
"; | 2A 2C 2D 2E 2F 30 31 32 33 34 35 36 C8 4F 50 51 |\n"
|
||||
"; |LSHIFT Z X C V B N M , . / RSHIFT UP KP1 KP2 KP3 |\n"
|
||||
"; | |\n"
|
||||
"; | 1D 38 39 B8 9D CB D0 CD 52 53 |\n"
|
||||
"; |LCTRL LALT SPACE RALT RCTRL LEFT DOWN RIGHT KP0 KP. |\n"
|
||||
"; +---------------------------------------------------------------------------------------------+\n"
|
||||
"\n"
|
||||
"keyforward = %X\n"
|
||||
"keybackward = %X\n"
|
||||
"keyturnleft = %X\n"
|
||||
"keyturnright = %X\n"
|
||||
"keyrun = %X\n"
|
||||
"keystrafe = %X\n"
|
||||
"keyfire = %X\n"
|
||||
"keyuse = %X\n"
|
||||
"keystandhigh = %X\n"
|
||||
"keystandlow = %X\n"
|
||||
"keylookup = %X\n"
|
||||
"keylookdown = %X\n"
|
||||
"keystrafeleft = %X\n"
|
||||
"keystraferight = %X\n"
|
||||
"key2dmode = %X\n"
|
||||
"keyviewcycle = %X\n"
|
||||
"key2dzoomin = %X\n"
|
||||
"key2dzoomout = %X\n"
|
||||
"keychat = %X\n"
|
||||
"keyconsole = %X\n"
|
||||
"\n",
|
||||
|
||||
forcesetup, fullscreen, xdimgame, ydimgame, bppgame,
|
||||
#ifdef USE_OPENGL
|
||||
glusetexcache,
|
||||
#endif
|
||||
#ifdef RENDERTYPEWIN
|
||||
maxrefreshfreq,
|
||||
#endif
|
||||
brightness, option[7]>>4, option[2],
|
||||
option[3], msens,
|
||||
keys[0], keys[1], keys[2], keys[3], keys[4], keys[5],
|
||||
keys[6], keys[7], keys[8], keys[9], keys[10], keys[11],
|
||||
keys[12], keys[13], keys[14], keys[15], keys[16], keys[17],
|
||||
keys[18], keys[19]
|
||||
);
|
||||
|
||||
Bfclose(fp);
|
||||
|
||||
return 0;
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,55 +0,0 @@
|
|||
// game.h
|
||||
|
||||
void operatesector(short dasector);
|
||||
void operatesprite(short dasprite);
|
||||
int changehealth(short snum, short deltahealth);
|
||||
void changenumbombs(short snum, short deltanumbombs);
|
||||
void changenummissiles(short snum, short deltanummissiles);
|
||||
void changenumgrabbers(short snum, short deltanumgrabbers);
|
||||
void drawstatusflytime(short snum);
|
||||
void drawstatusbar(short snum);
|
||||
void prepareboard(char *daboardfilename);
|
||||
void checktouchsprite(short snum, short sectnum);
|
||||
void checkgrabbertouchsprite(short snum, short sectnum);
|
||||
void shootgun(short snum, const vec3_t *vector, short daang, int dahoriz, short dasectnum, char guntype);
|
||||
void analyzesprites(int dax, int day);
|
||||
void tagcode(void);
|
||||
void statuslistcode(void);
|
||||
void activatehitag(short dahitag);
|
||||
void bombexplode(int i);
|
||||
void processinput(short snum);
|
||||
void view(short snum, vec3_t *v, short *vsectnum, short ang, int horiz);
|
||||
void drawscreen(short snum, int dasmoothratio);
|
||||
void movethings(void);
|
||||
void fakedomovethings(void);
|
||||
void fakedomovethingscorrect(void);
|
||||
void domovethings(void);
|
||||
void getinput(void);
|
||||
void initplayersprite(short snum);
|
||||
void playback(void);
|
||||
void setup3dscreen(void);
|
||||
void findrandomspot(int *x, int *y, short *sectnum);
|
||||
void warp(int *x, int *y, int *z, short *daang, short *dasector);
|
||||
void warpsprite(short spritenum);
|
||||
void initlava(void);
|
||||
void movelava(char *dapic);
|
||||
void doanimations(void);
|
||||
int getanimationgoal(int *animptr);
|
||||
int setanimation(int *animptr, int thegoal, int thevel, int theacc);
|
||||
void checkmasterslaveswitch(void);
|
||||
int testneighborsectors(short sect1, short sect2);
|
||||
int loadgame(void);
|
||||
int savegame(void);
|
||||
void faketimerhandler(void);
|
||||
void getpackets(void);
|
||||
void drawoverheadmap(int cposx, int cposy, int czoom, short cang);
|
||||
int movesprite(short spritenum, int dx, int dy, int dz, int ceildist, int flordist, int clipmask);
|
||||
void waitforeverybody(void);
|
||||
void searchmap(short startsector);
|
||||
void setinterpolation(int *posptr);
|
||||
void stopinterpolation(int *posptr);
|
||||
void updateinterpolations(void);
|
||||
void dointerpolations(void);
|
||||
void restoreinterpolations(void);
|
||||
void printext(int x, int y, char *buffer, short tilenum /*, char invisiblecol*/);
|
||||
void drawtilebackground(/*int thex, int they,*/ short tilenum, signed char shade, int cx1, int cy1, int cx2, int cy2, char dapalnum);
|
|
@ -1,49 +0,0 @@
|
|||
//Be careful when changing this file - it is parsed by Editart and Build.
|
||||
#define SWITCH1ON 15
|
||||
#define SLIME 34
|
||||
#define BACKGROUND 37
|
||||
#define KENPICTURE 48
|
||||
#define BUILDDISK 49
|
||||
#define SWITCH2ON 66
|
||||
#define SWITCH2OFF 69
|
||||
#define ALPHABET 73
|
||||
#define NO 74
|
||||
#define DEMOSIGN 75
|
||||
#define COIN 76
|
||||
#define COINSTACK 77
|
||||
#define GIFTBOX 78
|
||||
#define DIAMONDS 79
|
||||
#define EVILALGRAVE 83
|
||||
#define STATUSBAR 87
|
||||
#define DAYSKY 89
|
||||
#define WATERFOUNTAIN 90
|
||||
#define USEWATERFOUNTAIN 91
|
||||
#define NIGHTSKY 93
|
||||
#define BULLET 98
|
||||
#define BOMB 100
|
||||
#define CANNON 101
|
||||
#define GUNONBOTTOM 102
|
||||
#define BOMBEMITTER 103
|
||||
#define EXPLOSION 105
|
||||
#define SPLASH 106
|
||||
#define BROWNMONSTER 110
|
||||
#define SKELETON 113
|
||||
#define AL 114
|
||||
#define EVILAL 115
|
||||
#define PLAYER 120
|
||||
#define SWITCH3OFF 146
|
||||
#define SWITCH3ON 147
|
||||
#define AIRPLANE 148
|
||||
#define SPIRAL 149
|
||||
#define COMPASS 150
|
||||
#define FOOTPRINT 156
|
||||
#define STATUSBARFILL8 160
|
||||
#define STATUSBARFILL4 161
|
||||
#define BOUNCYMAT 162
|
||||
#define MIRROR 165
|
||||
#define FLOORMIRROR 166
|
||||
#define GRABBER 167
|
||||
#define GRABCANNON 168
|
||||
#define MISSILE 169
|
||||
#define LAUNCHER 171
|
||||
#define MIRRORLABEL 4000
|
|
@ -1,64 +0,0 @@
|
|||
|
||||
#include "compat.h"
|
||||
|
||||
void initsb(char dadigistat, char damusistat, int dasamplerate, char danumspeakers, char dabytespersample, char daintspersec, char daquality)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(dadigistat);
|
||||
UNREFERENCED_PARAMETER(damusistat);
|
||||
UNREFERENCED_PARAMETER(dasamplerate);
|
||||
UNREFERENCED_PARAMETER(danumspeakers);
|
||||
UNREFERENCED_PARAMETER(dabytespersample);
|
||||
UNREFERENCED_PARAMETER(daintspersec);
|
||||
UNREFERENCED_PARAMETER(daquality);
|
||||
}
|
||||
|
||||
void uninitsb(void)
|
||||
{
|
||||
}
|
||||
|
||||
void setears(int daposx, int daposy, int daxvect, int dayvect)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(daposx);
|
||||
UNREFERENCED_PARAMETER(daposy);
|
||||
UNREFERENCED_PARAMETER(daxvect);
|
||||
UNREFERENCED_PARAMETER(dayvect);
|
||||
}
|
||||
|
||||
void wsayfollow(char const *dafilename, int dafreq, int davol, int *daxplc, int *dayplc, char followstat)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(dafilename);
|
||||
UNREFERENCED_PARAMETER(dafreq);
|
||||
UNREFERENCED_PARAMETER(davol);
|
||||
UNREFERENCED_PARAMETER(daxplc);
|
||||
UNREFERENCED_PARAMETER(dayplc);
|
||||
UNREFERENCED_PARAMETER(followstat);
|
||||
}
|
||||
|
||||
void wsay(char const *dafilename, int dafreq, int volume1, int volume2)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(dafilename);
|
||||
UNREFERENCED_PARAMETER(dafreq);
|
||||
UNREFERENCED_PARAMETER(volume1);
|
||||
UNREFERENCED_PARAMETER(volume2);
|
||||
}
|
||||
|
||||
void loadwaves(void)
|
||||
{
|
||||
}
|
||||
|
||||
void loadsong(char const *filename)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(filename);
|
||||
}
|
||||
|
||||
void musicon(void)
|
||||
{
|
||||
}
|
||||
|
||||
void musicoff(void)
|
||||
{
|
||||
}
|
||||
|
||||
void refreshaudio(void)
|
||||
{
|
||||
}
|
|
@ -1,546 +0,0 @@
|
|||
/* NOTE: Glade will generate code for a dialogue box which you should
|
||||
* then patch into this file whenever you make a change to the Glade
|
||||
* template.
|
||||
*/
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
#include "gtkpixdata.h"
|
||||
#include <gdk-pixbuf/gdk-pixdata.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "dynamicgtk.h"
|
||||
|
||||
#include "baselayer.h"
|
||||
#include "compat.h"
|
||||
#include "build.h"
|
||||
|
||||
#define TAB_CONFIG 0
|
||||
#define TAB_MESSAGES 1
|
||||
|
||||
static struct
|
||||
{
|
||||
int fullscreen;
|
||||
int xdim3d, ydim3d, bpp3d;
|
||||
int forcesetup;
|
||||
} settings;
|
||||
|
||||
extern int gtkenabled;
|
||||
|
||||
static GtkWidget *startwin = NULL;
|
||||
static int retval = -1, mode = TAB_MESSAGES;
|
||||
|
||||
// -- SUPPORT FUNCTIONS -------------------------------------------------------
|
||||
|
||||
#define GLADE_HOOKUP_OBJECT(component,widget,name) \
|
||||
g_object_set_data_full (G_OBJECT (component), name, \
|
||||
gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
|
||||
|
||||
#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
|
||||
g_object_set_data (G_OBJECT (component), name, widget)
|
||||
|
||||
#define lookup_widget(x,w) \
|
||||
(GtkWidget*) g_object_get_data(G_OBJECT(x), w)
|
||||
|
||||
static GdkPixbuf *load_banner(void)
|
||||
{
|
||||
return gdk_pixbuf_from_pixdata((GdkPixdata const *)&startbanner_pixdata, FALSE, NULL);
|
||||
}
|
||||
|
||||
static void SetPage(int n)
|
||||
{
|
||||
if (!gtkenabled || !startwin) return;
|
||||
mode = n;
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(lookup_widget(startwin,"tabs")), n);
|
||||
|
||||
// each control in the config page vertical layout plus the start button should be made (in)sensitive
|
||||
if (n == TAB_CONFIG) n = TRUE; else n = FALSE;
|
||||
gtk_widget_set_sensitive(lookup_widget(startwin,"startbutton"), n);
|
||||
gtk_container_foreach(GTK_CONTAINER(lookup_widget(startwin,"configvlayout")),
|
||||
(GtkCallback)gtk_widget_set_sensitive, (gpointer)n);
|
||||
}
|
||||
|
||||
static void on_vmode3dcombo_changed(GtkComboBox *, gpointer);
|
||||
static void PopulateForm(void)
|
||||
{
|
||||
int mode3d, i;
|
||||
GtkListStore *modes3d;
|
||||
GtkTreeIter iter;
|
||||
GtkComboBox *box3d;
|
||||
char buf[64];
|
||||
|
||||
mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1);
|
||||
if (mode3d < 0)
|
||||
{
|
||||
int i, cd[] = { 32, 24, 16, 15, 8, 0 };
|
||||
for (i=0; cd[i]; ) { if (cd[i] >= settings.bpp3d) i++; else break; }
|
||||
for (; cd[i]; i++)
|
||||
{
|
||||
mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1);
|
||||
if (mode3d < 0) continue;
|
||||
settings.bpp3d = cd[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(startwin,"fullscreencheck")), settings.fullscreen);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(startwin,"alwaysshowcheck")), settings.forcesetup);
|
||||
|
||||
box3d = GTK_COMBO_BOX(lookup_widget(startwin,"vmode3dcombo"));
|
||||
modes3d = GTK_LIST_STORE(gtk_combo_box_get_model(box3d));
|
||||
gtk_list_store_clear(modes3d);
|
||||
|
||||
for (i=0; i<validmodecnt; i++)
|
||||
{
|
||||
if (validmode[i].fs != settings.fullscreen) continue;
|
||||
|
||||
// all modes get added to the 3D mode list
|
||||
Bsprintf(buf, "%ld x %ld %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp);
|
||||
gtk_list_store_append(modes3d, &iter);
|
||||
gtk_list_store_set(modes3d, &iter, 0,buf, 1,i, -1);
|
||||
if (i == mode3d)
|
||||
{
|
||||
g_signal_handlers_block_by_func(box3d, on_vmode3dcombo_changed, NULL);
|
||||
gtk_combo_box_set_active_iter(box3d, &iter);
|
||||
g_signal_handlers_unblock_by_func(box3d, on_vmode3dcombo_changed, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -- EVENT CALLBACKS AND CREATION STUFF --------------------------------------
|
||||
|
||||
static void on_vmode3dcombo_changed(GtkComboBox *combobox, gpointer user_data)
|
||||
{
|
||||
GtkTreeModel *data;
|
||||
GtkTreeIter iter;
|
||||
int val;
|
||||
if (!gtk_combo_box_get_active_iter(combobox, &iter)) return;
|
||||
if (!(data = gtk_combo_box_get_model(combobox))) return;
|
||||
gtk_tree_model_get(data, &iter, 1, &val, -1);
|
||||
settings.xdim3d = validmode[val].xdim;
|
||||
settings.ydim3d = validmode[val].ydim;
|
||||
}
|
||||
|
||||
static void on_fullscreencheck_toggled(GtkToggleButton *togglebutton, gpointer user_data)
|
||||
{
|
||||
settings.fullscreen = (gtk_toggle_button_get_active(togglebutton) == TRUE);
|
||||
PopulateForm();
|
||||
}
|
||||
|
||||
static void on_alwaysshowcheck_toggled(GtkToggleButton *togglebutton, gpointer user_data)
|
||||
{
|
||||
settings.forcesetup = (gtk_toggle_button_get_active(togglebutton) == TRUE);
|
||||
}
|
||||
|
||||
static void on_cancelbutton_clicked(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
if (mode == TAB_CONFIG) { retval = 0; gtk_main_quit(); }
|
||||
else quitevent++;
|
||||
}
|
||||
|
||||
static void on_startbutton_clicked(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
retval = 1;
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
static gboolean on_startwin_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data)
|
||||
{
|
||||
if (mode == TAB_CONFIG) { retval = 0; gtk_main_quit(); }
|
||||
else quitevent++;
|
||||
return TRUE; // FALSE would let the event go through. we want the game to decide when to close
|
||||
}
|
||||
|
||||
|
||||
static GtkWidget *create_window(void)
|
||||
{
|
||||
GtkWidget *startwin;
|
||||
GtkWidget *hlayout;
|
||||
GtkWidget *banner;
|
||||
GtkWidget *vlayout;
|
||||
GtkWidget *tabs;
|
||||
GtkWidget *configvlayout;
|
||||
GtkWidget *configlayout;
|
||||
GtkWidget *vmode3dlabel;
|
||||
GtkWidget *vmode3dcombo;
|
||||
GtkWidget *fullscreencheck;
|
||||
GtkWidget *alwaysshowcheck;
|
||||
GtkWidget *configtab;
|
||||
GtkWidget *messagesscroll;
|
||||
GtkWidget *messagestext;
|
||||
GtkWidget *messagestab;
|
||||
GtkWidget *buttons;
|
||||
GtkWidget *cancelbutton;
|
||||
GtkWidget *cancelbuttonalign;
|
||||
GtkWidget *cancelbuttonlayout;
|
||||
GtkWidget *cancelbuttonicon;
|
||||
GtkWidget *cancelbuttonlabel;
|
||||
GtkWidget *startbutton;
|
||||
GtkWidget *startbuttonalign;
|
||||
GtkWidget *startbuttonlayout;
|
||||
GtkWidget *startbuttonicon;
|
||||
GtkWidget *startbuttonlabel;
|
||||
GtkAccelGroup *accel_group;
|
||||
|
||||
accel_group = gtk_accel_group_new();
|
||||
|
||||
// Basic window
|
||||
startwin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title(GTK_WINDOW(startwin), apptitle); // NOTE: use global app title
|
||||
gtk_window_set_position(GTK_WINDOW(startwin), GTK_WIN_POS_CENTER);
|
||||
gtk_window_set_resizable(GTK_WINDOW(startwin), FALSE);
|
||||
gtk_window_set_type_hint(GTK_WINDOW(startwin), GDK_WINDOW_TYPE_HINT_DIALOG);
|
||||
|
||||
// Horizontal layout of banner and controls
|
||||
hlayout = gtk_hbox_new(FALSE, 0);
|
||||
gtk_widget_show(hlayout);
|
||||
gtk_container_add(GTK_CONTAINER(startwin), hlayout);
|
||||
|
||||
// Banner
|
||||
{
|
||||
GdkPixbuf *pixbuf = load_banner();
|
||||
banner = gtk_image_new_from_pixbuf(pixbuf);
|
||||
g_object_unref((gpointer)pixbuf);
|
||||
}
|
||||
gtk_widget_show(banner);
|
||||
gtk_box_pack_start(GTK_BOX(hlayout), banner, FALSE, FALSE, 0);
|
||||
gtk_misc_set_alignment(GTK_MISC(banner), 0.5, 0);
|
||||
|
||||
// Vertical layout of tab control and start+cancel buttons
|
||||
vlayout = gtk_vbox_new(FALSE, 0);
|
||||
gtk_widget_show(vlayout);
|
||||
gtk_box_pack_start(GTK_BOX(hlayout), vlayout, TRUE, TRUE, 0);
|
||||
|
||||
// Tab control
|
||||
tabs = gtk_notebook_new();
|
||||
gtk_widget_show(tabs);
|
||||
gtk_box_pack_start(GTK_BOX(vlayout), tabs, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(tabs), 4);
|
||||
|
||||
// Vertical layout of config page main body
|
||||
configvlayout = gtk_vbox_new(FALSE, 0);
|
||||
gtk_widget_show(configvlayout);
|
||||
gtk_container_add(GTK_CONTAINER(tabs), configvlayout);
|
||||
|
||||
// Fixed-position layout of config page controls
|
||||
configlayout = gtk_fixed_new();
|
||||
gtk_widget_show(configlayout);
|
||||
gtk_box_pack_start(GTK_BOX(configvlayout), configlayout, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(configlayout), 6);
|
||||
|
||||
// 3D video mode label
|
||||
vmode3dlabel = gtk_label_new_with_mnemonic("_Video mode:");
|
||||
gtk_widget_show(vmode3dlabel);
|
||||
gtk_fixed_put(GTK_FIXED(configlayout), vmode3dlabel, 0, 0);
|
||||
gtk_widget_set_size_request(vmode3dlabel, 88, 29);
|
||||
gtk_misc_set_alignment(GTK_MISC(vmode3dlabel), 0, 0.5);
|
||||
|
||||
// 3D video mode combo
|
||||
{
|
||||
GtkListStore *list = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
|
||||
GtkCellRenderer *cell;
|
||||
|
||||
vmode3dcombo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(list));
|
||||
g_object_unref(G_OBJECT(list));
|
||||
|
||||
cell = gtk_cell_renderer_text_new();
|
||||
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(vmode3dcombo), cell, FALSE);
|
||||
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(vmode3dcombo), cell, "text", 0, NULL);
|
||||
}
|
||||
gtk_widget_show(vmode3dcombo);
|
||||
gtk_fixed_put(GTK_FIXED(configlayout), vmode3dcombo, 88, 0);
|
||||
gtk_widget_set_size_request(vmode3dcombo, 150, 29);
|
||||
gtk_widget_add_accelerator(vmode3dcombo, "grab_focus", accel_group,
|
||||
GDK_V, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
// Fullscreen checkbox
|
||||
fullscreencheck = gtk_check_button_new_with_mnemonic("_Fullscreen");
|
||||
gtk_widget_show(fullscreencheck);
|
||||
gtk_fixed_put(GTK_FIXED(configlayout), fullscreencheck, 248, 0);
|
||||
gtk_widget_set_size_request(fullscreencheck, 85, 29);
|
||||
gtk_widget_add_accelerator(fullscreencheck, "grab_focus", accel_group,
|
||||
GDK_F, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
// Always show config checkbox
|
||||
alwaysshowcheck = gtk_check_button_new_with_mnemonic("_Always show configuration on start");
|
||||
gtk_widget_show(alwaysshowcheck);
|
||||
gtk_box_pack_start(GTK_BOX(configvlayout), alwaysshowcheck, FALSE, FALSE, 0);
|
||||
gtk_widget_add_accelerator(alwaysshowcheck, "grab_focus", accel_group,
|
||||
GDK_A, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
// Configuration tab
|
||||
configtab = gtk_label_new("Configuration");
|
||||
gtk_widget_show(configtab);
|
||||
gtk_notebook_set_tab_label(GTK_NOTEBOOK(tabs), gtk_notebook_get_nth_page(GTK_NOTEBOOK(tabs), 0), configtab);
|
||||
|
||||
// Messages scrollable area
|
||||
messagesscroll = gtk_scrolled_window_new(NULL, NULL);
|
||||
gtk_widget_show(messagesscroll);
|
||||
gtk_container_add(GTK_CONTAINER(tabs), messagesscroll);
|
||||
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(messagesscroll), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
|
||||
|
||||
// Messages text area
|
||||
messagestext = gtk_text_view_new();
|
||||
gtk_widget_show(messagestext);
|
||||
gtk_container_add(GTK_CONTAINER(messagesscroll), messagestext);
|
||||
gtk_text_view_set_editable(GTK_TEXT_VIEW(messagestext), FALSE);
|
||||
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(messagestext), GTK_WRAP_WORD);
|
||||
gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(messagestext), FALSE);
|
||||
gtk_text_view_set_left_margin(GTK_TEXT_VIEW(messagestext), 2);
|
||||
gtk_text_view_set_right_margin(GTK_TEXT_VIEW(messagestext), 2);
|
||||
|
||||
// Messages tab
|
||||
messagestab = gtk_label_new("Messages");
|
||||
gtk_widget_show(messagestab);
|
||||
gtk_notebook_set_tab_label(GTK_NOTEBOOK(tabs), gtk_notebook_get_nth_page(GTK_NOTEBOOK(tabs), 1), messagestab);
|
||||
|
||||
// Dialogue box buttons layout
|
||||
buttons = gtk_hbutton_box_new();
|
||||
gtk_widget_show(buttons);
|
||||
gtk_box_pack_start(GTK_BOX(vlayout), buttons, FALSE, TRUE, 0);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(buttons), 3);
|
||||
gtk_button_box_set_layout(GTK_BUTTON_BOX(buttons), GTK_BUTTONBOX_END);
|
||||
|
||||
// Cancel button
|
||||
cancelbutton = gtk_button_new();
|
||||
gtk_widget_show(cancelbutton);
|
||||
gtk_container_add(GTK_CONTAINER(buttons), cancelbutton);
|
||||
GTK_WIDGET_SET_FLAGS(cancelbutton, GTK_CAN_DEFAULT);
|
||||
gtk_widget_add_accelerator(cancelbutton, "grab_focus", accel_group,
|
||||
GDK_C, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
gtk_widget_add_accelerator(cancelbutton, "clicked", accel_group,
|
||||
GDK_Escape, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
cancelbuttonalign = gtk_alignment_new(0.5, 0.5, 0, 0);
|
||||
gtk_widget_show(cancelbuttonalign);
|
||||
gtk_container_add(GTK_CONTAINER(cancelbutton), cancelbuttonalign);
|
||||
|
||||
cancelbuttonlayout = gtk_hbox_new(FALSE, 2);
|
||||
gtk_widget_show(cancelbuttonlayout);
|
||||
gtk_container_add(GTK_CONTAINER(cancelbuttonalign), cancelbuttonlayout);
|
||||
|
||||
cancelbuttonicon = gtk_image_new_from_stock("gtk-cancel", GTK_ICON_SIZE_BUTTON);
|
||||
gtk_widget_show(cancelbuttonicon);
|
||||
gtk_box_pack_start(GTK_BOX(cancelbuttonlayout), cancelbuttonicon, FALSE, FALSE, 0);
|
||||
|
||||
cancelbuttonlabel = gtk_label_new_with_mnemonic("_Cancel");
|
||||
gtk_widget_show(cancelbuttonlabel);
|
||||
gtk_box_pack_start(GTK_BOX(cancelbuttonlayout), cancelbuttonlabel, FALSE, FALSE, 0);
|
||||
|
||||
// Start button
|
||||
startbutton = gtk_button_new();
|
||||
gtk_widget_show(startbutton);
|
||||
gtk_container_add(GTK_CONTAINER(buttons), startbutton);
|
||||
GTK_WIDGET_SET_FLAGS(startbutton, GTK_CAN_DEFAULT);
|
||||
gtk_widget_add_accelerator(startbutton, "grab_focus", accel_group,
|
||||
GDK_S, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
gtk_widget_add_accelerator(startbutton, "clicked", accel_group,
|
||||
GDK_Return, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
startbuttonalign = gtk_alignment_new(0.5, 0.5, 0, 0);
|
||||
gtk_widget_show(startbuttonalign);
|
||||
gtk_container_add(GTK_CONTAINER(startbutton), startbuttonalign);
|
||||
|
||||
startbuttonlayout = gtk_hbox_new(FALSE, 2);
|
||||
gtk_widget_show(startbuttonlayout);
|
||||
gtk_container_add(GTK_CONTAINER(startbuttonalign), startbuttonlayout);
|
||||
|
||||
startbuttonicon = gtk_image_new_from_stock("gtk-execute", GTK_ICON_SIZE_BUTTON);
|
||||
gtk_widget_show(startbuttonicon);
|
||||
gtk_box_pack_start(GTK_BOX(startbuttonlayout), startbuttonicon, FALSE, FALSE, 0);
|
||||
|
||||
startbuttonlabel = gtk_label_new_with_mnemonic("_Start");
|
||||
gtk_widget_show(startbuttonlabel);
|
||||
gtk_box_pack_start(GTK_BOX(startbuttonlayout), startbuttonlabel, FALSE, FALSE, 0);
|
||||
|
||||
// Wire up the signals
|
||||
g_signal_connect((gpointer) startwin, "delete_event",
|
||||
G_CALLBACK(on_startwin_delete_event),
|
||||
NULL);
|
||||
g_signal_connect((gpointer) vmode3dcombo, "changed",
|
||||
G_CALLBACK(on_vmode3dcombo_changed),
|
||||
NULL);
|
||||
g_signal_connect((gpointer) fullscreencheck, "toggled",
|
||||
G_CALLBACK(on_fullscreencheck_toggled),
|
||||
NULL);
|
||||
g_signal_connect((gpointer) alwaysshowcheck, "toggled",
|
||||
G_CALLBACK(on_alwaysshowcheck_toggled),
|
||||
NULL);
|
||||
g_signal_connect((gpointer) cancelbutton, "clicked",
|
||||
G_CALLBACK(on_cancelbutton_clicked),
|
||||
NULL);
|
||||
g_signal_connect((gpointer) startbutton, "clicked",
|
||||
G_CALLBACK(on_startbutton_clicked),
|
||||
NULL);
|
||||
|
||||
// Associate labels with their controls
|
||||
gtk_label_set_mnemonic_widget(GTK_LABEL(vmode3dlabel), vmode3dcombo);
|
||||
|
||||
/* Store pointers to all widgets, for use by lookup_widget(). */
|
||||
GLADE_HOOKUP_OBJECT_NO_REF(startwin, startwin, "startwin");
|
||||
GLADE_HOOKUP_OBJECT(startwin, hlayout, "hlayout");
|
||||
GLADE_HOOKUP_OBJECT(startwin, banner, "banner");
|
||||
GLADE_HOOKUP_OBJECT(startwin, vlayout, "vlayout");
|
||||
GLADE_HOOKUP_OBJECT(startwin, tabs, "tabs");
|
||||
GLADE_HOOKUP_OBJECT(startwin, configvlayout, "configvlayout");
|
||||
GLADE_HOOKUP_OBJECT(startwin, configlayout, "configlayout");
|
||||
GLADE_HOOKUP_OBJECT(startwin, vmode3dlabel, "vmode3dlabel");
|
||||
GLADE_HOOKUP_OBJECT(startwin, vmode3dcombo, "vmode3dcombo");
|
||||
GLADE_HOOKUP_OBJECT(startwin, fullscreencheck, "fullscreencheck");
|
||||
GLADE_HOOKUP_OBJECT(startwin, alwaysshowcheck, "alwaysshowcheck");
|
||||
GLADE_HOOKUP_OBJECT(startwin, configtab, "configtab");
|
||||
GLADE_HOOKUP_OBJECT(startwin, messagesscroll, "messagesscroll");
|
||||
GLADE_HOOKUP_OBJECT(startwin, messagestext, "messagestext");
|
||||
GLADE_HOOKUP_OBJECT(startwin, messagestab, "messagestab");
|
||||
GLADE_HOOKUP_OBJECT(startwin, buttons, "buttons");
|
||||
GLADE_HOOKUP_OBJECT(startwin, cancelbutton, "cancelbutton");
|
||||
GLADE_HOOKUP_OBJECT(startwin, cancelbuttonalign, "cancelbuttonalign");
|
||||
GLADE_HOOKUP_OBJECT(startwin, cancelbuttonlayout, "cancelbuttonlayout");
|
||||
GLADE_HOOKUP_OBJECT(startwin, cancelbuttonicon, "cancelbuttonicon");
|
||||
GLADE_HOOKUP_OBJECT(startwin, cancelbuttonlabel, "cancelbuttonlabel");
|
||||
GLADE_HOOKUP_OBJECT(startwin, startbutton, "startbutton");
|
||||
GLADE_HOOKUP_OBJECT(startwin, startbuttonalign, "startbuttonalign");
|
||||
GLADE_HOOKUP_OBJECT(startwin, startbuttonlayout, "startbuttonlayout");
|
||||
GLADE_HOOKUP_OBJECT(startwin, startbuttonicon, "startbuttonicon");
|
||||
GLADE_HOOKUP_OBJECT(startwin, startbuttonlabel, "startbuttonlabel");
|
||||
|
||||
gtk_window_add_accel_group(GTK_WINDOW(startwin), accel_group);
|
||||
|
||||
return startwin;
|
||||
}
|
||||
|
||||
// -- BUILD ENTRY POINTS ------------------------------------------------------
|
||||
|
||||
int startwin_open(void)
|
||||
{
|
||||
if (!gtkenabled) return 0;
|
||||
if (startwin) return 1;
|
||||
|
||||
startwin = create_window();
|
||||
if (startwin)
|
||||
{
|
||||
SetPage(TAB_MESSAGES);
|
||||
gtk_widget_show(startwin);
|
||||
gtk_main_iteration_do(FALSE);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int startwin_close(void)
|
||||
{
|
||||
if (!gtkenabled) return 0;
|
||||
if (!startwin) return 1;
|
||||
gtk_widget_destroy(startwin);
|
||||
startwin = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int startwin_puts(const char *str)
|
||||
{
|
||||
GtkWidget *textview;
|
||||
GtkTextBuffer *textbuffer;
|
||||
GtkTextIter enditer;
|
||||
GtkTextMark *mark;
|
||||
const char *aptr, *bptr;
|
||||
|
||||
if (!gtkenabled || !str) return 0;
|
||||
if (!startwin) return 1;
|
||||
if (!(textview = lookup_widget(startwin, "messagestext"))) return -1;
|
||||
textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
|
||||
|
||||
gtk_text_buffer_get_end_iter(textbuffer, &enditer);
|
||||
for (aptr = bptr = str; *aptr != 0; )
|
||||
{
|
||||
switch (*bptr)
|
||||
{
|
||||
case '\b':
|
||||
if (bptr > aptr)
|
||||
gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)-1);
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
gtk_text_buffer_backspace(textbuffer, &enditer, FALSE, TRUE);
|
||||
#else
|
||||
{
|
||||
GtkTextIter iter2 = enditer;
|
||||
gtk_text_iter_backward_cursor_position(&iter2);
|
||||
//FIXME: this seems be deleting one too many chars somewhere!
|
||||
if (!gtk_text_iter_equal(&iter2, &enditer))
|
||||
gtk_text_buffer_delete_interactive(textbuffer, &iter2, &enditer, TRUE);
|
||||
}
|
||||
#endif
|
||||
aptr = ++bptr;
|
||||
break;
|
||||
case 0:
|
||||
if (bptr > aptr)
|
||||
gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr));
|
||||
aptr = bptr;
|
||||
break;
|
||||
case '\r': // FIXME
|
||||
default:
|
||||
bptr++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mark = gtk_text_buffer_create_mark(textbuffer, NULL, &enditer, 1);
|
||||
gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(textview), mark, 0.0, FALSE, 0.0, 1.0);
|
||||
gtk_text_buffer_delete_mark(textbuffer, mark);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int startwin_settitle(const char *title)
|
||||
{
|
||||
if (!gtkenabled) return 0;
|
||||
if (!startwin) return 1;
|
||||
gtk_window_set_title(GTK_WINDOW(startwin), title);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int startwin_idle(void *s)
|
||||
{
|
||||
if (!gtkenabled) return 0;
|
||||
//if (!startwin) return 1;
|
||||
gtk_main_iteration_do(FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern int xdimgame, ydimgame, bppgame, forcesetup;
|
||||
|
||||
int startwin_run(void)
|
||||
{
|
||||
if (!gtkenabled) return 0;
|
||||
if (!startwin) return 1;
|
||||
|
||||
SetPage(TAB_CONFIG);
|
||||
|
||||
settings.fullscreen = fullscreen;
|
||||
settings.xdim3d = xdimgame;
|
||||
settings.ydim3d = ydimgame;
|
||||
settings.bpp3d = bppgame;
|
||||
settings.forcesetup = forcesetup;
|
||||
PopulateForm();
|
||||
|
||||
gtk_main();
|
||||
|
||||
SetPage(TAB_MESSAGES);
|
||||
if (retval)
|
||||
{
|
||||
fullscreen = settings.fullscreen;
|
||||
xdimgame = settings.xdim3d;
|
||||
ydimgame = settings.ydim3d;
|
||||
bppgame = settings.bpp3d;
|
||||
forcesetup = settings.forcesetup;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
|
@ -1,450 +0,0 @@
|
|||
#ifndef _WIN32
|
||||
#error Only for Windows
|
||||
#endif
|
||||
|
||||
#include "compat.h"
|
||||
#include "build.h"
|
||||
|
||||
#define NEED_WINDOWSX_H
|
||||
#define NEED_COMMCTRL_H
|
||||
#include "windows_inc.h"
|
||||
|
||||
#include "winlayer.h"
|
||||
|
||||
#include "startwin.game.h"
|
||||
|
||||
#define TAB_CONFIG 0
|
||||
#define TAB_MESSAGES 1
|
||||
|
||||
static struct
|
||||
{
|
||||
int fullscreen;
|
||||
int xdim3d, ydim3d, bpp3d;
|
||||
int forcesetup;
|
||||
} settings;
|
||||
|
||||
static HWND startupdlg = NULL;
|
||||
static HWND pages[2] = { NULL, NULL};
|
||||
static int done = -1, mode = TAB_CONFIG;
|
||||
|
||||
static void PopulateForm(void)
|
||||
{
|
||||
int i,j;
|
||||
char buf[64];
|
||||
int mode3d;
|
||||
HWND hwnd3d;
|
||||
|
||||
hwnd3d = GetDlgItem(pages[TAB_CONFIG], IDC3DVMODE);
|
||||
|
||||
mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1);
|
||||
if (mode3d < 0)
|
||||
{
|
||||
int cd[] = { 32, 24, 16, 15, 8, 0 };
|
||||
for (i=0; cd[i]; ) { if (cd[i] >= settings.bpp3d) i++; else break; }
|
||||
for (; cd[i]; i++)
|
||||
{
|
||||
mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1);
|
||||
if (mode3d < 0) continue;
|
||||
settings.bpp3d = cd[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), (settings.fullscreen ? BST_CHECKED : BST_UNCHECKED));
|
||||
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCALWAYSSHOW), (settings.forcesetup ? BST_CHECKED : BST_UNCHECKED));
|
||||
|
||||
ComboBox_ResetContent(hwnd3d);
|
||||
for (i=0; i<validmodecnt; i++)
|
||||
{
|
||||
if (validmode[i].fs != settings.fullscreen) continue;
|
||||
|
||||
// all modes get added to the 3D mode list
|
||||
Bsprintf(buf, "%d x %d %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp);
|
||||
j = ComboBox_AddString(hwnd3d, buf);
|
||||
ComboBox_SetItemData(hwnd3d, j, i);
|
||||
if (i == mode3d) ComboBox_SetCurSel(hwnd3d, j);
|
||||
}
|
||||
}
|
||||
|
||||
static INT_PTR CALLBACK ConfigPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDCFULLSCREEN:
|
||||
settings.fullscreen = !settings.fullscreen;
|
||||
PopulateForm();
|
||||
return TRUE;
|
||||
case IDC3DVMODE:
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE)
|
||||
{
|
||||
int i;
|
||||
i = ComboBox_GetCurSel((HWND)lParam);
|
||||
if (i != CB_ERR) i = ComboBox_GetItemData((HWND)lParam, i);
|
||||
if (i != CB_ERR)
|
||||
{
|
||||
settings.xdim3d = validmode[i].xdim;
|
||||
settings.ydim3d = validmode[i].ydim;
|
||||
settings.bpp3d = validmode[i].bpp;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
case IDCALWAYSSHOW:
|
||||
settings.forcesetup = IsDlgButtonChecked(hwndDlg, IDCALWAYSSHOW) == BST_CHECKED;
|
||||
return TRUE;
|
||||
default: break;
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void SetPage(int n)
|
||||
{
|
||||
HWND tab;
|
||||
int cur;
|
||||
tab = GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL);
|
||||
cur = (int)SendMessage(tab, TCM_GETCURSEL,0,0);
|
||||
ShowWindow(pages[cur],SW_HIDE);
|
||||
SendMessage(tab, TCM_SETCURSEL, n, 0);
|
||||
ShowWindow(pages[n],SW_SHOW);
|
||||
mode = n;
|
||||
|
||||
SetFocus(GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL));
|
||||
}
|
||||
|
||||
static void EnableConfig(int n)
|
||||
{
|
||||
//EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_CANCEL), n);
|
||||
EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_START), n);
|
||||
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), n);
|
||||
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDC3DVMODE), n);
|
||||
}
|
||||
|
||||
static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static HBITMAP hbmp = NULL;
|
||||
HDC hdc;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
HWND hwnd;
|
||||
RECT r, rdlg, chrome, rtab, rcancel, rstart;
|
||||
int xoffset = 0, yoffset = 0;
|
||||
|
||||
// Fetch the positions (in screen coordinates) of all the windows we need to tweak
|
||||
ZeroMemory(&chrome, sizeof(chrome));
|
||||
AdjustWindowRect(&chrome, GetWindowLong(hwndDlg, GWL_STYLE), FALSE);
|
||||
GetWindowRect(hwndDlg, &rdlg);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), &rtab);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), &rcancel);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_START), &rstart);
|
||||
|
||||
// Knock off the non-client area of the main dialogue to give just the client area
|
||||
rdlg.left -= chrome.left; rdlg.top -= chrome.top;
|
||||
rdlg.right -= chrome.right; rdlg.bottom -= chrome.bottom;
|
||||
|
||||
// Translate them to client-relative coordinates wrt the main dialogue window
|
||||
rtab.right -= rtab.left - 1; rtab.bottom -= rtab.top - 1;
|
||||
rtab.left -= rdlg.left; rtab.top -= rdlg.top;
|
||||
|
||||
rcancel.right -= rcancel.left - 1; rcancel.bottom -= rcancel.top - 1;
|
||||
rcancel.left -= rdlg.left; rcancel.top -= rdlg.top;
|
||||
|
||||
rstart.right -= rstart.left - 1; rstart.bottom -= rstart.top - 1;
|
||||
rstart.left -= rdlg.left; rstart.top -= rdlg.top;
|
||||
|
||||
// And then convert the main dialogue coordinates to just width/length
|
||||
rdlg.right -= rdlg.left - 1; rdlg.bottom -= rdlg.top - 1;
|
||||
rdlg.left = 0; rdlg.top = 0;
|
||||
|
||||
// Load the bitmap into the bitmap control and fetch its dimensions
|
||||
hbmp = LoadBitmap((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(RSRC_BMP));
|
||||
hwnd = GetDlgItem(hwndDlg,WIN_STARTWIN_BITMAP);
|
||||
SendMessage(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbmp);
|
||||
GetClientRect(hwnd, &r);
|
||||
xoffset = r.right;
|
||||
yoffset = r.bottom - rdlg.bottom;
|
||||
|
||||
// Shift and resize the controls that require it
|
||||
rtab.left += xoffset; rtab.bottom += yoffset;
|
||||
rcancel.left += xoffset; rcancel.top += yoffset;
|
||||
rstart.left += xoffset; rstart.top += yoffset;
|
||||
rdlg.right += xoffset;
|
||||
rdlg.bottom += yoffset;
|
||||
|
||||
// Move the controls to their new positions
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), rtab.left, rtab.top, rtab.right, rtab.bottom, FALSE);
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), rcancel.left, rcancel.top, rcancel.right, rcancel.bottom, FALSE);
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_START), rstart.left, rstart.top, rstart.right, rstart.bottom, FALSE);
|
||||
|
||||
// Move the main dialogue to the centre of the screen
|
||||
hdc = GetDC(NULL);
|
||||
rdlg.left = (GetDeviceCaps(hdc, HORZRES) - rdlg.right) / 2;
|
||||
rdlg.top = (GetDeviceCaps(hdc, VERTRES) - rdlg.bottom) / 2;
|
||||
ReleaseDC(NULL, hdc);
|
||||
MoveWindow(hwndDlg, rdlg.left + chrome.left, rdlg.top + chrome.left,
|
||||
rdlg.right + (-chrome.left+chrome.right), rdlg.bottom + (-chrome.top+chrome.bottom), TRUE);
|
||||
|
||||
// Add tabs to the tab control
|
||||
{
|
||||
TCITEM tab;
|
||||
|
||||
hwnd = GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL);
|
||||
|
||||
ZeroMemory(&tab, sizeof(tab));
|
||||
tab.mask = TCIF_TEXT;
|
||||
static char textConfiguration[] = TEXT("Configuration");
|
||||
tab.pszText = textConfiguration;
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)0, (LPARAM)&tab);
|
||||
tab.mask = TCIF_TEXT;
|
||||
static char textMessages[] = TEXT("Messages");
|
||||
tab.pszText = textMessages;
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)1, (LPARAM)&tab);
|
||||
|
||||
// Work out the position and size of the area inside the tab control for the pages
|
||||
ZeroMemory(&r, sizeof(r));
|
||||
GetClientRect(hwnd, &r);
|
||||
SendMessage(hwnd, TCM_ADJUSTRECT, FALSE, (LPARAM)&r);
|
||||
r.right -= r.left-1;
|
||||
r.bottom -= r.top-1;
|
||||
r.top += rtab.top;
|
||||
r.left += rtab.left;
|
||||
|
||||
// Create the pages and position them in the tab control, but hide them
|
||||
pages[TAB_CONFIG] = CreateDialog((HINSTANCE)win_gethinstance(),
|
||||
MAKEINTRESOURCE(WIN_STARTWINPAGE_CONFIG), hwndDlg, ConfigPageProc);
|
||||
pages[TAB_MESSAGES] = GetDlgItem(hwndDlg, WIN_STARTWIN_MESSAGES);
|
||||
SetWindowPos(pages[TAB_CONFIG], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW);
|
||||
SetWindowPos(pages[TAB_MESSAGES], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW);
|
||||
|
||||
// Tell the editfield acting as the console to exclude the width of the scrollbar
|
||||
GetClientRect(pages[TAB_MESSAGES],&r);
|
||||
r.right -= GetSystemMetrics(SM_CXVSCROLL)+4;
|
||||
r.left = r.top = 0;
|
||||
SendMessage(pages[TAB_MESSAGES], EM_SETRECTNP,0,(LPARAM)&r);
|
||||
|
||||
SetFocus(GetDlgItem(hwndDlg, WIN_STARTWIN_START));
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
LPNMHDR nmhdr = (LPNMHDR)lParam;
|
||||
int cur;
|
||||
if (nmhdr->idFrom != WIN_STARTWIN_TABCTL) break;
|
||||
cur = (int)SendMessage(nmhdr->hwndFrom, TCM_GETCURSEL,0,0);
|
||||
switch (nmhdr->code)
|
||||
{
|
||||
case TCN_SELCHANGING:
|
||||
{
|
||||
if (cur < 0 || !pages[cur]) break;
|
||||
ShowWindow(pages[cur],SW_HIDE);
|
||||
return TRUE;
|
||||
}
|
||||
case TCN_SELCHANGE:
|
||||
{
|
||||
if (cur < 0 || !pages[cur]) break;
|
||||
ShowWindow(pages[cur],SW_SHOW);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_CLOSE:
|
||||
if (mode == TAB_CONFIG) done = 0;
|
||||
else quitevent++;
|
||||
return TRUE;
|
||||
|
||||
case WM_DESTROY:
|
||||
if (hbmp)
|
||||
{
|
||||
DeleteObject(hbmp);
|
||||
hbmp = NULL;
|
||||
}
|
||||
|
||||
if (pages[TAB_CONFIG])
|
||||
{
|
||||
DestroyWindow(pages[TAB_CONFIG]);
|
||||
pages[TAB_CONFIG] = NULL;
|
||||
}
|
||||
|
||||
startupdlg = NULL;
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case WIN_STARTWIN_CANCEL:
|
||||
if (mode == TAB_CONFIG) done = 0;
|
||||
else quitevent++;
|
||||
return TRUE;
|
||||
case WIN_STARTWIN_START: done = 1; return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
case WM_CTLCOLORSTATIC:
|
||||
if ((HWND)lParam == pages[TAB_MESSAGES])
|
||||
return (BOOL)(intptr_t)GetSysColorBrush(COLOR_WINDOW);
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
int startwin_open(void)
|
||||
{
|
||||
INITCOMMONCONTROLSEX icc;
|
||||
if (startupdlg) return 1;
|
||||
icc.dwSize = sizeof(icc);
|
||||
icc.dwICC = ICC_TAB_CLASSES;
|
||||
InitCommonControlsEx(&icc);
|
||||
startupdlg = CreateDialog((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(WIN_STARTWIN), NULL, startup_dlgproc);
|
||||
if (startupdlg)
|
||||
{
|
||||
SetPage(TAB_MESSAGES);
|
||||
EnableConfig(0);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int startwin_close(void)
|
||||
{
|
||||
if (!startupdlg) return 1;
|
||||
DestroyWindow(startupdlg);
|
||||
startupdlg = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int startwin_puts(const char *buf)
|
||||
{
|
||||
const char *p = NULL, *q = NULL;
|
||||
char workbuf[1024];
|
||||
static int newline = 0;
|
||||
int curlen, linesbefore, linesafter;
|
||||
HWND edctl;
|
||||
int vis;
|
||||
|
||||
if (!startupdlg) return 1;
|
||||
|
||||
edctl = pages[TAB_MESSAGES];
|
||||
if (!edctl) return -1;
|
||||
|
||||
vis = ((int)SendMessage(GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL), TCM_GETCURSEL,0,0) == TAB_MESSAGES);
|
||||
|
||||
if (vis) SendMessage(edctl, WM_SETREDRAW, FALSE,0);
|
||||
curlen = SendMessage(edctl, WM_GETTEXTLENGTH, 0,0);
|
||||
SendMessage(edctl, EM_SETSEL, (WPARAM)curlen, (LPARAM)curlen);
|
||||
linesbefore = SendMessage(edctl, EM_GETLINECOUNT, 0,0);
|
||||
p = buf;
|
||||
while (*p)
|
||||
{
|
||||
if (newline)
|
||||
{
|
||||
SendMessage(edctl, EM_REPLACESEL, 0, (LPARAM)"\r\n");
|
||||
newline = 0;
|
||||
}
|
||||
q = p;
|
||||
while (*q && *q != '\n') q++;
|
||||
memcpy(workbuf, p, q-p);
|
||||
if (*q == '\n')
|
||||
{
|
||||
if (!q[1])
|
||||
{
|
||||
newline = 1;
|
||||
workbuf[q-p] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
workbuf[q-p] = '\r';
|
||||
workbuf[q-p+1] = '\n';
|
||||
workbuf[q-p+2] = 0;
|
||||
}
|
||||
p = q+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
workbuf[q-p] = 0;
|
||||
p = q;
|
||||
}
|
||||
SendMessage(edctl, EM_REPLACESEL, 0, (LPARAM)workbuf);
|
||||
}
|
||||
linesafter = SendMessage(edctl, EM_GETLINECOUNT, 0,0);
|
||||
SendMessage(edctl, EM_LINESCROLL, 0, linesafter-linesbefore);
|
||||
if (vis) SendMessage(edctl, WM_SETREDRAW, TRUE,0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int startwin_settitle(const char *str)
|
||||
{
|
||||
if (!startupdlg) return 1;
|
||||
SetWindowText(startupdlg, str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int startwin_idle(void *v)
|
||||
{
|
||||
if (!startupdlg || !IsWindow(startupdlg)) return 0;
|
||||
if (IsDialogMessage(startupdlg, (MSG *)v)) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern int xdimgame, ydimgame, bppgame, forcesetup;
|
||||
|
||||
int startwin_run(void)
|
||||
{
|
||||
MSG msg;
|
||||
if (!startupdlg) return 1;
|
||||
|
||||
done = -1;
|
||||
|
||||
SetPage(TAB_CONFIG);
|
||||
EnableConfig(1);
|
||||
|
||||
settings.fullscreen = fullscreen;
|
||||
settings.xdim3d = xdimgame;
|
||||
settings.ydim3d = ydimgame;
|
||||
settings.bpp3d = bppgame;
|
||||
settings.forcesetup = forcesetup;
|
||||
PopulateForm();
|
||||
|
||||
while (done < 0)
|
||||
{
|
||||
switch (GetMessage(&msg, NULL, 0,0))
|
||||
{
|
||||
case 0: done = 1; break;
|
||||
case -1: return -1;
|
||||
default:
|
||||
if (IsWindow(startupdlg) && IsDialogMessage(startupdlg, &msg)) break;
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SetPage(TAB_MESSAGES);
|
||||
EnableConfig(0);
|
||||
if (done)
|
||||
{
|
||||
fullscreen = settings.fullscreen;
|
||||
xdimgame = settings.xdim3d;
|
||||
ydimgame = settings.ydim3d;
|
||||
bppgame = settings.bpp3d;
|
||||
forcesetup = settings.forcesetup;
|
||||
}
|
||||
|
||||
return done;
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
// resource ids
|
||||
#define WIN_STARTWIN 1000
|
||||
#define WIN_STARTWINPAGE_CONFIG 2000
|
||||
#define WIN_STARTWIN_BITMAP 100 // banner bitmap
|
||||
#define WIN_STARTWIN_TABCTL 101
|
||||
#define WIN_STARTWIN_CANCEL IDCANCEL
|
||||
#define WIN_STARTWIN_START IDOK
|
||||
|
||||
#define WIN_STARTWIN_MESSAGES 104 // output list box
|
||||
|
||||
#define RSRC_ICON 100
|
||||
#define RSRC_BMP 200
|
||||
|
||||
// config page
|
||||
#define IDCFULLSCREEN 100
|
||||
#define IDC3DVMODE 101
|
||||
#define IDCALWAYSSHOW 102
|
|
@ -1,7 +0,0 @@
|
|||
Copyright © 2007-2017 Lua.org, PUC-Rio.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -1,537 +0,0 @@
|
|||
/*
|
||||
** $Id: lpcap.c,v 1.6 2015/06/15 16:09:57 roberto Exp $
|
||||
** Copyright 2007, Lua.org & PUC-Rio (see 'lpeg.html' for license)
|
||||
*/
|
||||
|
||||
#include "elua.h"
|
||||
#include "elauxlib.h"
|
||||
|
||||
#include "lpcap.h"
|
||||
#include "lptypes.h"
|
||||
|
||||
|
||||
#define captype(cap) ((cap)->kind)
|
||||
|
||||
#define isclosecap(cap) (captype(cap) == Cclose)
|
||||
|
||||
#define closeaddr(c) ((c)->s + (c)->siz - 1)
|
||||
|
||||
#define isfullcap(cap) ((cap)->siz != 0)
|
||||
|
||||
#define getfromktable(cs,v) lua_rawgeti((cs)->L, ktableidx((cs)->ptop), v)
|
||||
|
||||
#define pushluaval(cs) getfromktable(cs, (cs)->cap->idx)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** Put at the cache for Lua values the value indexed by 'v' in ktable
|
||||
** of the running pattern (if it is not there yet); returns its index.
|
||||
*/
|
||||
static int updatecache (CapState *cs, int v) {
|
||||
int idx = cs->ptop + 1; /* stack index of cache for Lua values */
|
||||
if (v != cs->valuecached) { /* not there? */
|
||||
getfromktable(cs, v); /* get value from 'ktable' */
|
||||
lua_replace(cs->L, idx); /* put it at reserved stack position */
|
||||
cs->valuecached = v; /* keep track of what is there */
|
||||
}
|
||||
return idx;
|
||||
}
|
||||
|
||||
|
||||
static int pushcapture (CapState *cs);
|
||||
|
||||
|
||||
/*
|
||||
** Goes back in a list of captures looking for an open capture
|
||||
** corresponding to a close
|
||||
*/
|
||||
static Capture *findopen (Capture *cap) {
|
||||
int n = 0; /* number of closes waiting an open */
|
||||
for (;;) {
|
||||
cap--;
|
||||
if (isclosecap(cap)) n++; /* one more open to skip */
|
||||
else if (!isfullcap(cap))
|
||||
if (n-- == 0) return cap;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Go to the next capture
|
||||
*/
|
||||
static void nextcap (CapState *cs) {
|
||||
Capture *cap = cs->cap;
|
||||
if (!isfullcap(cap)) { /* not a single capture? */
|
||||
int n = 0; /* number of opens waiting a close */
|
||||
for (;;) { /* look for corresponding close */
|
||||
cap++;
|
||||
if (isclosecap(cap)) {
|
||||
if (n-- == 0) break;
|
||||
}
|
||||
else if (!isfullcap(cap)) n++;
|
||||
}
|
||||
}
|
||||
cs->cap = cap + 1; /* + 1 to skip last close (or entire single capture) */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Push on the Lua stack all values generated by nested captures inside
|
||||
** the current capture. Returns number of values pushed. 'addextra'
|
||||
** makes it push the entire match after all captured values. The
|
||||
** entire match is pushed also if there are no other nested values,
|
||||
** so the function never returns zero.
|
||||
*/
|
||||
static int pushnestedvalues (CapState *cs, int addextra) {
|
||||
Capture *co = cs->cap;
|
||||
if (isfullcap(cs->cap++)) { /* no nested captures? */
|
||||
lua_pushlstring(cs->L, co->s, co->siz - 1); /* push whole match */
|
||||
return 1; /* that is it */
|
||||
}
|
||||
else {
|
||||
int n = 0;
|
||||
while (!isclosecap(cs->cap)) /* repeat for all nested patterns */
|
||||
n += pushcapture(cs);
|
||||
if (addextra || n == 0) { /* need extra? */
|
||||
lua_pushlstring(cs->L, co->s, cs->cap->s - co->s); /* push whole match */
|
||||
n++;
|
||||
}
|
||||
cs->cap++; /* skip close entry */
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Push only the first value generated by nested captures
|
||||
*/
|
||||
static void pushonenestedvalue (CapState *cs) {
|
||||
int n = pushnestedvalues(cs, 0);
|
||||
if (n > 1)
|
||||
lua_pop(cs->L, n - 1); /* pop extra values */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Try to find a named group capture with the name given at the top of
|
||||
** the stack; goes backward from 'cap'.
|
||||
*/
|
||||
static Capture *findback (CapState *cs, Capture *cap) {
|
||||
lua_State *L = cs->L;
|
||||
while (cap-- > cs->ocap) { /* repeat until end of list */
|
||||
if (isclosecap(cap))
|
||||
cap = findopen(cap); /* skip nested captures */
|
||||
else if (!isfullcap(cap))
|
||||
continue; /* opening an enclosing capture: skip and get previous */
|
||||
if (captype(cap) == Cgroup) {
|
||||
getfromktable(cs, cap->idx); /* get group name */
|
||||
if (lp_equal(L, -2, -1)) { /* right group? */
|
||||
lua_pop(L, 2); /* remove reference name and group name */
|
||||
return cap;
|
||||
}
|
||||
else lua_pop(L, 1); /* remove group name */
|
||||
}
|
||||
}
|
||||
luaL_error(L, "back reference '%s' not found", lua_tostring(L, -1));
|
||||
return NULL; /* to avoid warnings */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Back-reference capture. Return number of values pushed.
|
||||
*/
|
||||
static int backrefcap (CapState *cs) {
|
||||
int n;
|
||||
Capture *curr = cs->cap;
|
||||
pushluaval(cs); /* reference name */
|
||||
cs->cap = findback(cs, curr); /* find corresponding group */
|
||||
n = pushnestedvalues(cs, 0); /* push group's values */
|
||||
cs->cap = curr + 1;
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Table capture: creates a new table and populates it with nested
|
||||
** captures.
|
||||
*/
|
||||
static int tablecap (CapState *cs) {
|
||||
lua_State *L = cs->L;
|
||||
int n = 0;
|
||||
lua_newtable(L);
|
||||
if (isfullcap(cs->cap++))
|
||||
return 1; /* table is empty */
|
||||
while (!isclosecap(cs->cap)) {
|
||||
if (captype(cs->cap) == Cgroup && cs->cap->idx != 0) { /* named group? */
|
||||
pushluaval(cs); /* push group name */
|
||||
pushonenestedvalue(cs);
|
||||
lua_settable(L, -3);
|
||||
}
|
||||
else { /* not a named group */
|
||||
int i;
|
||||
int k = pushcapture(cs);
|
||||
for (i = k; i > 0; i--) /* store all values into table */
|
||||
lua_rawseti(L, -(i + 1), n + i);
|
||||
n += k;
|
||||
}
|
||||
}
|
||||
cs->cap++; /* skip close entry */
|
||||
return 1; /* number of values pushed (only the table) */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Table-query capture
|
||||
*/
|
||||
static int querycap (CapState *cs) {
|
||||
int idx = cs->cap->idx;
|
||||
pushonenestedvalue(cs); /* get nested capture */
|
||||
lua_gettable(cs->L, updatecache(cs, idx)); /* query cap. value at table */
|
||||
if (!lua_isnil(cs->L, -1))
|
||||
return 1;
|
||||
else { /* no value */
|
||||
lua_pop(cs->L, 1); /* remove nil */
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Fold capture
|
||||
*/
|
||||
static int foldcap (CapState *cs) {
|
||||
int n;
|
||||
lua_State *L = cs->L;
|
||||
int idx = cs->cap->idx;
|
||||
if (isfullcap(cs->cap++) || /* no nested captures? */
|
||||
isclosecap(cs->cap) || /* no nested captures (large subject)? */
|
||||
(n = pushcapture(cs)) == 0) /* nested captures with no values? */
|
||||
return luaL_error(L, "no initial value for fold capture");
|
||||
if (n > 1)
|
||||
lua_pop(L, n - 1); /* leave only one result for accumulator */
|
||||
while (!isclosecap(cs->cap)) {
|
||||
lua_pushvalue(L, updatecache(cs, idx)); /* get folding function */
|
||||
lua_insert(L, -2); /* put it before accumulator */
|
||||
n = pushcapture(cs); /* get next capture's values */
|
||||
lua_call(L, n + 1, 1); /* call folding function */
|
||||
}
|
||||
cs->cap++; /* skip close entry */
|
||||
return 1; /* only accumulator left on the stack */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Function capture
|
||||
*/
|
||||
static int functioncap (CapState *cs) {
|
||||
int n;
|
||||
int top = lua_gettop(cs->L);
|
||||
pushluaval(cs); /* push function */
|
||||
n = pushnestedvalues(cs, 0); /* push nested captures */
|
||||
lua_call(cs->L, n, LUA_MULTRET); /* call function */
|
||||
return lua_gettop(cs->L) - top; /* return function's results */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Select capture
|
||||
*/
|
||||
static int numcap (CapState *cs) {
|
||||
int idx = cs->cap->idx; /* value to select */
|
||||
if (idx == 0) { /* no values? */
|
||||
nextcap(cs); /* skip entire capture */
|
||||
return 0; /* no value produced */
|
||||
}
|
||||
else {
|
||||
int n = pushnestedvalues(cs, 0);
|
||||
if (n < idx) /* invalid index? */
|
||||
return luaL_error(cs->L, "no capture '%d'", idx);
|
||||
else {
|
||||
lua_pushvalue(cs->L, -(n - idx + 1)); /* get selected capture */
|
||||
lua_replace(cs->L, -(n + 1)); /* put it in place of 1st capture */
|
||||
lua_pop(cs->L, n - 1); /* remove other captures */
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Return the stack index of the first runtime capture in the given
|
||||
** list of captures (or zero if no runtime captures)
|
||||
*/
|
||||
int finddyncap (Capture *cap, Capture *last) {
|
||||
for (; cap < last; cap++) {
|
||||
if (cap->kind == Cruntime)
|
||||
return cap->idx; /* stack position of first capture */
|
||||
}
|
||||
return 0; /* no dynamic captures in this segment */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Calls a runtime capture. Returns number of captures removed by
|
||||
** the call, including the initial Cgroup. (Captures to be added are
|
||||
** on the Lua stack.)
|
||||
*/
|
||||
int runtimecap (CapState *cs, Capture *close, const char *s, int *rem) {
|
||||
int n, id;
|
||||
lua_State *L = cs->L;
|
||||
int otop = lua_gettop(L);
|
||||
Capture *open = findopen(close);
|
||||
assert(captype(open) == Cgroup);
|
||||
id = finddyncap(open, close); /* get first dynamic capture argument */
|
||||
close->kind = Cclose; /* closes the group */
|
||||
close->s = s;
|
||||
cs->cap = open; cs->valuecached = 0; /* prepare capture state */
|
||||
luaL_checkstack(L, 4, "too many runtime captures");
|
||||
pushluaval(cs); /* push function to be called */
|
||||
lua_pushvalue(L, SUBJIDX); /* push original subject */
|
||||
lua_pushinteger(L, s - cs->s + 1); /* push current position */
|
||||
n = pushnestedvalues(cs, 0); /* push nested captures */
|
||||
lua_call(L, n + 2, LUA_MULTRET); /* call dynamic function */
|
||||
if (id > 0) { /* are there old dynamic captures to be removed? */
|
||||
int i;
|
||||
for (i = id; i <= otop; i++)
|
||||
lua_remove(L, id); /* remove old dynamic captures */
|
||||
*rem = otop - id + 1; /* total number of dynamic captures removed */
|
||||
}
|
||||
else
|
||||
*rem = 0; /* no dynamic captures removed */
|
||||
return close - open; /* number of captures of all kinds removed */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Auxiliary structure for substitution and string captures: keep
|
||||
** information about nested captures for future use, avoiding to push
|
||||
** string results into Lua
|
||||
*/
|
||||
typedef struct StrAux {
|
||||
int isstring; /* whether capture is a string */
|
||||
union {
|
||||
Capture *cp; /* if not a string, respective capture */
|
||||
struct { /* if it is a string... */
|
||||
const char *s; /* ... starts here */
|
||||
const char *e; /* ... ends here */
|
||||
} s;
|
||||
} u;
|
||||
} StrAux;
|
||||
|
||||
#define MAXSTRCAPS 10
|
||||
|
||||
/*
|
||||
** Collect values from current capture into array 'cps'. Current
|
||||
** capture must be Cstring (first call) or Csimple (recursive calls).
|
||||
** (In first call, fills %0 with whole match for Cstring.)
|
||||
** Returns number of elements in the array that were filled.
|
||||
*/
|
||||
static int getstrcaps (CapState *cs, StrAux *cps, int n) {
|
||||
int k = n++;
|
||||
cps[k].isstring = 1; /* get string value */
|
||||
cps[k].u.s.s = cs->cap->s; /* starts here */
|
||||
if (!isfullcap(cs->cap++)) { /* nested captures? */
|
||||
while (!isclosecap(cs->cap)) { /* traverse them */
|
||||
if (n >= MAXSTRCAPS) /* too many captures? */
|
||||
nextcap(cs); /* skip extra captures (will not need them) */
|
||||
else if (captype(cs->cap) == Csimple) /* string? */
|
||||
n = getstrcaps(cs, cps, n); /* put info. into array */
|
||||
else {
|
||||
cps[n].isstring = 0; /* not a string */
|
||||
cps[n].u.cp = cs->cap; /* keep original capture */
|
||||
nextcap(cs);
|
||||
n++;
|
||||
}
|
||||
}
|
||||
cs->cap++; /* skip close */
|
||||
}
|
||||
cps[k].u.s.e = closeaddr(cs->cap - 1); /* ends here */
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** add next capture value (which should be a string) to buffer 'b'
|
||||
*/
|
||||
static int addonestring (luaL_Buffer *b, CapState *cs, const char *what);
|
||||
|
||||
|
||||
/*
|
||||
** String capture: add result to buffer 'b' (instead of pushing
|
||||
** it into the stack)
|
||||
*/
|
||||
static void stringcap (luaL_Buffer *b, CapState *cs) {
|
||||
StrAux cps[MAXSTRCAPS];
|
||||
int n;
|
||||
size_t len, i;
|
||||
const char *fmt; /* format string */
|
||||
fmt = lua_tolstring(cs->L, updatecache(cs, cs->cap->idx), &len);
|
||||
n = getstrcaps(cs, cps, 0) - 1; /* collect nested captures */
|
||||
for (i = 0; i < len; i++) { /* traverse them */
|
||||
if (fmt[i] != '%') /* not an escape? */
|
||||
luaL_addchar(b, fmt[i]); /* add it to buffer */
|
||||
else if (fmt[++i] < '0' || fmt[i] > '9') /* not followed by a digit? */
|
||||
luaL_addchar(b, fmt[i]); /* add to buffer */
|
||||
else {
|
||||
int l = fmt[i] - '0'; /* capture index */
|
||||
if (l > n)
|
||||
luaL_error(cs->L, "invalid capture index (%d)", l);
|
||||
else if (cps[l].isstring)
|
||||
luaL_addlstring(b, cps[l].u.s.s, cps[l].u.s.e - cps[l].u.s.s);
|
||||
else {
|
||||
Capture *curr = cs->cap;
|
||||
cs->cap = cps[l].u.cp; /* go back to evaluate that nested capture */
|
||||
if (!addonestring(b, cs, "capture"))
|
||||
luaL_error(cs->L, "no values in capture index %d", l);
|
||||
cs->cap = curr; /* continue from where it stopped */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Substitution capture: add result to buffer 'b'
|
||||
*/
|
||||
static void substcap (luaL_Buffer *b, CapState *cs) {
|
||||
const char *curr = cs->cap->s;
|
||||
if (isfullcap(cs->cap)) /* no nested captures? */
|
||||
luaL_addlstring(b, curr, cs->cap->siz - 1); /* keep original text */
|
||||
else {
|
||||
cs->cap++; /* skip open entry */
|
||||
while (!isclosecap(cs->cap)) { /* traverse nested captures */
|
||||
const char *next = cs->cap->s;
|
||||
luaL_addlstring(b, curr, next - curr); /* add text up to capture */
|
||||
if (addonestring(b, cs, "replacement"))
|
||||
curr = closeaddr(cs->cap - 1); /* continue after match */
|
||||
else /* no capture value */
|
||||
curr = next; /* keep original text in final result */
|
||||
}
|
||||
luaL_addlstring(b, curr, cs->cap->s - curr); /* add last piece of text */
|
||||
}
|
||||
cs->cap++; /* go to next capture */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Evaluates a capture and adds its first value to buffer 'b'; returns
|
||||
** whether there was a value
|
||||
*/
|
||||
static int addonestring (luaL_Buffer *b, CapState *cs, const char *what) {
|
||||
switch (captype(cs->cap)) {
|
||||
case Cstring:
|
||||
stringcap(b, cs); /* add capture directly to buffer */
|
||||
return 1;
|
||||
case Csubst:
|
||||
substcap(b, cs); /* add capture directly to buffer */
|
||||
return 1;
|
||||
default: {
|
||||
lua_State *L = cs->L;
|
||||
int n = pushcapture(cs);
|
||||
if (n > 0) {
|
||||
if (n > 1) lua_pop(L, n - 1); /* only one result */
|
||||
if (!lua_isstring(L, -1))
|
||||
luaL_error(L, "invalid %s value (a %s)", what, luaL_typename(L, -1));
|
||||
luaL_addvalue(b);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Push all values of the current capture into the stack; returns
|
||||
** number of values pushed
|
||||
*/
|
||||
static int pushcapture (CapState *cs) {
|
||||
lua_State *L = cs->L;
|
||||
luaL_checkstack(L, 4, "too many captures");
|
||||
switch (captype(cs->cap)) {
|
||||
case Cposition: {
|
||||
lua_pushinteger(L, cs->cap->s - cs->s + 1);
|
||||
cs->cap++;
|
||||
return 1;
|
||||
}
|
||||
case Cconst: {
|
||||
pushluaval(cs);
|
||||
cs->cap++;
|
||||
return 1;
|
||||
}
|
||||
case Carg: {
|
||||
int arg = (cs->cap++)->idx;
|
||||
if (arg + FIXEDARGS > cs->ptop)
|
||||
return luaL_error(L, "reference to absent extra argument #%d", arg);
|
||||
lua_pushvalue(L, arg + FIXEDARGS);
|
||||
return 1;
|
||||
}
|
||||
case Csimple: {
|
||||
int k = pushnestedvalues(cs, 1);
|
||||
lua_insert(L, -k); /* make whole match be first result */
|
||||
return k;
|
||||
}
|
||||
case Cruntime: {
|
||||
lua_pushvalue(L, (cs->cap++)->idx); /* value is in the stack */
|
||||
return 1;
|
||||
}
|
||||
case Cstring: {
|
||||
luaL_Buffer b;
|
||||
luaL_buffinit(L, &b);
|
||||
stringcap(&b, cs);
|
||||
luaL_pushresult(&b);
|
||||
return 1;
|
||||
}
|
||||
case Csubst: {
|
||||
luaL_Buffer b;
|
||||
luaL_buffinit(L, &b);
|
||||
substcap(&b, cs);
|
||||
luaL_pushresult(&b);
|
||||
return 1;
|
||||
}
|
||||
case Cgroup: {
|
||||
if (cs->cap->idx == 0) /* anonymous group? */
|
||||
return pushnestedvalues(cs, 0); /* add all nested values */
|
||||
else { /* named group: add no values */
|
||||
nextcap(cs); /* skip capture */
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
case Cbackref: return backrefcap(cs);
|
||||
case Ctable: return tablecap(cs);
|
||||
case Cfunction: return functioncap(cs);
|
||||
case Cnum: return numcap(cs);
|
||||
case Cquery: return querycap(cs);
|
||||
case Cfold: return foldcap(cs);
|
||||
default: assert(0); return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Prepare a CapState structure and traverse the entire list of
|
||||
** captures in the stack pushing its results. 's' is the subject
|
||||
** string, 'r' is the final position of the match, and 'ptop'
|
||||
** the index in the stack where some useful values were pushed.
|
||||
** Returns the number of results pushed. (If the list produces no
|
||||
** results, push the final position of the match.)
|
||||
*/
|
||||
int getcaptures (lua_State *L, const char *s, const char *r, int ptop) {
|
||||
Capture *capture = (Capture *)lua_touserdata(L, caplistidx(ptop));
|
||||
int n = 0;
|
||||
if (!isclosecap(capture)) { /* is there any capture? */
|
||||
CapState cs;
|
||||
cs.ocap = cs.cap = capture; cs.L = L;
|
||||
cs.s = s; cs.valuecached = 0; cs.ptop = ptop;
|
||||
do { /* collect their values */
|
||||
n += pushcapture(&cs);
|
||||
} while (!isclosecap(cs.cap));
|
||||
}
|
||||
if (n == 0) { /* no capture values? */
|
||||
lua_pushinteger(L, r - s + 1); /* return only end position */
|
||||
n = 1;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
/*
|
||||
** $Id: lpcap.h,v 1.3 2016/09/13 17:45:58 roberto Exp $
|
||||
*/
|
||||
|
||||
#if !defined(lpcap_h)
|
||||
#define lpcap_h
|
||||
|
||||
|
||||
#include "lptypes.h"
|
||||
|
||||
|
||||
/* kinds of captures */
|
||||
typedef enum CapKind {
|
||||
Cclose, /* not used in trees */
|
||||
Cposition,
|
||||
Cconst, /* ktable[key] is Lua constant */
|
||||
Cbackref, /* ktable[key] is "name" of group to get capture */
|
||||
Carg, /* 'key' is arg's number */
|
||||
Csimple, /* next node is pattern */
|
||||
Ctable, /* next node is pattern */
|
||||
Cfunction, /* ktable[key] is function; next node is pattern */
|
||||
Cquery, /* ktable[key] is table; next node is pattern */
|
||||
Cstring, /* ktable[key] is string; next node is pattern */
|
||||
Cnum, /* numbered capture; 'key' is number of value to return */
|
||||
Csubst, /* substitution capture; next node is pattern */
|
||||
Cfold, /* ktable[key] is function; next node is pattern */
|
||||
Cruntime, /* not used in trees (is uses another type for tree) */
|
||||
Cgroup /* ktable[key] is group's "name" */
|
||||
} CapKind;
|
||||
|
||||
|
||||
typedef struct Capture {
|
||||
const char *s; /* subject position */
|
||||
unsigned short idx; /* extra info (group name, arg index, etc.) */
|
||||
byte kind; /* kind of capture */
|
||||
byte siz; /* size of full capture + 1 (0 = not a full capture) */
|
||||
} Capture;
|
||||
|
||||
|
||||
typedef struct CapState {
|
||||
Capture *cap; /* current capture */
|
||||
Capture *ocap; /* (original) capture list */
|
||||
lua_State *L;
|
||||
int ptop; /* index of last argument to 'match' */
|
||||
const char *s; /* original string */
|
||||
int valuecached; /* value stored in cache slot */
|
||||
} CapState;
|
||||
|
||||
|
||||
int runtimecap (CapState *cs, Capture *close, const char *s, int *rem);
|
||||
int getcaptures (lua_State *L, const char *s, const char *r, int ptop);
|
||||
int finddyncap (Capture *cap, Capture *last);
|
||||
|
||||
#endif
|
||||
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
** $Id: lpcode.h,v 1.8 2016/09/15 17:46:13 roberto Exp $
|
||||
*/
|
||||
|
||||
#if !defined(lpcode_h)
|
||||
#define lpcode_h
|
||||
|
||||
#include "elua.h"
|
||||
|
||||
#include "lptypes.h"
|
||||
#include "lptree.h"
|
||||
#include "lpvm.h"
|
||||
|
||||
int tocharset (TTree *tree, Charset *cs);
|
||||
int checkaux (TTree *tree, int pred);
|
||||
int fixedlen (TTree *tree);
|
||||
int hascaptures (TTree *tree);
|
||||
int lp_gc (lua_State *L);
|
||||
Instruction *compile (lua_State *L, Pattern *p);
|
||||
void realloccode (lua_State *L, Pattern *p, int nsize);
|
||||
int sizei (const Instruction *i);
|
||||
|
||||
|
||||
#define PEnullable 0
|
||||
#define PEnofail 1
|
||||
|
||||
/*
|
||||
** nofail(t) implies that 't' cannot fail with any input
|
||||
*/
|
||||
#define nofail(t) checkaux(t, PEnofail)
|
||||
|
||||
/*
|
||||
** (not nullable(t)) implies 't' cannot match without consuming
|
||||
** something
|
||||
*/
|
||||
#define nullable(t) checkaux(t, PEnullable)
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -1,244 +0,0 @@
|
|||
/*
|
||||
** $Id: lpprint.c,v 1.10 2016/09/13 16:06:03 roberto Exp $
|
||||
** Copyright 2007, Lua.org & PUC-Rio (see 'lpeg.html' for license)
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#include "lptypes.h"
|
||||
#include "lpprint.h"
|
||||
#include "lpcode.h"
|
||||
|
||||
|
||||
#if defined(LPEG_DEBUG)
|
||||
|
||||
/*
|
||||
** {======================================================
|
||||
** Printing patterns (for debugging)
|
||||
** =======================================================
|
||||
*/
|
||||
|
||||
|
||||
void printcharset (const byte *st) {
|
||||
int i;
|
||||
printf("[");
|
||||
for (i = 0; i <= UCHAR_MAX; i++) {
|
||||
int first = i;
|
||||
while (testchar(st, i) && i <= UCHAR_MAX) i++;
|
||||
if (i - 1 == first) /* unary range? */
|
||||
printf("(%02x)", first);
|
||||
else if (i - 1 > first) /* non-empty range? */
|
||||
printf("(%02x-%02x)", first, i - 1);
|
||||
}
|
||||
printf("]");
|
||||
}
|
||||
|
||||
|
||||
static const char *capkind (int kind) {
|
||||
const char *const modes[] = {
|
||||
"close", "position", "constant", "backref",
|
||||
"argument", "simple", "table", "function",
|
||||
"query", "string", "num", "substitution", "fold",
|
||||
"runtime", "group"};
|
||||
return modes[kind];
|
||||
}
|
||||
|
||||
|
||||
static void printjmp (const Instruction *op, const Instruction *p) {
|
||||
printf("-> %d", (int)(p + (p + 1)->offset - op));
|
||||
}
|
||||
|
||||
|
||||
void printinst (const Instruction *op, const Instruction *p) {
|
||||
const char *const names[] = {
|
||||
"any", "char", "set",
|
||||
"testany", "testchar", "testset",
|
||||
"span", "behind",
|
||||
"ret", "end",
|
||||
"choice", "jmp", "call", "open_call",
|
||||
"commit", "partial_commit", "back_commit", "failtwice", "fail", "giveup",
|
||||
"fullcapture", "opencapture", "closecapture", "closeruntime"
|
||||
};
|
||||
printf("%02ld: %s ", (long)(p - op), names[p->i.code]);
|
||||
switch ((Opcode)p->i.code) {
|
||||
case IChar: {
|
||||
printf("'%c'", p->i.aux);
|
||||
break;
|
||||
}
|
||||
case ITestChar: {
|
||||
printf("'%c'", p->i.aux); printjmp(op, p);
|
||||
break;
|
||||
}
|
||||
case IFullCapture: {
|
||||
printf("%s (size = %d) (idx = %d)",
|
||||
capkind(getkind(p)), getoff(p), p->i.key);
|
||||
break;
|
||||
}
|
||||
case IOpenCapture: {
|
||||
printf("%s (idx = %d)", capkind(getkind(p)), p->i.key);
|
||||
break;
|
||||
}
|
||||
case ISet: {
|
||||
printcharset((p+1)->buff);
|
||||
break;
|
||||
}
|
||||
case ITestSet: {
|
||||
printcharset((p+2)->buff); printjmp(op, p);
|
||||
break;
|
||||
}
|
||||
case ISpan: {
|
||||
printcharset((p+1)->buff);
|
||||
break;
|
||||
}
|
||||
case IOpenCall: {
|
||||
printf("-> %d", (p + 1)->offset);
|
||||
break;
|
||||
}
|
||||
case IBehind: {
|
||||
printf("%d", p->i.aux);
|
||||
break;
|
||||
}
|
||||
case IJmp: case ICall: case ICommit: case IChoice:
|
||||
case IPartialCommit: case IBackCommit: case ITestAny: {
|
||||
printjmp(op, p);
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
void printpatt (Instruction *p, int n) {
|
||||
Instruction *op = p;
|
||||
while (p < op + n) {
|
||||
printinst(op, p);
|
||||
p += sizei(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if defined(LPEG_DEBUG)
|
||||
static void printcap (Capture *cap) {
|
||||
printf("%s (idx: %d - size: %d) -> %p\n",
|
||||
capkind(cap->kind), cap->idx, cap->siz, cap->s);
|
||||
}
|
||||
|
||||
|
||||
void printcaplist (Capture *cap, Capture *limit) {
|
||||
printf(">======\n");
|
||||
for (; cap->s && (limit == NULL || cap < limit); cap++)
|
||||
printcap(cap);
|
||||
printf("=======\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* }====================================================== */
|
||||
|
||||
|
||||
/*
|
||||
** {======================================================
|
||||
** Printing trees (for debugging)
|
||||
** =======================================================
|
||||
*/
|
||||
|
||||
static const char *tagnames[] = {
|
||||
"char", "set", "any",
|
||||
"true", "false",
|
||||
"rep",
|
||||
"seq", "choice",
|
||||
"not", "and",
|
||||
"call", "opencall", "rule", "grammar",
|
||||
"behind",
|
||||
"capture", "run-time"
|
||||
};
|
||||
|
||||
|
||||
void printtree (TTree *tree, int ident) {
|
||||
int i;
|
||||
for (i = 0; i < ident; i++) printf(" ");
|
||||
printf("%s", tagnames[tree->tag]);
|
||||
switch (tree->tag) {
|
||||
case TChar: {
|
||||
int c = tree->u.n;
|
||||
if (isprint(c))
|
||||
printf(" '%c'\n", c);
|
||||
else
|
||||
printf(" (%02X)\n", c);
|
||||
break;
|
||||
}
|
||||
case TSet: {
|
||||
printcharset(treebuffer(tree));
|
||||
printf("\n");
|
||||
break;
|
||||
}
|
||||
case TOpenCall: case TCall: {
|
||||
assert(sib2(tree)->tag == TRule);
|
||||
printf(" key: %d (rule: %d)\n", tree->key, sib2(tree)->cap);
|
||||
break;
|
||||
}
|
||||
case TBehind: {
|
||||
printf(" %d\n", tree->u.n);
|
||||
printtree(sib1(tree), ident + 2);
|
||||
break;
|
||||
}
|
||||
case TCapture: {
|
||||
printf(" kind: '%s' key: %d\n", capkind(tree->cap), tree->key);
|
||||
printtree(sib1(tree), ident + 2);
|
||||
break;
|
||||
}
|
||||
case TRule: {
|
||||
printf(" n: %d key: %d\n", tree->cap, tree->key);
|
||||
printtree(sib1(tree), ident + 2);
|
||||
break; /* do not print next rule as a sibling */
|
||||
}
|
||||
case TGrammar: {
|
||||
TTree *rule = sib1(tree);
|
||||
printf(" %d\n", tree->u.n); /* number of rules */
|
||||
for (i = 0; i < tree->u.n; i++) {
|
||||
printtree(rule, ident + 2);
|
||||
rule = sib2(rule);
|
||||
}
|
||||
assert(rule->tag == TTrue); /* sentinel */
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
int sibs = numsiblings[tree->tag];
|
||||
printf("\n");
|
||||
if (sibs >= 1) {
|
||||
printtree(sib1(tree), ident + 2);
|
||||
if (sibs >= 2)
|
||||
printtree(sib2(tree), ident + 2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void printktable (lua_State *L, int idx) {
|
||||
int n, i;
|
||||
lua_getuservalue(L, idx);
|
||||
if (lua_isnil(L, -1)) /* no ktable? */
|
||||
return;
|
||||
n = lua_rawlen(L, -1);
|
||||
printf("[");
|
||||
for (i = 1; i <= n; i++) {
|
||||
printf("%d = ", i);
|
||||
lua_rawgeti(L, -1, i);
|
||||
if (lua_isstring(L, -1))
|
||||
printf("%s ", lua_tostring(L, -1));
|
||||
else
|
||||
printf("%s ", lua_typename(L, lua_type(L, -1)));
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
printf("]\n");
|
||||
/* leave ktable at the stack */
|
||||
}
|
||||
|
||||
/* }====================================================== */
|
||||
|
||||
#endif
|
|
@ -1,36 +0,0 @@
|
|||
/*
|
||||
** $Id: lpprint.h,v 1.2 2015/06/12 18:18:08 roberto Exp $
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(lpprint_h)
|
||||
#define lpprint_h
|
||||
|
||||
|
||||
#include "lptree.h"
|
||||
#include "lpvm.h"
|
||||
|
||||
|
||||
#if defined(LPEG_DEBUG)
|
||||
|
||||
void printpatt (Instruction *p, int n);
|
||||
void printtree (TTree *tree, int ident);
|
||||
void printktable (lua_State *L, int idx);
|
||||
void printcharset (const byte *st);
|
||||
void printcaplist (Capture *cap, Capture *limit);
|
||||
void printinst (const Instruction *op, const Instruction *p);
|
||||
|
||||
#else
|
||||
|
||||
#define printktable(L,idx) \
|
||||
luaL_error(L, "function only implemented in debug mode")
|
||||
#define printtree(tree,i) \
|
||||
luaL_error(L, "function only implemented in debug mode")
|
||||
#define printpatt(p,n) \
|
||||
luaL_error(L, "function only implemented in debug mode")
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -1,82 +0,0 @@
|
|||
/*
|
||||
** $Id: lptree.h,v 1.3 2016/09/13 18:07:51 roberto Exp $
|
||||
*/
|
||||
|
||||
#if !defined(lptree_h)
|
||||
#define lptree_h
|
||||
|
||||
|
||||
#include "lptypes.h"
|
||||
|
||||
|
||||
/*
|
||||
** types of trees
|
||||
*/
|
||||
typedef enum TTag {
|
||||
TChar = 0, /* 'n' = char */
|
||||
TSet, /* the set is stored in next CHARSETSIZE bytes */
|
||||
TAny,
|
||||
TTrue,
|
||||
TFalse,
|
||||
TRep, /* 'sib1'* */
|
||||
TSeq, /* 'sib1' 'sib2' */
|
||||
TChoice, /* 'sib1' / 'sib2' */
|
||||
TNot, /* !'sib1' */
|
||||
TAnd, /* &'sib1' */
|
||||
TCall, /* ktable[key] is rule's key; 'sib2' is rule being called */
|
||||
TOpenCall, /* ktable[key] is rule's key */
|
||||
TRule, /* ktable[key] is rule's key (but key == 0 for unused rules);
|
||||
'sib1' is rule's pattern;
|
||||
'sib2' is next rule; 'cap' is rule's sequential number */
|
||||
TGrammar, /* 'sib1' is initial (and first) rule */
|
||||
TBehind, /* 'sib1' is pattern, 'n' is how much to go back */
|
||||
TCapture, /* captures: 'cap' is kind of capture (enum 'CapKind');
|
||||
ktable[key] is Lua value associated with capture;
|
||||
'sib1' is capture body */
|
||||
TRunTime /* run-time capture: 'key' is Lua function;
|
||||
'sib1' is capture body */
|
||||
} TTag;
|
||||
|
||||
|
||||
/*
|
||||
** Tree trees
|
||||
** The first child of a tree (if there is one) is immediately after
|
||||
** the tree. A reference to a second child (ps) is its position
|
||||
** relative to the position of the tree itself.
|
||||
*/
|
||||
typedef struct TTree {
|
||||
byte tag;
|
||||
byte cap; /* kind of capture (if it is a capture) */
|
||||
unsigned short key; /* key in ktable for Lua data (0 if no key) */
|
||||
union {
|
||||
int ps; /* occasional second child */
|
||||
int n; /* occasional counter */
|
||||
} u;
|
||||
} TTree;
|
||||
|
||||
|
||||
/*
|
||||
** A complete pattern has its tree plus, if already compiled,
|
||||
** its corresponding code
|
||||
*/
|
||||
typedef struct Pattern {
|
||||
union Instruction *code;
|
||||
int codesize;
|
||||
TTree tree[1];
|
||||
} Pattern;
|
||||
|
||||
|
||||
/* number of children for each tree */
|
||||
extern const byte numsiblings[];
|
||||
|
||||
/* access to children */
|
||||
#define sib1(t) ((t) + 1)
|
||||
#define sib2(t) ((t) + (t)->u.ps)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,149 +0,0 @@
|
|||
/*
|
||||
** $Id: lptypes.h,v 1.16 2017/01/13 13:33:17 roberto Exp $
|
||||
** LPeg - PEG pattern matching for Lua
|
||||
** Copyright 2007-2017, Lua.org & PUC-Rio (see 'lpeg.html' for license)
|
||||
** written by Roberto Ierusalimschy
|
||||
*/
|
||||
|
||||
#if !defined(lptypes_h)
|
||||
#define lptypes_h
|
||||
|
||||
|
||||
#if !defined(LPEG_DEBUG)
|
||||
#define NDEBUG
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "elua.h"
|
||||
|
||||
|
||||
#define VERSION "1.0.1"
|
||||
|
||||
|
||||
#define PATTERN_T "lpeg-pattern"
|
||||
#define MAXSTACKIDX "lpeg-maxstack"
|
||||
|
||||
|
||||
/*
|
||||
** compatibility with Lua 5.1
|
||||
*/
|
||||
#if (LUA_VERSION_NUM == 501)
|
||||
|
||||
#define lp_equal lua_equal
|
||||
|
||||
#define lua_getuservalue lua_getfenv
|
||||
#define lua_setuservalue lua_setfenv
|
||||
|
||||
#define lua_rawlen lua_objlen
|
||||
|
||||
#define luaL_setfuncs(L,f,n) luaL_register(L,NULL,f)
|
||||
#define luaL_newlib(L,f) luaL_register(L,"lpeg",f)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(lp_equal)
|
||||
#define lp_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ)
|
||||
#endif
|
||||
|
||||
|
||||
/* default maximum size for call/backtrack stack */
|
||||
#if !defined(MAXBACK)
|
||||
#define MAXBACK 400
|
||||
#endif
|
||||
|
||||
|
||||
/* maximum number of rules in a grammar (limited by 'unsigned char') */
|
||||
#if !defined(MAXRULES)
|
||||
#define MAXRULES 250
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* initial size for capture's list */
|
||||
#define INITCAPSIZE 32
|
||||
|
||||
|
||||
/* index, on Lua stack, for subject */
|
||||
#define SUBJIDX 2
|
||||
|
||||
/* number of fixed arguments to 'match' (before capture arguments) */
|
||||
#define FIXEDARGS 3
|
||||
|
||||
/* index, on Lua stack, for capture list */
|
||||
#define caplistidx(ptop) ((ptop) + 2)
|
||||
|
||||
/* index, on Lua stack, for pattern's ktable */
|
||||
#define ktableidx(ptop) ((ptop) + 3)
|
||||
|
||||
/* index, on Lua stack, for backtracking stack */
|
||||
#define stackidx(ptop) ((ptop) + 4)
|
||||
|
||||
|
||||
|
||||
typedef unsigned char byte;
|
||||
|
||||
|
||||
#define BITSPERCHAR 8
|
||||
|
||||
#define CHARSETSIZE ((UCHAR_MAX/BITSPERCHAR) + 1)
|
||||
|
||||
|
||||
|
||||
typedef struct Charset {
|
||||
byte cs[CHARSETSIZE];
|
||||
} Charset;
|
||||
|
||||
|
||||
|
||||
#define loopset(v,b) { int v; for (v = 0; v < CHARSETSIZE; v++) {b;} }
|
||||
|
||||
/* access to charset */
|
||||
#define treebuffer(t) ((byte *)((t) + 1))
|
||||
|
||||
/* number of slots needed for 'n' bytes */
|
||||
#define bytes2slots(n) (((n) - 1) / sizeof(TTree) + 1)
|
||||
|
||||
/* set 'b' bit in charset 'cs' */
|
||||
#define setchar(cs,b) ((cs)[(b) >> 3] |= (1 << ((b) & 7)))
|
||||
|
||||
|
||||
/*
|
||||
** in capture instructions, 'kind' of capture and its offset are
|
||||
** packed in field 'aux', 4 bits for each
|
||||
*/
|
||||
#define getkind(op) ((op)->i.aux & 0xF)
|
||||
#define getoff(op) (((op)->i.aux >> 4) & 0xF)
|
||||
#define joinkindoff(k,o) ((k) | ((o) << 4))
|
||||
|
||||
#define MAXOFF 0xF
|
||||
#define MAXAUX 0xFF
|
||||
|
||||
|
||||
/* maximum number of bytes to look behind */
|
||||
#define MAXBEHIND MAXAUX
|
||||
|
||||
|
||||
/* maximum size (in elements) for a pattern */
|
||||
#define MAXPATTSIZE (SHRT_MAX - 10)
|
||||
|
||||
|
||||
/* size (in elements) for an instruction plus extra l bytes */
|
||||
#define instsize(l) (((l) + sizeof(Instruction) - 1)/sizeof(Instruction) + 1)
|
||||
|
||||
|
||||
/* size (in elements) for a ISet instruction */
|
||||
#define CHARSETINSTSIZE instsize(CHARSETSIZE)
|
||||
|
||||
/* size (in elements) for a IFunc instruction */
|
||||
#define funcinstsize(p) ((p)->i.aux + 2)
|
||||
|
||||
|
||||
|
||||
#define testchar(st,c) (((int)(st)[((c) >> 3)] & (1 << ((c) & 7))))
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,364 +0,0 @@
|
|||
/*
|
||||
** $Id: lpvm.c,v 1.9 2016/06/03 20:11:18 roberto Exp $
|
||||
** Copyright 2007, Lua.org & PUC-Rio (see 'lpeg.html' for license)
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#include "elua.h"
|
||||
#include "elauxlib.h"
|
||||
|
||||
#include "lpcap.h"
|
||||
#include "lptypes.h"
|
||||
#include "lpvm.h"
|
||||
#include "lpprint.h"
|
||||
|
||||
|
||||
/* initial size for call/backtrack stack */
|
||||
#if !defined(INITBACK)
|
||||
#define INITBACK MAXBACK
|
||||
#endif
|
||||
|
||||
|
||||
#define getoffset(p) (((p) + 1)->offset)
|
||||
|
||||
static const Instruction giveup = {{IGiveup, 0, 0}};
|
||||
|
||||
|
||||
/*
|
||||
** {======================================================
|
||||
** Virtual Machine
|
||||
** =======================================================
|
||||
*/
|
||||
|
||||
|
||||
typedef struct Stack {
|
||||
const char *s; /* saved position (or NULL for calls) */
|
||||
const Instruction *p; /* next instruction */
|
||||
int caplevel;
|
||||
} Stack;
|
||||
|
||||
|
||||
#define getstackbase(L, ptop) ((Stack *)lua_touserdata(L, stackidx(ptop)))
|
||||
|
||||
|
||||
/*
|
||||
** Make the size of the array of captures 'cap' twice as large as needed
|
||||
** (which is 'captop'). ('n' is the number of new elements.)
|
||||
*/
|
||||
static Capture *doublecap (lua_State *L, Capture *cap, int captop,
|
||||
int n, int ptop) {
|
||||
Capture *newc;
|
||||
if (captop >= INT_MAX/((int)sizeof(Capture) * 2))
|
||||
luaL_error(L, "too many captures");
|
||||
newc = (Capture *)lua_newuserdata(L, captop * 2 * sizeof(Capture));
|
||||
memcpy(newc, cap, (captop - n) * sizeof(Capture));
|
||||
lua_replace(L, caplistidx(ptop));
|
||||
return newc;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Double the size of the stack
|
||||
*/
|
||||
static Stack *doublestack (lua_State *L, Stack **stacklimit, int ptop) {
|
||||
Stack *stack = getstackbase(L, ptop);
|
||||
Stack *newstack;
|
||||
int n = *stacklimit - stack; /* current stack size */
|
||||
int max, newn;
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, MAXSTACKIDX);
|
||||
max = lua_tointeger(L, -1); /* maximum allowed size */
|
||||
lua_pop(L, 1);
|
||||
if (n >= max) /* already at maximum size? */
|
||||
luaL_error(L, "backtrack stack overflow (current limit is %d)", max);
|
||||
newn = 2 * n; /* new size */
|
||||
if (newn > max) newn = max;
|
||||
newstack = (Stack *)lua_newuserdata(L, newn * sizeof(Stack));
|
||||
memcpy(newstack, stack, n * sizeof(Stack));
|
||||
lua_replace(L, stackidx(ptop));
|
||||
*stacklimit = newstack + newn;
|
||||
return newstack + n; /* return next position */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Interpret the result of a dynamic capture: false -> fail;
|
||||
** true -> keep current position; number -> next position.
|
||||
** Return new subject position. 'fr' is stack index where
|
||||
** is the result; 'curr' is current subject position; 'limit'
|
||||
** is subject's size.
|
||||
*/
|
||||
static int resdyncaptures (lua_State *L, int fr, int curr, int limit) {
|
||||
lua_Integer res;
|
||||
if (!lua_toboolean(L, fr)) { /* false value? */
|
||||
lua_settop(L, fr - 1); /* remove results */
|
||||
return -1; /* and fail */
|
||||
}
|
||||
else if (lua_isboolean(L, fr)) /* true? */
|
||||
res = curr; /* keep current position */
|
||||
else {
|
||||
res = lua_tointeger(L, fr) - 1; /* new position */
|
||||
if (res < curr || res > limit)
|
||||
luaL_error(L, "invalid position returned by match-time capture");
|
||||
}
|
||||
lua_remove(L, fr); /* remove first result (offset) */
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Add capture values returned by a dynamic capture to the capture list
|
||||
** 'base', nested inside a group capture. 'fd' indexes the first capture
|
||||
** value, 'n' is the number of values (at least 1).
|
||||
*/
|
||||
static void adddyncaptures (const char *s, Capture *base, int n, int fd) {
|
||||
int i;
|
||||
base[0].kind = Cgroup; /* create group capture */
|
||||
base[0].siz = 0;
|
||||
base[0].idx = 0; /* make it an anonymous group */
|
||||
for (i = 1; i <= n; i++) { /* add runtime captures */
|
||||
base[i].kind = Cruntime;
|
||||
base[i].siz = 1; /* mark it as closed */
|
||||
base[i].idx = fd + i - 1; /* stack index of capture value */
|
||||
base[i].s = s;
|
||||
}
|
||||
base[i].kind = Cclose; /* close group */
|
||||
base[i].siz = 1;
|
||||
base[i].s = s;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Remove dynamic captures from the Lua stack (called in case of failure)
|
||||
*/
|
||||
static int removedyncap (lua_State *L, Capture *capture,
|
||||
int level, int last) {
|
||||
int id = finddyncap(capture + level, capture + last); /* index of 1st cap. */
|
||||
int top = lua_gettop(L);
|
||||
if (id == 0) return 0; /* no dynamic captures? */
|
||||
lua_settop(L, id - 1); /* remove captures */
|
||||
return top - id + 1; /* number of values removed */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Opcode interpreter
|
||||
*/
|
||||
const char *match (lua_State *L, const char *o, const char *s, const char *e,
|
||||
Instruction *op, Capture *capture, int ptop) {
|
||||
Stack stackbase[INITBACK];
|
||||
Stack *stacklimit = stackbase + INITBACK;
|
||||
Stack *stack = stackbase; /* point to first empty slot in stack */
|
||||
int capsize = INITCAPSIZE;
|
||||
int captop = 0; /* point to first empty slot in captures */
|
||||
int ndyncap = 0; /* number of dynamic captures (in Lua stack) */
|
||||
const Instruction *p = op; /* current instruction */
|
||||
stack->p = &giveup; stack->s = s; stack->caplevel = 0; stack++;
|
||||
lua_pushlightuserdata(L, stackbase);
|
||||
for (;;) {
|
||||
#if defined(DEBUG)
|
||||
printf("-------------------------------------\n");
|
||||
printcaplist(capture, capture + captop);
|
||||
printf("s: |%s| stck:%d, dyncaps:%d, caps:%d ",
|
||||
s, (int)(stack - getstackbase(L, ptop)), ndyncap, captop);
|
||||
printinst(op, p);
|
||||
#endif
|
||||
assert(stackidx(ptop) + ndyncap == lua_gettop(L) && ndyncap <= captop);
|
||||
switch ((Opcode)p->i.code) {
|
||||
case IEnd: {
|
||||
assert(stack == getstackbase(L, ptop) + 1);
|
||||
capture[captop].kind = Cclose;
|
||||
capture[captop].s = NULL;
|
||||
return s;
|
||||
}
|
||||
case IGiveup: {
|
||||
assert(stack == getstackbase(L, ptop));
|
||||
return NULL;
|
||||
}
|
||||
case IRet: {
|
||||
assert(stack > getstackbase(L, ptop) && (stack - 1)->s == NULL);
|
||||
p = (--stack)->p;
|
||||
continue;
|
||||
}
|
||||
case IAny: {
|
||||
if (s < e) { p++; s++; }
|
||||
else goto fail;
|
||||
continue;
|
||||
}
|
||||
case ITestAny: {
|
||||
if (s < e) p += 2;
|
||||
else p += getoffset(p);
|
||||
continue;
|
||||
}
|
||||
case IChar: {
|
||||
if ((byte)*s == p->i.aux && s < e) { p++; s++; }
|
||||
else goto fail;
|
||||
continue;
|
||||
}
|
||||
case ITestChar: {
|
||||
if ((byte)*s == p->i.aux && s < e) p += 2;
|
||||
else p += getoffset(p);
|
||||
continue;
|
||||
}
|
||||
case ISet: {
|
||||
int c = (byte)*s;
|
||||
if (testchar((p+1)->buff, c) && s < e)
|
||||
{ p += CHARSETINSTSIZE; s++; }
|
||||
else goto fail;
|
||||
continue;
|
||||
}
|
||||
case ITestSet: {
|
||||
int c = (byte)*s;
|
||||
if (testchar((p + 2)->buff, c) && s < e)
|
||||
p += 1 + CHARSETINSTSIZE;
|
||||
else p += getoffset(p);
|
||||
continue;
|
||||
}
|
||||
case IBehind: {
|
||||
int n = p->i.aux;
|
||||
if (n > s - o) goto fail;
|
||||
s -= n; p++;
|
||||
continue;
|
||||
}
|
||||
case ISpan: {
|
||||
for (; s < e; s++) {
|
||||
int c = (byte)*s;
|
||||
if (!testchar((p+1)->buff, c)) break;
|
||||
}
|
||||
p += CHARSETINSTSIZE;
|
||||
continue;
|
||||
}
|
||||
case IJmp: {
|
||||
p += getoffset(p);
|
||||
continue;
|
||||
}
|
||||
case IChoice: {
|
||||
if (stack == stacklimit)
|
||||
stack = doublestack(L, &stacklimit, ptop);
|
||||
stack->p = p + getoffset(p);
|
||||
stack->s = s;
|
||||
stack->caplevel = captop;
|
||||
stack++;
|
||||
p += 2;
|
||||
continue;
|
||||
}
|
||||
case ICall: {
|
||||
if (stack == stacklimit)
|
||||
stack = doublestack(L, &stacklimit, ptop);
|
||||
stack->s = NULL;
|
||||
stack->p = p + 2; /* save return address */
|
||||
stack++;
|
||||
p += getoffset(p);
|
||||
continue;
|
||||
}
|
||||
case ICommit: {
|
||||
assert(stack > getstackbase(L, ptop) && (stack - 1)->s != NULL);
|
||||
stack--;
|
||||
p += getoffset(p);
|
||||
continue;
|
||||
}
|
||||
case IPartialCommit: {
|
||||
assert(stack > getstackbase(L, ptop) && (stack - 1)->s != NULL);
|
||||
(stack - 1)->s = s;
|
||||
(stack - 1)->caplevel = captop;
|
||||
p += getoffset(p);
|
||||
continue;
|
||||
}
|
||||
case IBackCommit: {
|
||||
assert(stack > getstackbase(L, ptop) && (stack - 1)->s != NULL);
|
||||
s = (--stack)->s;
|
||||
captop = stack->caplevel;
|
||||
p += getoffset(p);
|
||||
continue;
|
||||
}
|
||||
case IFailTwice:
|
||||
assert(stack > getstackbase(L, ptop));
|
||||
stack--;
|
||||
/* go through */
|
||||
case IFail:
|
||||
fail: { /* pattern failed: try to backtrack */
|
||||
do { /* remove pending calls */
|
||||
assert(stack > getstackbase(L, ptop));
|
||||
s = (--stack)->s;
|
||||
} while (s == NULL);
|
||||
if (ndyncap > 0) /* is there matchtime captures? */
|
||||
ndyncap -= removedyncap(L, capture, stack->caplevel, captop);
|
||||
captop = stack->caplevel;
|
||||
p = stack->p;
|
||||
#if defined(DEBUG)
|
||||
printf("**FAIL**\n");
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
case ICloseRunTime: {
|
||||
CapState cs;
|
||||
int rem, res, n;
|
||||
int fr = lua_gettop(L) + 1; /* stack index of first result */
|
||||
cs.s = o; cs.L = L; cs.ocap = capture; cs.ptop = ptop;
|
||||
n = runtimecap(&cs, capture + captop, s, &rem); /* call function */
|
||||
captop -= n; /* remove nested captures */
|
||||
ndyncap -= rem; /* update number of dynamic captures */
|
||||
fr -= rem; /* 'rem' items were popped from Lua stack */
|
||||
res = resdyncaptures(L, fr, s - o, e - o); /* get result */
|
||||
if (res == -1) /* fail? */
|
||||
goto fail;
|
||||
s = o + res; /* else update current position */
|
||||
n = lua_gettop(L) - fr + 1; /* number of new captures */
|
||||
ndyncap += n; /* update number of dynamic captures */
|
||||
if (n > 0) { /* any new capture? */
|
||||
if (fr + n >= SHRT_MAX)
|
||||
luaL_error(L, "too many results in match-time capture");
|
||||
if ((captop += n + 2) >= capsize) {
|
||||
capture = doublecap(L, capture, captop, n + 2, ptop);
|
||||
capsize = 2 * captop;
|
||||
}
|
||||
/* add new captures to 'capture' list */
|
||||
adddyncaptures(s, capture + captop - n - 2, n, fr);
|
||||
}
|
||||
p++;
|
||||
continue;
|
||||
}
|
||||
case ICloseCapture: {
|
||||
const char *s1 = s;
|
||||
assert(captop > 0);
|
||||
/* if possible, turn capture into a full capture */
|
||||
if (capture[captop - 1].siz == 0 &&
|
||||
s1 - capture[captop - 1].s < UCHAR_MAX) {
|
||||
capture[captop - 1].siz = s1 - capture[captop - 1].s + 1;
|
||||
p++;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
capture[captop].siz = 1; /* mark entry as closed */
|
||||
capture[captop].s = s;
|
||||
goto pushcapture;
|
||||
}
|
||||
}
|
||||
case IOpenCapture:
|
||||
capture[captop].siz = 0; /* mark entry as open */
|
||||
capture[captop].s = s;
|
||||
goto pushcapture;
|
||||
case IFullCapture:
|
||||
capture[captop].siz = getoff(p) + 1; /* save capture size */
|
||||
capture[captop].s = s - getoff(p);
|
||||
/* goto pushcapture; */
|
||||
pushcapture: {
|
||||
capture[captop].idx = p->i.key;
|
||||
capture[captop].kind = getkind(p);
|
||||
if (++captop >= capsize) {
|
||||
capture = doublecap(L, capture, captop, 0, ptop);
|
||||
capsize = 2 * captop;
|
||||
}
|
||||
p++;
|
||||
continue;
|
||||
}
|
||||
default: assert(0); return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* }====================================================== */
|
||||
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
/*
|
||||
** $Id: lpvm.h,v 1.3 2014/02/21 13:06:41 roberto Exp $
|
||||
*/
|
||||
|
||||
#if !defined(lpvm_h)
|
||||
#define lpvm_h
|
||||
|
||||
#include "lpcap.h"
|
||||
|
||||
|
||||
/* Virtual Machine's instructions */
|
||||
typedef enum Opcode {
|
||||
IAny, /* if no char, fail */
|
||||
IChar, /* if char != aux, fail */
|
||||
ISet, /* if char not in buff, fail */
|
||||
ITestAny, /* in no char, jump to 'offset' */
|
||||
ITestChar, /* if char != aux, jump to 'offset' */
|
||||
ITestSet, /* if char not in buff, jump to 'offset' */
|
||||
ISpan, /* read a span of chars in buff */
|
||||
IBehind, /* walk back 'aux' characters (fail if not possible) */
|
||||
IRet, /* return from a rule */
|
||||
IEnd, /* end of pattern */
|
||||
IChoice, /* stack a choice; next fail will jump to 'offset' */
|
||||
IJmp, /* jump to 'offset' */
|
||||
ICall, /* call rule at 'offset' */
|
||||
IOpenCall, /* call rule number 'key' (must be closed to a ICall) */
|
||||
ICommit, /* pop choice and jump to 'offset' */
|
||||
IPartialCommit, /* update top choice to current position and jump */
|
||||
IBackCommit, /* "fails" but jump to its own 'offset' */
|
||||
IFailTwice, /* pop one choice and then fail */
|
||||
IFail, /* go back to saved state on choice and jump to saved offset */
|
||||
IGiveup, /* internal use */
|
||||
IFullCapture, /* complete capture of last 'off' chars */
|
||||
IOpenCapture, /* start a capture */
|
||||
ICloseCapture,
|
||||
ICloseRunTime
|
||||
} Opcode;
|
||||
|
||||
|
||||
|
||||
typedef union Instruction {
|
||||
struct Inst {
|
||||
byte code;
|
||||
byte aux;
|
||||
short key;
|
||||
} i;
|
||||
int offset;
|
||||
byte buff[1];
|
||||
} Instruction;
|
||||
|
||||
|
||||
void printpatt (Instruction *p, int n);
|
||||
const char *match (lua_State *L, const char *o, const char *s, const char *e,
|
||||
Instruction *op, Capture *capture, int ptop);
|
||||
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -1,452 +0,0 @@
|
|||
#!BPY
|
||||
|
||||
"""
|
||||
Name: 'ASCII Scene (.ase) v0.16'
|
||||
Blender: 249
|
||||
Group: 'Import'
|
||||
Tooltip: 'ASCII Scene import (*.ase)'
|
||||
"""
|
||||
__author__ = "Goofos & Plagman"
|
||||
__version__ = "0.16"
|
||||
|
||||
# goofos at epruegel.de
|
||||
#
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ***** END GPL LICENCE BLOCK *****
|
||||
|
||||
import string, time, sys as osSys
|
||||
import Blender
|
||||
from Blender import Draw, Mesh, Window, Object, Scene, NMesh, Key, Ipo, IpoCurve
|
||||
#import meshtools
|
||||
|
||||
|
||||
def read_main(filename):
|
||||
|
||||
global counts
|
||||
counts = {'verts': 0, 'tris': 0}
|
||||
|
||||
start = time.clock()
|
||||
file = open(filename, "r")
|
||||
|
||||
print_boxed("----------------start-----------------")
|
||||
print 'Import Patch: ', filename
|
||||
|
||||
editmode = Window.EditMode() # are we in edit mode? If so ...
|
||||
if editmode: Window.EditMode(0) # leave edit mode before getting the mesh
|
||||
|
||||
lines= file.readlines()
|
||||
read_file(file, lines)
|
||||
|
||||
Blender.Window.DrawProgressBar(1.0, '') # clear progressbar
|
||||
file.close()
|
||||
print "----------------end-----------------"
|
||||
end = time.clock()
|
||||
seconds = " in %.2f %s" % (end-start, "seconds")
|
||||
totals = "Verts: %i Tris: %i " % (counts['verts'], counts['tris'])
|
||||
print_boxed(totals)
|
||||
message = "Successfully imported " + Blender.sys.basename(filename) + seconds
|
||||
#meshtools.print_boxed(message)
|
||||
print_boxed(message)
|
||||
|
||||
|
||||
def print_boxed(text): #Copy/Paste from meshtools, only to remove the beep :)
|
||||
lines = text.splitlines()
|
||||
maxlinelen = max(map(len, lines))
|
||||
if osSys.platform[:3] == "win":
|
||||
print chr(218)+chr(196) + chr(196)*maxlinelen + chr(196)+chr(191)
|
||||
for line in lines:
|
||||
print chr(179) + ' ' + line.ljust(maxlinelen) + ' ' + chr(179)
|
||||
print chr(192)+chr(196) + chr(196)*maxlinelen + chr(196)+chr(217)
|
||||
else:
|
||||
print '+-' + '-'*maxlinelen + '-+'
|
||||
for line in lines: print '| ' + line.ljust(maxlinelen) + ' |'
|
||||
print '+-' + '-'*maxlinelen + '-+'
|
||||
#print '\a\r', # beep when done
|
||||
|
||||
|
||||
class ase_obj:
|
||||
|
||||
def __init__(self):
|
||||
self.name = 'Name'
|
||||
self.objType = None
|
||||
self.row0x = None
|
||||
self.row0y = None
|
||||
self.row0z = None
|
||||
self.row1x = None
|
||||
self.row1y = None
|
||||
self.row1z = None
|
||||
self.row2x = None
|
||||
self.row2y = None
|
||||
self.row2z = None
|
||||
self.row3x = None
|
||||
self.row3y = None
|
||||
self.row3z = None
|
||||
self.parent = None
|
||||
self.obj = None
|
||||
self.objName = 'Name'
|
||||
|
||||
class ase_mesh:
|
||||
|
||||
def __init__(self):
|
||||
self.name = ''
|
||||
self.vCount = 0
|
||||
self.fCount = 0
|
||||
self.frames = []
|
||||
self.verts = []
|
||||
self.faces = []
|
||||
self.animated = 0
|
||||
self.frameCount = -1
|
||||
|
||||
class mesh_vert:
|
||||
|
||||
def __init__(self):
|
||||
self.x = 0.0
|
||||
self.y = 0.0
|
||||
self.z = 0.0
|
||||
self.u = 0.0
|
||||
self.v = 0.0
|
||||
self.nx = 0.0
|
||||
self.ny = 0.0
|
||||
self.nz = 0.0
|
||||
self.origi = 0
|
||||
def make_tuple(self):
|
||||
return (self.x, self.y, self.z, self.u, self.v, self.nx, self.ny, self.nz)
|
||||
|
||||
class mesh_face:
|
||||
|
||||
def __init__(self):
|
||||
self.v1 = mesh_vert()
|
||||
self.v2 = mesh_vert()
|
||||
self.v3 = mesh_vert()
|
||||
self.i1 = 0
|
||||
self.i2 = 0
|
||||
self.i3 = 0
|
||||
|
||||
def read_file(file, lines):
|
||||
|
||||
objects = []
|
||||
objIdx = 0
|
||||
objCheck = -1 #needed to skip helper objects
|
||||
PBidx = 0.0
|
||||
lineCount = float(len(lines))
|
||||
processed_indices = []
|
||||
curFaceID = 0
|
||||
faceVertID = 0
|
||||
|
||||
print 'Read file'
|
||||
Blender.Window.DrawProgressBar(0.0, "Read File...")
|
||||
|
||||
for line in lines:
|
||||
words = string.split(line)
|
||||
|
||||
if (PBidx % 10000) == 0.0:
|
||||
Blender.Window.DrawProgressBar(PBidx / lineCount, "Read File...")
|
||||
|
||||
if not words:
|
||||
continue
|
||||
elif objIdx > 0 and me.animated == 1:
|
||||
# I don't know how to make empty statements, this is to skip everything else
|
||||
me.animated = me.animated
|
||||
elif words[0] == '*GEOMOBJECT':
|
||||
objCheck = 0
|
||||
newObj = ase_obj()
|
||||
objects.append(newObj)
|
||||
obj = objects[objIdx]
|
||||
objIdx += 1
|
||||
|
||||
obj.objType = 'Mesh'
|
||||
obj.obj = ase_mesh()
|
||||
me = obj.obj
|
||||
elif words[0] == '*NODE_NAME' and objCheck != -1:
|
||||
if objCheck == 0:
|
||||
obj.name = words[1]
|
||||
objCheck = 1
|
||||
elif objCheck == 1:
|
||||
obj.objName = words[1]
|
||||
elif words[0] == '*TM_ROW0' and objCheck != -1:
|
||||
obj.row0x = float(words[1])
|
||||
obj.row0y = float(words[2])
|
||||
obj.row0z = float(words[3])
|
||||
elif words[0] == '*TM_ROW1' and objCheck != -1:
|
||||
obj.row1x = float(words[1])
|
||||
obj.row1y = float(words[2])
|
||||
obj.row1z = float(words[3])
|
||||
elif words[0] == '*TM_ROW2' and objCheck != -1:
|
||||
obj.row2x = float(words[1])
|
||||
obj.row2y = float(words[2])
|
||||
obj.row2z = float(words[3])
|
||||
elif words[0] == '*TM_ROW3' and objCheck != -1:
|
||||
obj.row3x = float(words[1])
|
||||
obj.row3y = float(words[2])
|
||||
obj.row3z = float(words[3])
|
||||
objCheck = -1
|
||||
elif words[0] == '*MESH_NUMVERTEX':
|
||||
me.vCount = int(words[1])
|
||||
for i in range(me.vCount):
|
||||
me.verts.append(mesh_vert())
|
||||
elif words[0] == '*MESH_NUMFACES':
|
||||
me.fCount = int(words[1])
|
||||
for i in range(me.fCount):
|
||||
me.faces.append(mesh_face())
|
||||
elif words[0] == '*MESH_VERTEX':
|
||||
i = int(words[1])
|
||||
me.verts[i].x = float(words[2]);
|
||||
me.verts[i].y = float(words[3]);
|
||||
me.verts[i].z = float(words[4]);
|
||||
elif words[0] == '*MESH_FACE':
|
||||
i = int(words[1].rstrip(":")) # looks like "13:"
|
||||
v1 = int(words[3]);
|
||||
v2 = int(words[5]);
|
||||
v3 = int(words[7]);
|
||||
me.faces[i].v1.x = me.verts[v1].x;
|
||||
me.faces[i].v1.y = me.verts[v1].y;
|
||||
me.faces[i].v1.z = me.verts[v1].z;
|
||||
me.faces[i].v1.origi = v1
|
||||
|
||||
me.faces[i].v2.x = me.verts[v2].x;
|
||||
me.faces[i].v2.y = me.verts[v2].y;
|
||||
me.faces[i].v2.z = me.verts[v2].z;
|
||||
me.faces[i].v2.origi = v2
|
||||
|
||||
me.faces[i].v3.x = me.verts[v3].x;
|
||||
me.faces[i].v3.y = me.verts[v3].y;
|
||||
me.faces[i].v3.z = me.verts[v3].z;
|
||||
me.faces[i].v3.origi = v3
|
||||
elif words[0] == '*MESH_NUMTVERTEX':
|
||||
del me.verts[:]
|
||||
uvCount = int(words[1])
|
||||
for i in range(uvCount):
|
||||
me.verts.append(mesh_vert())
|
||||
elif words[0] == '*MESH_TVERT':
|
||||
i = int(words[1])
|
||||
me.verts[i].u = float(words[2]);
|
||||
me.verts[i].v = float(words[3]);
|
||||
elif words[0] == '*MESH_TFACE':
|
||||
i = int(words[1])
|
||||
uv1 = int(words[2]);
|
||||
uv2 = int(words[3]);
|
||||
uv3 = int(words[4]);
|
||||
|
||||
me.faces[i].v1.u = me.verts[uv1].u;
|
||||
me.faces[i].v1.v = me.verts[uv1].v;
|
||||
|
||||
me.faces[i].v2.u = me.verts[uv2].u;
|
||||
me.faces[i].v2.v = me.verts[uv2].v;
|
||||
|
||||
me.faces[i].v3.u = me.verts[uv3].u;
|
||||
me.faces[i].v3.v = me.verts[uv3].v;
|
||||
elif words[0] == '*MESH_FACENORMAL':
|
||||
curFaceID = int(words[1]) # global, vertexnormal needs this
|
||||
faceVertID = 0 # same
|
||||
elif words[0] == '*MESH_VERTEXNORMAL':
|
||||
nx = float(words[2])
|
||||
ny = float(words[3])
|
||||
nz = float(words[4])
|
||||
|
||||
if (faceVertID == 0):
|
||||
me.faces[curFaceID].v1.nx = nx;
|
||||
me.faces[curFaceID].v1.ny = ny;
|
||||
me.faces[curFaceID].v1.nz = nz;
|
||||
elif (faceVertID == 1):
|
||||
me.faces[curFaceID].v2.nx = nx;
|
||||
me.faces[curFaceID].v2.ny = ny;
|
||||
me.faces[curFaceID].v2.nz = nz;
|
||||
elif (faceVertID == 2):
|
||||
me.faces[curFaceID].v3.nx = nx;
|
||||
me.faces[curFaceID].v3.ny = ny;
|
||||
me.faces[curFaceID].v3.nz = nz;
|
||||
|
||||
faceVertID = faceVertID + 1;
|
||||
elif words[0] == '*MESH_ANIMATION':
|
||||
me.animated = 1
|
||||
|
||||
# now the loop for animation frames
|
||||
if objIdx > 0 and me.animated == 1:
|
||||
if words[0] == '*MESH_VERTEX_LIST':
|
||||
me.frameCount += 1
|
||||
me.frames.append([])
|
||||
elif words[0] == '*MESH_VERTEX':
|
||||
me.frames[me.frameCount].append(mesh_vert())
|
||||
i = int(words[1])
|
||||
me.frames[me.frameCount][i].x = float(words[2]);
|
||||
me.frames[me.frameCount][i].y = float(words[3]);
|
||||
me.frames[me.frameCount][i].z = float(words[4]);
|
||||
|
||||
PBidx += 1.0
|
||||
|
||||
spawn_main(objects)
|
||||
|
||||
Blender.Redraw()
|
||||
|
||||
def spawn_main(objects):
|
||||
|
||||
PBidx = 0.0
|
||||
objCount = float(len(objects))
|
||||
|
||||
print 'Import Objects'
|
||||
Blender.Window.DrawProgressBar(0.0, "Importing Objects...")
|
||||
|
||||
for obj in objects:
|
||||
|
||||
Blender.Window.DrawProgressBar(PBidx / objCount, "Importing Objects...")
|
||||
|
||||
if obj.objType == 'Mesh':
|
||||
spawn_mesh(obj)
|
||||
|
||||
PBidx += 1.0
|
||||
|
||||
import random
|
||||
|
||||
def spawn_mesh(obj):
|
||||
|
||||
objMe = obj.obj
|
||||
#normal_flag = 1
|
||||
|
||||
row0 = obj.row0x, obj.row0y, obj.row0z
|
||||
row1 = obj.row1x, obj.row1y, obj.row1z
|
||||
row2 = obj.row2x, obj.row2y, obj.row2z
|
||||
row3 = obj.row3x, obj.row3y, obj.row3z
|
||||
|
||||
newMatrix = Blender.Mathutils.Matrix(row0, row1, row2, row3)
|
||||
newMatrix.resize4x4()
|
||||
|
||||
newObj = Blender.Object.New(obj.objType, obj.name)
|
||||
newObj.setMatrix(newMatrix)
|
||||
Blender.Scene.getCurrent().link(newObj)
|
||||
|
||||
|
||||
newMesh = Blender.Mesh.New(obj.objName)
|
||||
newMesh.getFromObject(newObj.name)
|
||||
|
||||
newMesh.vertexUV = 1
|
||||
newObj.link(newMesh)
|
||||
|
||||
del objMe.verts[:]
|
||||
objMe.vCount = 0
|
||||
|
||||
vertDict = {}
|
||||
|
||||
#for face in objMe.faces:
|
||||
#objMe.verts.append(face.v1)
|
||||
#objMe.verts.append(face.v2)
|
||||
#objMe.verts.append(face.v3)
|
||||
#face.i1 = objMe.vCount
|
||||
#objMe.vCount = objMe.vCount + 1
|
||||
#face.i2 = objMe.vCount
|
||||
#objMe.vCount = objMe.vCount + 1
|
||||
#face.i3 = objMe.vCount
|
||||
#objMe.vCount = objMe.vCount + 1
|
||||
|
||||
for face in objMe.faces:
|
||||
if not face.v1.make_tuple() in vertDict:
|
||||
vertDict[face.v1.make_tuple()] = objMe.vCount
|
||||
objMe.verts.append(face.v1)
|
||||
objMe.vCount = objMe.vCount + 1
|
||||
if not face.v2.make_tuple() in vertDict:
|
||||
vertDict[face.v2.make_tuple()] = objMe.vCount
|
||||
objMe.verts.append(face.v2)
|
||||
objMe.vCount = objMe.vCount + 1
|
||||
if not face.v3.make_tuple() in vertDict:
|
||||
vertDict[face.v3.make_tuple()] = objMe.vCount
|
||||
objMe.verts.append(face.v3)
|
||||
objMe.vCount = objMe.vCount + 1
|
||||
face.i1 = vertDict[face.v1.make_tuple()]
|
||||
face.i2 = vertDict[face.v2.make_tuple()]
|
||||
face.i3 = vertDict[face.v3.make_tuple()]
|
||||
|
||||
# Verts
|
||||
for i in range(objMe.vCount):
|
||||
xyz = Blender.Mathutils.Vector(objMe.verts[i].x, objMe.verts[i].y, objMe.verts[i].z)
|
||||
newMesh.verts.extend(xyz)
|
||||
|
||||
for i in range(objMe.vCount):
|
||||
xyz = Blender.Mathutils.Vector(objMe.verts[i].x, objMe.verts[i].y, objMe.verts[i].z)
|
||||
uv = Blender.Mathutils.Vector(objMe.verts[i].u, objMe.verts[i].v)
|
||||
norm = Blender.Mathutils.Vector(objMe.verts[i].nx, objMe.verts[i].ny, objMe.verts[i].nz)
|
||||
newMesh.verts[i].co = xyz;
|
||||
newMesh.verts[i].uvco = uv;
|
||||
newMesh.verts[i].no = norm;
|
||||
|
||||
if objMe.animated:
|
||||
objMe.frameCount -= 1 # do we always get an extra frame at the end?
|
||||
for frame in objMe.frames:
|
||||
for i in range(objMe.vCount):
|
||||
xyz = Blender.Mathutils.Vector(frame[objMe.verts[i].origi].x, frame[objMe.verts[i].origi].y, frame[objMe.verts[i].origi].z)
|
||||
|
||||
newMesh.verts[i].co = xyz;
|
||||
newObj.insertShapeKey()
|
||||
|
||||
for key in Key.Get() :
|
||||
key.ipo = Ipo.New('Key', "bleh" + "_ipo")
|
||||
index = 1
|
||||
for curveName in key.ipo.curveConsts :
|
||||
# print curveName
|
||||
key.ipo.addCurve(curveName)
|
||||
key.ipo[curveName].interpolation = IpoCurve.InterpTypes.CONST
|
||||
key.ipo[curveName].addBezier((0, 0))
|
||||
key.ipo[curveName].addBezier((index, 1))
|
||||
key.ipo[curveName].addBezier((index + 1, 0))
|
||||
index+=1
|
||||
|
||||
# Faces
|
||||
for i in range(objMe.fCount):
|
||||
face = [objMe.faces[i].i1, objMe.faces[i].i2, objMe.faces[i].i3]
|
||||
newMesh.faces.extend(face)
|
||||
|
||||
# UV
|
||||
#if guiTable['UV'] == 1 and objMe.hasFUV == 1:
|
||||
#newMesh.faceUV = 1
|
||||
#for f in objMe.uvFaces:
|
||||
#uv1 = Blender.Mathutils.Vector(float(objMe.uvVerts[f.uv1].u), float(objMe.uvVerts[f.uv1].v))
|
||||
#uv2 = Blender.Mathutils.Vector(float(objMe.uvVerts[f.uv2].u), float(objMe.uvVerts[f.uv2].v))
|
||||
#uv3 = Blender.Mathutils.Vector(float(objMe.uvVerts[f.uv3].u), float(objMe.uvVerts[f.uv3].v))
|
||||
#newMesh.faces[f.index].uv = [uv1, uv2, uv3]
|
||||
## normals
|
||||
#vertices = [coords for n, coords in sorted(objMe.normals)]
|
||||
|
||||
#random.seed()
|
||||
|
||||
#i = 0
|
||||
#for v in newMesh.verts:
|
||||
#no = Blender.Mathutils.Vector(vertices[i][0], vertices[i][1], vertices[i][2])
|
||||
#v.no = no
|
||||
#print 'vertice ', i, 'normal : ', v.no
|
||||
##v.no[0] = vertices[i][0]
|
||||
##v.no[1] = vertices[i][1]
|
||||
##v.no[2] = vertices[i][2]
|
||||
#i = i + 1
|
||||
|
||||
newMesh.transform((newObj.getMatrix('worldspace').invert()), 1)
|
||||
|
||||
Blender.Set("curframe", objMe.frameCount + 1)
|
||||
|
||||
counts['verts'] += objMe.vCount
|
||||
counts['tris'] += objMe.fCount
|
||||
print 'Imported Mesh-Object: ', obj.name
|
||||
|
||||
|
||||
|
||||
def read_ui(filename):
|
||||
Window.WaitCursor(1)
|
||||
|
||||
read_main(filename)
|
||||
|
||||
Window.WaitCursor(0)
|
||||
|
||||
|
||||
Blender.Window.FileSelector(read_ui, "Import ASE")
|
|
@ -1,153 +0,0 @@
|
|||
// BIN2C.CPP
|
||||
// by Jonathon Fowler (jf@jonof.id.au)
|
||||
|
||||
// Converts a binary file to C source
|
||||
// This is a DOS program originally written with Borland Turbo C++ for DOS 3.1
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <dir.h>
|
||||
#include <io.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
char defsrcext[] = ".DAT";
|
||||
char defoutext[] = ".C";
|
||||
|
||||
char source[MAXPATH], output[MAXPATH], bytesize;
|
||||
|
||||
|
||||
int PathAddExt(char *path, char *ext);
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
printf("BIN2C - Binary to C data converter\n"
|
||||
"Copyright (c) 1999 Jonathon Fowler\n\n");
|
||||
|
||||
if (argc < 4)
|
||||
{
|
||||
printf("Usage:\n"
|
||||
" BIN2C source<.DAT> output<.C> b|w\n\n"
|
||||
" source<.DAT> Binary source file\n"
|
||||
" output<.C> Output C code file\n"
|
||||
" b|w Byte or word-sized data\n\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int arg;
|
||||
FILE *in, *out;
|
||||
char datab1, datab2;
|
||||
int across=0, maxacross;
|
||||
int length, written=0;
|
||||
|
||||
|
||||
// get the source file
|
||||
strcpy(source, argv[1]);
|
||||
strupr(source);
|
||||
PathAddExt(source, defsrcext);
|
||||
printf("þ Source file: %s\n", source);
|
||||
|
||||
// get the output file
|
||||
strcpy(output, argv[2]);
|
||||
strupr(output);
|
||||
PathAddExt(output, defoutext);
|
||||
printf("þ Output file: %s\n", output);
|
||||
|
||||
// get byte/word data
|
||||
switch (tolower(argv[3][0]))
|
||||
{
|
||||
case 'b':
|
||||
printf("þ Byte data.\n");
|
||||
bytesize=1;
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
printf("þ Word data.\n");
|
||||
bytesize=0;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("þ Unknown data size specified. Defaulting to byte.\n");
|
||||
bytesize=1;
|
||||
break;
|
||||
}
|
||||
|
||||
// open the input file
|
||||
in = fopen(source, "rb");
|
||||
if (!in)
|
||||
{
|
||||
printf("Error opening %s\n", source);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// open the output file
|
||||
out = fopen(output, "w+t");
|
||||
if (!out)
|
||||
{
|
||||
printf("Error creating %s\n", output);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
length = filelength(fileno(in));
|
||||
|
||||
// write a header out to the output file
|
||||
fprintf(out, "// %s\n\n// Generated by BIN2C.EXE\n// By Jonathon Fowler\n\n", output);
|
||||
|
||||
// start a data block
|
||||
fprintf(out, "%s datablock[] = {\n // %ld bytes", (bytesize) ? "char" : "unsigned", length);
|
||||
|
||||
if (bytesize)
|
||||
maxacross = 12;
|
||||
else
|
||||
maxacross = 9;
|
||||
across = maxacross;
|
||||
|
||||
// convert the data
|
||||
for (written=0; written<length; written++) {
|
||||
if (across == maxacross)
|
||||
{
|
||||
fprintf(out, "\n ");
|
||||
across = 0;
|
||||
}
|
||||
|
||||
if (bytesize)
|
||||
{
|
||||
datab1 = fgetc(in);
|
||||
fprintf(out, " 0x%02X%c", datab1, ((length-written)>1) ? ',' : '\n');
|
||||
} else {
|
||||
datab1 = fgetc(in);
|
||||
datab2 = fgetc(in);
|
||||
fprintf(out, " 0x%02X%02X%c", datab2, datab1, ((length-written)>2) ? ',' : '\n');
|
||||
}
|
||||
|
||||
across++;
|
||||
|
||||
if (!bytesize) written++;
|
||||
}
|
||||
|
||||
|
||||
fprintf(out, " };");
|
||||
|
||||
fclose(out);
|
||||
fclose(in);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Add an extention to a path if one doesn't exist
|
||||
int PathAddExt(char *path, char *ext)
|
||||
{
|
||||
char drive[MAXDRIVE], dir[MAXDIR], name[MAXFILE], extn[MAXEXT];
|
||||
int flags;
|
||||
|
||||
flags = fnsplit(path, drive, dir, name, extn);
|
||||
|
||||
if (!(flags & EXTENSION)) // tack on an extension
|
||||
strcat(path, ext);
|
||||
|
||||
return ((flags & EXTENSION) == 0);
|
||||
}
|
|
@ -1,466 +0,0 @@
|
|||
/*
|
||||
Build Game Customization Suite
|
||||
Copyright (c) 1999, 2004 Jonathon Fowler
|
||||
|
||||
15 September 2004
|
||||
|
||||
This is the source code to BCS. It was written in Borland Turbo C++ for DOS
|
||||
and [was] a 16bit real-mode DOS application. I'm releasing the code because
|
||||
I have no reason to keep it a secret. Some folks might find it interesting.
|
||||
|
||||
BTW, you can use this code for any purpose you want.
|
||||
|
||||
Jonathon Fowler
|
||||
jf@jonof.id.au
|
||||
http://www.jonof.id.au/
|
||||
*/
|
||||
/*
|
||||
NOTE: This program does not fall under BUILDLIC.
|
||||
*/
|
||||
// DOS 16-bit real mode UI --> portable command line conversion by Hendricks266
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
const char APP_NAME[] = "Build Game Customization Suite v0.2-EDuke32";
|
||||
const char APP_CPRT[] = "Copyright (c) 1999, 2004 Jonathon Fowler";
|
||||
|
||||
int bsExtractD3DPalette(int, const char*);
|
||||
int bsUpdateD3DPalette(int, const char*);
|
||||
|
||||
int bsExtractPalette(const char*);
|
||||
int bsUpdatePalette(const char*);
|
||||
|
||||
const char *MainMenuStrings[] = {
|
||||
"Options:",
|
||||
"Extract Duke Nukem 3D-specific Palettes",
|
||||
"Update Duke Nukem 3D-specific Palettes",
|
||||
"Extract Build Game Palette",
|
||||
"Update Build Game Palette"
|
||||
};
|
||||
|
||||
const char *D3DMenuStrings[] = {
|
||||
"Sub-Option: Duke Nukem 3D-specific Palettes:",
|
||||
"Water Palette",
|
||||
"Night-Vision Palette",
|
||||
"Title Screen Palette",
|
||||
"3D Realms Logo Palette",
|
||||
"Episode 1 Ending Animation Palette"
|
||||
};
|
||||
|
||||
const char *pal_deffn[] = {
|
||||
"GAME.PAL",
|
||||
"D3DWATER.PAL",
|
||||
"D3DNVIS.PAL",
|
||||
"D3DTITLE.PAL",
|
||||
"D3D3DR.PAL",
|
||||
"D3DEP1.PAL"
|
||||
};
|
||||
|
||||
int main(const int32_t argc, const char **argv)
|
||||
{
|
||||
int opt = 0, d3dpal = 0, k = 0;
|
||||
int16_t i = 1;
|
||||
char const * filename = NULL; // This is only a pointer. Do not strcpy to it.
|
||||
char const * c = NULL;
|
||||
|
||||
Bprintf("%s\n%s\n\n", APP_NAME, APP_CPRT);
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
opt = Bstrtol(argv[i++],NULL,10);
|
||||
if ((opt == 1 || opt == 2) && i < argc) // Duke-specific palettes
|
||||
d3dpal = Bstrtol(argv[i++],NULL,10);
|
||||
|
||||
while (i < argc)
|
||||
{
|
||||
c = (char const *)argv[i];
|
||||
if ((*c == '-')
|
||||
#ifdef _WIN32
|
||||
|| (*c == '/')
|
||||
#endif
|
||||
)
|
||||
{
|
||||
++c;
|
||||
if (!Bstrcasecmp(c,"f"))
|
||||
{
|
||||
if (argc > i+1)
|
||||
filename = (char const *)argv[++i];
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
if (opt < 1 || opt > 4 || (opt < 3 && (d3dpal < 1 || d3dpal > 5)))
|
||||
{
|
||||
Bprintf("usage: %s <option> <sub-option(s)> [-f filename]\n",argv[0]);
|
||||
Bprintf("If a filename is not specified, internal defaults will be used.\n");
|
||||
Bprintf("\n");
|
||||
for (k = 0; k < 5; ++k)
|
||||
{
|
||||
if (k > 0)
|
||||
Bprintf("%d - ",k);
|
||||
Bprintf("%s\n",MainMenuStrings[k]);
|
||||
}
|
||||
Bprintf("\n");
|
||||
for (k = 0; k < 6; ++k)
|
||||
{
|
||||
if (k > 0)
|
||||
Bprintf("%d - ",k);
|
||||
Bprintf("%s\n",D3DMenuStrings[k]);
|
||||
}
|
||||
Bprintf("\n");
|
||||
/*
|
||||
Bprintf( "This program is, well, I guess freeware. Questions, suggestions,\n"
|
||||
"comments and bug reports are welcome at jf@jonof.id.au. Visit\n"
|
||||
"my website at http://www.jonof.id.au/ for more information\n"
|
||||
"on this program and others that I may happen to write.\n\n");
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
if (filename == NULL)
|
||||
switch (opt)
|
||||
{
|
||||
case 1: // Duke-specific palettes
|
||||
case 2:
|
||||
filename = (char const *)pal_deffn[d3dpal];
|
||||
break;
|
||||
|
||||
case 3: // game palette
|
||||
case 4:
|
||||
filename = (char const *)pal_deffn[0];
|
||||
break;
|
||||
}
|
||||
|
||||
switch (opt)
|
||||
{
|
||||
case 1: // extract Duke-specific palettes
|
||||
bsExtractD3DPalette(d3dpal-1, filename);
|
||||
break;
|
||||
|
||||
case 2: // update Duke-specific palettes
|
||||
bsUpdateD3DPalette(d3dpal-1, filename);
|
||||
break;
|
||||
|
||||
case 3: // extract game palette
|
||||
bsExtractPalette(filename);
|
||||
break;
|
||||
|
||||
case 4: // update game palette
|
||||
bsUpdatePalette(filename);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const int pal_offsets[5] = {6426, 7194, 7962, 8730, 9498};
|
||||
|
||||
|
||||
#define PAL_LEN 768
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
//
|
||||
// Extract and update functions
|
||||
|
||||
int bsExtractD3DPalette(int palnum, const char *outfn)
|
||||
{
|
||||
BFILE *lookup, *out;
|
||||
char cb[3];
|
||||
int lp;
|
||||
|
||||
Bprintf("Using: %s\n",outfn);
|
||||
|
||||
lookup = Bfopen("LOOKUP.DAT", "rb");
|
||||
if (lookup == NULL)
|
||||
{
|
||||
// could not open LOOKUP.DAT
|
||||
Bprintf("Error opening LOOKUP.DAT!\n"
|
||||
"Make sure that the file is in the current\n"
|
||||
"directory, then try again.\n\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// create output file
|
||||
out = Bfopen(outfn, "w+t");
|
||||
if (out == NULL)
|
||||
{
|
||||
Bfclose(lookup);
|
||||
Bprintf("Error creating output file!\n"
|
||||
"The file may be open by another program\n"
|
||||
"or is read-only, or the disk may be read-only.\n\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// write out the palette data in PSP format
|
||||
|
||||
// find palette data
|
||||
Bfseek(lookup, pal_offsets[palnum], SEEK_SET);
|
||||
|
||||
// write out a Paint Shop Pro palette file
|
||||
Bfprintf(out, "JASC-PAL\n0100\n256\n");
|
||||
for (lp=0; lp < 256; lp++)
|
||||
{
|
||||
cb[0] = Bfgetc(lookup) * 4;
|
||||
cb[1] = Bfgetc(lookup) * 4;
|
||||
cb[2] = Bfgetc(lookup) * 4;
|
||||
|
||||
Bfprintf(out, "%d %d %d\n", cb[0], cb[1], cb[2]);
|
||||
}
|
||||
|
||||
// close files
|
||||
Bfclose(out);
|
||||
Bfclose(lookup);
|
||||
|
||||
Bprintf("Palette dumped successfully!\n\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int bsUpdateD3DPalette(int palnum, const char *palfn)
|
||||
{
|
||||
BFILE *lookup, *pal;
|
||||
char cb[3], work[64];
|
||||
int lp;
|
||||
|
||||
Bprintf("Using: %s\n",palfn);
|
||||
|
||||
lookup = Bfopen("LOOKUP.DAT", "r+b");
|
||||
if (lookup == NULL)
|
||||
{
|
||||
// could not open LOOKUP.DAT
|
||||
Bprintf("Error opening LOOKUP.DAT!\n"
|
||||
"The file may be open by another program\n"
|
||||
"or is read-only, or the disk may be read-only.\n\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// open source file
|
||||
pal = Bfopen(palfn, "rt");
|
||||
if (pal == NULL)
|
||||
{
|
||||
Bfclose(lookup);
|
||||
Bprintf("Error opening palette file!\n"
|
||||
"Make sure that the file exists.\n\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// read the palette data and write it to LOOKUP.DAT
|
||||
|
||||
Bfgets(work, 64, pal);
|
||||
if (strncmp(work, "JASC-PAL", 8))
|
||||
{
|
||||
Bfclose(pal); Bfclose(lookup);
|
||||
Bprintf("Error validating palette file!\n"
|
||||
"This palette file appears to be in a format\n"
|
||||
"other than Paint Shop Pro format. This program\n"
|
||||
"works only with Paint Shop Pro palette files.\n\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
Bfgets(work, 64, pal);
|
||||
if (strncmp(work, "0100", 4))
|
||||
{
|
||||
Bfclose(pal); Bfclose(lookup);
|
||||
Bprintf("Error validating palette file!\n"
|
||||
"This palette file appears to be in a version\n"
|
||||
"other than 0100. This program works only with\n"
|
||||
"Paint Shop Pro palettes of version 0100.\n\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
Bfgets(work, 64, pal);
|
||||
if (strncmp(work, "256", 3))
|
||||
{
|
||||
Bfclose(pal); Bfclose(lookup);
|
||||
Bprintf("Error validating palette file!\n"
|
||||
"This palette file appears to be for a palette\n"
|
||||
"size other than 256 colours. This program works\n"
|
||||
"only with Paint Shop Pro palettes of 256 colours.\n\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// find palette data
|
||||
Bfseek(lookup, pal_offsets[palnum], SEEK_SET);
|
||||
|
||||
// write out new palette info
|
||||
for (lp=0; lp < 256; lp++)
|
||||
{
|
||||
Bfscanf(pal, "%c %c %c\n", &cb[0], &cb[1], &cb[2]);
|
||||
|
||||
Bfputc(cb[0] / 4, lookup);
|
||||
Bfputc(cb[1] / 4, lookup);
|
||||
Bfputc(cb[2] / 4, lookup);
|
||||
}
|
||||
|
||||
// close files
|
||||
Bfclose(pal);
|
||||
Bfclose(lookup);
|
||||
|
||||
Bprintf("Palette updated successfully!\n\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Format of PALETTE.DAT files
|
||||
//
|
||||
// 256 bytes - palette
|
||||
// 2 bytes - short: number of palette lookups
|
||||
// n*256 bytes - shading lookup tables
|
||||
// 256*256 bytes - translucency lookup array
|
||||
|
||||
|
||||
|
||||
int bsExtractPalette(const char *outfn)
|
||||
{
|
||||
BFILE *palette, *out;
|
||||
char cb[3];
|
||||
int lp;
|
||||
|
||||
Bprintf("Using: %s\n",outfn);
|
||||
|
||||
palette = Bfopen("PALETTE.DAT", "rb");
|
||||
if (palette == NULL)
|
||||
{
|
||||
// could not open PALETTE.DAT
|
||||
Bprintf("Error opening PALETTE.DAT!\n"
|
||||
"Make sure that the file is in the current\n"
|
||||
"directory, then try again.\n\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// create output file
|
||||
out = Bfopen(outfn, "w+t");
|
||||
if (out == NULL)
|
||||
{
|
||||
Bfclose(palette);
|
||||
Bprintf("Error creating output file!\n"
|
||||
"The file may be open by another program\n"
|
||||
"or is read-only, or the disk may be read-only.\n\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// write out the palette data in PSP format
|
||||
|
||||
// write out a Paint Shop Pro palette file
|
||||
Bfprintf(out, "JASC-PAL\n0100\n256\n");
|
||||
for (lp=0; lp < 256; lp++)
|
||||
{
|
||||
cb[0] = Bfgetc(palette) * 4;
|
||||
cb[1] = Bfgetc(palette) * 4;
|
||||
cb[2] = Bfgetc(palette) * 4;
|
||||
|
||||
Bfprintf(out, "%d %d %d\n", cb[0], cb[1], cb[2]);
|
||||
}
|
||||
|
||||
// close files
|
||||
Bfclose(out);
|
||||
Bfclose(palette);
|
||||
|
||||
Bprintf("Palette dumped successfully!\n\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int bsUpdatePalette(const char *palfn)
|
||||
{
|
||||
BFILE *palette, *pal;
|
||||
char cb[3], work[64];
|
||||
int lp;
|
||||
|
||||
Bprintf("Using: %s\n",palfn);
|
||||
|
||||
palette = Bfopen("PALETTE.DAT", "w+b");
|
||||
if (palette == NULL)
|
||||
{
|
||||
// could not open LOOKUP.DAT
|
||||
Bprintf("Error opening PALETTE.DAT!\n"
|
||||
"The file may be open by another program\n"
|
||||
"or is read-only, or the disk may be read-only.\n\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// open source file
|
||||
pal = Bfopen(palfn, "rt");
|
||||
if (pal == NULL)
|
||||
{
|
||||
Bfclose(palette);
|
||||
Bprintf("Error opening palette file!\n"
|
||||
"Make sure that the file exists.\n\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// read the palette data and write it to PALETTE.DAT
|
||||
|
||||
Bfgets(work, 64, pal);
|
||||
if (strncmp(work, "JASC-PAL", 8))
|
||||
{
|
||||
Bfclose(pal); Bfclose(palette);
|
||||
Bprintf("Error validating palette file!\n"
|
||||
"This palette file appears to be in a format\n"
|
||||
"other than Paint Shop Pro format. This program\n"
|
||||
"works only with Paint Shop Pro palette files.\n\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
Bfgets(work, 64, pal);
|
||||
if (strncmp(work, "0100", 4))
|
||||
{
|
||||
Bfclose(pal); Bfclose(palette);
|
||||
Bprintf("Error validating palette file!\n"
|
||||
"This palette file appears to be in a version\n"
|
||||
"other than 0100. This program works only with\n"
|
||||
"Paint Shop Pro palettes of version 0100.\n\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
Bfgets(work, 64, pal);
|
||||
if (strncmp(work, "256", 3))
|
||||
{
|
||||
Bfclose(pal); Bfclose(palette);
|
||||
Bprintf("Error validating palette file!\n"
|
||||
"This palette file appears to be for a palette\n"
|
||||
"size other than 256 colours. This program works\n"
|
||||
"only with Paint Shop Pro palettes of 256 colours.\n\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// write out new palette info
|
||||
for (lp=0; lp < 256; lp++)
|
||||
{
|
||||
Bfscanf(pal, "%c %c %c\n", &cb[0], &cb[1], &cb[2]);
|
||||
|
||||
// put the bytes into the basergb array as well
|
||||
Bfputc(cb[0] / 4, palette);
|
||||
Bfputc(cb[1] / 4, palette);
|
||||
Bfputc(cb[2] / 4, palette);
|
||||
}
|
||||
|
||||
// close files
|
||||
Bfclose(pal);
|
||||
Bfclose(palette);
|
||||
|
||||
Bprintf("Palette updated successfully!\n"
|
||||
"Now run TRANSPAL.EXE to create the shading\n"
|
||||
"and translucency tables for the palette.\n\n");
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
// XXX: This program is not in sync with EDuke32 (e.g. texcacheheader type).
|
||||
|
||||
#include "compat.h"
|
||||
#include <dirent.h>
|
||||
|
||||
#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
|
||||
|
||||
typedef struct {
|
||||
char magic[8]; // 'Polymost'
|
||||
int xdim, ydim; // of image, unpadded
|
||||
int flags; // 1 = !2^x, 2 = has alpha, 4 = lzw compressed
|
||||
} texcacheheader;
|
||||
typedef struct {
|
||||
int size;
|
||||
int format;
|
||||
int xdim, ydim; // of mipmap (possibly padded)
|
||||
int border, depth;
|
||||
} texcachepicture;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
DIR *dir;
|
||||
struct dirent *dirent;
|
||||
struct stat st;
|
||||
FILE *fp;
|
||||
texcacheheader head;
|
||||
texcachepicture mip;
|
||||
|
||||
dir = opendir(".");
|
||||
while ((dirent = readdir(dir))) {
|
||||
if (stat(dirent->d_name, &st)) {
|
||||
printf("%s: failed to stat\n", dirent->d_name);
|
||||
continue;
|
||||
}
|
||||
if (!(st.st_mode&S_IFREG)) {
|
||||
printf("%s: not a regular file\n", dirent->d_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
fp = fopen(dirent->d_name,"rb");
|
||||
if (!fp) {
|
||||
printf("%s: failed to open\n", dirent->d_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (fread(&head, sizeof(head), 1, fp) != 1) {
|
||||
fclose(fp);
|
||||
printf("%s: failed to read header\n", dirent->d_name);
|
||||
continue;
|
||||
}
|
||||
head.xdim = B_LITTLE32(head.xdim);
|
||||
head.ydim = B_LITTLE32(head.ydim);
|
||||
head.flags = B_LITTLE32(head.flags);
|
||||
if (fread(&mip, sizeof(mip), 1, fp) != 1) {
|
||||
fclose(fp);
|
||||
printf("%s: failed to read mipmap header\n", dirent->d_name);
|
||||
continue;
|
||||
}
|
||||
mip.format = B_LITTLE32(mip.format);
|
||||
fclose(fp);
|
||||
if (memcmp(head.magic, "Polymost", 8)) {
|
||||
printf("%s: bad signature\n", dirent->d_name);
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
char const * format;
|
||||
char flags[4] = "", flagsc = 0;
|
||||
switch (mip.format) {
|
||||
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: format = "RGB DXT1"; break;
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: format = "RGBA DXT1"; break;
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: format = "RGBA DXT3"; break;
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: format = "RGBA DXT5"; break;
|
||||
default: format = "Unknown"; break;
|
||||
}
|
||||
if (head.flags&1) flags[flagsc++] = '2';
|
||||
if (head.flags&2) flags[flagsc++] = 'A';
|
||||
if (head.flags&4) flags[flagsc++] = 'L';
|
||||
flags[flagsc++] = 0;
|
||||
|
||||
printf("%s: flags=%s format=%s\n", dirent->d_name, flags, format);
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
function usage ()
|
||||
{
|
||||
echo 'Usage: checkdefs.sh <some.def> [[<search_path_base_dir>] {-patch,-con,-conpatch}]'
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
usage
|
||||
fi
|
||||
deffn="$1"
|
||||
|
||||
if [ ! -f "$deffn" ]; then
|
||||
echo "Error: First argument must be a name of an existing DEF or CON file."
|
||||
usage
|
||||
fi
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
thedir=.
|
||||
else
|
||||
thedir="$2"
|
||||
fi
|
||||
|
||||
if [ ! -d "$thedir" ]; then
|
||||
echo "Error: Second argument must be a name of an existing directory."
|
||||
usage
|
||||
fi
|
||||
|
||||
dopatch=""
|
||||
docon=""
|
||||
if [ -n "$3" ]; then
|
||||
if [ "$3" != "-patch" -a "$3" != "-con" -a "$3" != "-conpatch" ]; then
|
||||
echo 'Usage: checkdefs.sh <some.def> [[<search_path_base_dir>] {-patch,-con,-conpatch}]'
|
||||
exit 1
|
||||
fi
|
||||
if [ "$3" == "-patch" ]; then
|
||||
dopatch=1
|
||||
elif [ "$3" == "-con" ]; then
|
||||
docon=1
|
||||
else
|
||||
docon=1
|
||||
dopatch=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z $docon ]; then
|
||||
# def
|
||||
files=$(grep -E "\"[^ ]*\..*\"" "$deffn" | sed 's/.*"\(.*\..*\)".*/\1/g')
|
||||
files2=$(grep -E '^include ' "$deffn" | sed 's/^include \(.*\)\r/\1/g') # XXX: \r
|
||||
|
||||
files="$files $files2"
|
||||
else
|
||||
# con... this is awful
|
||||
files=$(grep -E -i '(include *.*\.con)|(definesound.*(voc|wav|ogg))|(definelevelname.*\.map)' "$deffn" |
|
||||
sed -r 's/.*include[ \t]+([^ \t]+\.[cC][oO][nN]).*/\1/g;
|
||||
s/.*[ \t]([^ \t].+\.([wW][aA][vV]|[vV][oO][cC]|[oO][gG][gG])).*/\1/g;
|
||||
s/.*[ \t]([^ \t].+\.([mM][aA][pP])).*/\1/g;')
|
||||
fi
|
||||
|
||||
exfiles=$(find -L "$thedir" -type f)
|
||||
|
||||
sedcmd=""
|
||||
|
||||
for i in $files; do
|
||||
fn="$thedir/$i"
|
||||
if [ ! -f "$fn" ]; then
|
||||
# try finding a matching file
|
||||
match=$(echo "$exfiles" | grep -i "^$fn$")
|
||||
|
||||
if [ -z "$match" ]; then
|
||||
if [ -z "$docon" ]; then # avoid spamming files not found that are in GRPs...
|
||||
echo "$fn"
|
||||
fi
|
||||
else
|
||||
echo "$fn --> $match"
|
||||
if [ -n "$dopatch" ]; then
|
||||
if [ -z "$docon" ]; then
|
||||
sedcmd="$sedcmd;s|\"$i\"|\"${match#$thedir/}\"|g"
|
||||
else
|
||||
sedcmd="$sedcmd;s|$i|${match#$thedir/}|g"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$dopatch" ]; then
|
||||
if [ -n "$sedcmd" ]; then
|
||||
echo "Patching $deffn"
|
||||
# echo "$sedcmd"
|
||||
sed -i "$sedcmd" "$deffn"
|
||||
fi
|
||||
fi
|
|
@ -1,28 +0,0 @@
|
|||
// Compatibility declarations for the tools to avoid linking to the entire engine.
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//
|
||||
// initprintf() -- prints a string
|
||||
//
|
||||
void initprintf(const char *f, ...)
|
||||
{
|
||||
va_list va;
|
||||
char buf[2048];
|
||||
|
||||
va_start(va, f);
|
||||
Bvsnprintf(buf, sizeof(buf), f, va);
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
int initputs (const char * str) { return puts(str); }
|
||||
|
||||
int16_t editstatus = 1;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -1,160 +0,0 @@
|
|||
|
||||
#include "compat.h"
|
||||
|
||||
#define NEED_DDRAW_H
|
||||
#include "windows_inc.h"
|
||||
|
||||
#define DEFAULT_OUTPUT_FILE "enumdisplay.txt"
|
||||
|
||||
HMODULE hDDrawDLL = NULL;
|
||||
LPDIRECTDRAW lpDD = NULL;
|
||||
FILE *output = NULL;
|
||||
|
||||
void usage(void)
|
||||
{
|
||||
printf(
|
||||
"enumdisplay by Jonathon Fowler (jf@jonof.id.au)\n"
|
||||
"Options:\n"
|
||||
" -h, -?, --help This message\n"
|
||||
" -o <filename> Use different output file (default: "
|
||||
DEFAULT_OUTPUT_FILE ", use - for stdout)\n"
|
||||
);
|
||||
}
|
||||
|
||||
void dumpdevmode(DEVMODE *devmode)
|
||||
{
|
||||
fprintf(output, "\tdmFields has");
|
||||
if (devmode->dmFields & DM_PELSWIDTH) fprintf(output, " DM_PELSWIDTH");
|
||||
if (devmode->dmFields & DM_PELSHEIGHT) fprintf(output, " DM_PELSHEIGHT");
|
||||
if (devmode->dmFields & DM_BITSPERPEL) fprintf(output, " DM_BITSPERPEL");
|
||||
fprintf(output, "\n\tdmPelsWidth = %lu\n", devmode->dmPelsWidth);
|
||||
fprintf(output, "\tdmPelsHeight = %lu\n", devmode->dmPelsHeight);
|
||||
fprintf(output, "\tdmBitsPerPel = %lu\n", devmode->dmBitsPerPel);
|
||||
}
|
||||
|
||||
HRESULT WINAPI ddenum(DDSURFACEDESC *ddsd, VOID *udata ATTRIBUTE((unused)))
|
||||
{
|
||||
fprintf(output, "\tdwFlags has");
|
||||
if (ddsd->dwFlags & DDSD_WIDTH) fprintf(output, " DDSD_WIDTH");
|
||||
if (ddsd->dwFlags & DDSD_HEIGHT) fprintf(output, " DDSD_HEIGHT");
|
||||
if (ddsd->dwFlags & DDSD_PIXELFORMAT) fprintf(output, " DDSD_PIXELFORMAT");
|
||||
fprintf(output, "\n\tdwWidth = %lu\n", ddsd->dwWidth);
|
||||
fprintf(output, "\tdwHeight = %lu\n", ddsd->dwHeight);
|
||||
fprintf(output, "\tddpfPixelFormat.dwFlags has");
|
||||
if (ddsd->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED1) fprintf(output, " DDPF_PALETTEINDEXED1");
|
||||
if (ddsd->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED2) fprintf(output, " DDPF_PALETTEINDEXED2");
|
||||
if (ddsd->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED4) fprintf(output, " DDPF_PALETTEINDEXED4");
|
||||
if (ddsd->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8) fprintf(output, " DDPF_PALETTEINDEXED8");
|
||||
if (ddsd->ddpfPixelFormat.dwFlags & DDPF_RGB) fprintf(output, " DDPF_RGB");
|
||||
fprintf(output, "\n\tddpfPixelFormat.dwRGBBitCount = %lu\n", ddsd->ddpfPixelFormat.dwRGBBitCount);
|
||||
fprintf(output, "\n");
|
||||
|
||||
return(DDENUMRET_OK);
|
||||
}
|
||||
|
||||
typedef HRESULT (WINAPI *aDirectDrawCreateType)(GUID *, LPDIRECTDRAW *, IUnknown *);
|
||||
typedef HRESULT (WINAPI *aDirectDrawEnumerateType)(LPDDENUMCALLBACK, LPVOID);
|
||||
|
||||
int InitDirectDraw(void)
|
||||
{
|
||||
HRESULT result;
|
||||
aDirectDrawCreateType aDirectDrawCreate;
|
||||
aDirectDrawEnumerateType aDirectDrawEnumerate;
|
||||
|
||||
hDDrawDLL = LoadLibrary("DDRAW.DLL");
|
||||
if (!hDDrawDLL) { fprintf(output, "Failed loading DDRAW.DLL\n"); return -1; }
|
||||
|
||||
aDirectDrawEnumerate = (aDirectDrawEnumerateType)GetProcAddress(hDDrawDLL, "DirectDrawEnumerateA");
|
||||
if (!aDirectDrawEnumerate) { fprintf(output, "Error fetching DirectDrawEnumerate\n"); return -1; }
|
||||
|
||||
aDirectDrawCreate = (aDirectDrawCreateType)GetProcAddress(hDDrawDLL, "DirectDrawCreate");
|
||||
if (!aDirectDrawCreate) { fprintf(output, "Error fetching DirectDrawCreate\n"); return -1; }
|
||||
|
||||
result = aDirectDrawCreate(NULL, &lpDD, NULL);
|
||||
if (result != DD_OK) { fprintf(output, "DirectDrawCreate() failed (%ld)\n", result); return -1; }
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void UninitDirectDraw(void)
|
||||
{
|
||||
if (lpDD) IDirectDraw_Release(lpDD);
|
||||
lpDD = NULL;
|
||||
if (hDDrawDLL) FreeLibrary(hDDrawDLL);
|
||||
hDDrawDLL = NULL;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char const * outputfile = DEFAULT_OUTPUT_FILE;
|
||||
|
||||
int i;
|
||||
|
||||
DEVMODE devmode;
|
||||
HRESULT hresult;
|
||||
|
||||
for (i=1; i<argc; i++) {
|
||||
if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "-?") || !strcmp(argv[i], "--help")) {
|
||||
usage();
|
||||
return 0;
|
||||
} else if (!strcmp(argv[i], "-o")) {
|
||||
outputfile = argv[++i];
|
||||
}
|
||||
}
|
||||
|
||||
if (!strcmp(outputfile, "-")) {
|
||||
output = fdopen(1, "wt");
|
||||
outputfile = NULL;
|
||||
} else {
|
||||
output = fopen(outputfile, "wt");
|
||||
if (!output) {
|
||||
fprintf(stderr, "enumdisplay: failed to open %s for output\n", outputfile);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(output,
|
||||
"enumdisplay results\n"
|
||||
"\n"
|
||||
"Display settings:\n"
|
||||
);
|
||||
ZeroMemory(&devmode, sizeof(devmode));
|
||||
devmode.dmSize = sizeof(DEVMODE);
|
||||
if (!EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devmode)) {
|
||||
fprintf(output, "\tEnumDisplaySettings() FAILED!\n");
|
||||
} else {
|
||||
dumpdevmode(&devmode);
|
||||
}
|
||||
|
||||
fprintf(output,
|
||||
"\n"
|
||||
"All modes from EnumDisplaySettings:\n"
|
||||
);
|
||||
ZeroMemory(&devmode, sizeof(devmode));
|
||||
devmode.dmSize = sizeof(DEVMODE);
|
||||
i = 0;
|
||||
while (EnumDisplaySettings(NULL, i, &devmode)) {
|
||||
dumpdevmode(&devmode);
|
||||
fprintf(output, "\n");
|
||||
ZeroMemory(&devmode, sizeof(devmode));
|
||||
devmode.dmSize = sizeof(DEVMODE);
|
||||
i++;
|
||||
}
|
||||
|
||||
if (!InitDirectDraw()) {
|
||||
fprintf(output,
|
||||
"\n"
|
||||
"All modes from IDirectDraw::EnumDisplayModes:\n"
|
||||
);
|
||||
hresult = IDirectDraw_EnumDisplayModes(lpDD, 0, NULL, (LPVOID)0, ddenum);
|
||||
if (hresult != DD_OK) {
|
||||
fprintf(output, "\tIDirectDraw::EnumDisplayModes() FAILED! (%ld)\n", hresult);
|
||||
}
|
||||
}
|
||||
UninitDirectDraw();
|
||||
|
||||
if (outputfile) fclose(output);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
|
||||
#include "compat.h"
|
||||
#include "kplib.h"
|
||||
|
||||
struct icon {
|
||||
int32_t width,height;
|
||||
intptr_t *pixels;
|
||||
unsigned char *mask;
|
||||
};
|
||||
|
||||
int writeicon(FILE *fp, struct icon *ico)
|
||||
{
|
||||
int i;
|
||||
|
||||
Bfprintf(fp,
|
||||
"#include \"sdlayer.h\"\n"
|
||||
"\n"
|
||||
);
|
||||
Bfprintf(fp,"static unsigned int sdlappicon_pixels[] = {\n");
|
||||
for (i=0;i<ico->width*ico->height;i++) {
|
||||
if ((i%6) == 0) Bfprintf(fp,"\t");
|
||||
else Bfprintf(fp," ");
|
||||
Bfprintf(fp, "0x%08lx,", (long)B_LITTLE32(ico->pixels[i]));
|
||||
if ((i%6) == 5) Bfprintf(fp,"\n");
|
||||
}
|
||||
if ((i%16) > 0) Bfprintf(fp, "\n");
|
||||
Bfprintf(fp, "};\n\n");
|
||||
|
||||
Bfprintf(fp,"static unsigned char sdlappicon_mask[] = {\n");
|
||||
for (i=0;i<((ico->width+7)/8)*ico->height;i++) {
|
||||
if ((i%14) == 0) Bfprintf(fp,"\t");
|
||||
else Bfprintf(fp," ");
|
||||
Bfprintf(fp, "%3d,", ico->mask[i]);
|
||||
if ((i%14) == 13) Bfprintf(fp,"\n");
|
||||
}
|
||||
if ((i%16) > 0) Bfprintf(fp, "\n");
|
||||
Bfprintf(fp, "};\n\n");
|
||||
|
||||
Bfprintf(fp,
|
||||
"struct sdlappicon sdlappicon = {\n"
|
||||
" %d,%d, // width,height\n"
|
||||
" sdlappicon_pixels,\n"
|
||||
" sdlappicon_mask\n"
|
||||
"};\n",
|
||||
ico->width, ico->height
|
||||
);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct icon icon;
|
||||
int i;
|
||||
unsigned char *maskp, bm, *pp;
|
||||
|
||||
if (argc<2) {
|
||||
Bfprintf(stderr, "generateicon <picture file>\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
memset(&icon, 0, sizeof(icon));
|
||||
|
||||
kpzload(argv[1], (intptr_t*)&icon.pixels, &icon.width, &icon.height);
|
||||
if (!icon.pixels) {
|
||||
Bfprintf(stderr, "Failure loading %s\n", argv[1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
icon.mask = (unsigned char *)Bcalloc(icon.height, (icon.width+7)/8);
|
||||
if (!icon.mask) {
|
||||
Bfprintf(stderr, "Out of memory\n");
|
||||
Bfree(icon.pixels);
|
||||
return 1;
|
||||
}
|
||||
|
||||
maskp = icon.mask;
|
||||
bm = 1;
|
||||
pp = (unsigned char *)icon.pixels;
|
||||
for (i=0; i<icon.height*icon.width; i++) {
|
||||
if (bm == 0) {
|
||||
bm = 1;
|
||||
maskp++;
|
||||
}
|
||||
|
||||
{
|
||||
unsigned char c = pp[0];
|
||||
pp[0] = pp[2];
|
||||
pp[2] = c;
|
||||
}
|
||||
if (pp[3] > 0) *maskp |= bm;
|
||||
|
||||
bm <<= 1;
|
||||
pp += 4;
|
||||
}
|
||||
|
||||
writeicon(stdout, &icon);
|
||||
|
||||
Bfree(icon.pixels);
|
||||
Bfree(icon.mask);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,127 +0,0 @@
|
|||
// compile with:
|
||||
// gcc -o getdxdidf.exe src\getdxdidf.c -Ic:\mingw32\dx6\include -Lc:\mingw32\dx6\lib -ldxguid -ldinput -mwindows
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
#define NEED_DINPUT_H
|
||||
#include "windows_inc.h"
|
||||
|
||||
char const * WhatGUID(const GUID *guid)
|
||||
{
|
||||
if (guid == &GUID_XAxis) return "&GUID_XAxis";
|
||||
if (guid == &GUID_YAxis) return "&GUID_YAxis";
|
||||
if (guid == &GUID_ZAxis) return "&GUID_ZAxis";
|
||||
if (guid == &GUID_RxAxis) return "&GUID_RxAxis";
|
||||
if (guid == &GUID_RyAxis) return "&GUID_RyAxis";
|
||||
if (guid == &GUID_RzAxis) return "&GUID_RzAxis";
|
||||
if (guid == &GUID_Slider) return "&GUID_Slider";
|
||||
|
||||
if (guid == &GUID_Button) return "&GUID_Button";
|
||||
if (guid == &GUID_Key) return "&GUID_Key";
|
||||
|
||||
if (guid == &GUID_POV) return "&GUID_POV";
|
||||
|
||||
if (guid == &GUID_Unknown) return "&GUID_Unknown";
|
||||
|
||||
return "NULL";
|
||||
}
|
||||
|
||||
|
||||
|
||||
int WINAPI WinMain(HINSTANCE hInstance ATTRIBUTE((unused)), HINSTANCE hPrevInstance ATTRIBUTE((unused)), LPSTR lpCmdLine ATTRIBUTE((unused)), int nCmdShow ATTRIBUTE((unused)))
|
||||
{
|
||||
FILE *fp;
|
||||
DWORD i;
|
||||
|
||||
fp = fopen("didf.txt", "w");
|
||||
if (!fp) return -1;
|
||||
setvbuf(fp, NULL, _IONBF, 0);
|
||||
|
||||
|
||||
fprintf(fp,
|
||||
"// Keyboard\n"
|
||||
"\n"
|
||||
"static DIOBJECTDATAFORMAT c_dfDIKeyboard_odf[] = {\n"
|
||||
);
|
||||
|
||||
for (i=0; i<c_dfDIKeyboard.dwNumObjs; i++) {
|
||||
fprintf(fp,
|
||||
"\t{ %s, %lu, 0x%08lu, 0x%08lu },\n",
|
||||
WhatGUID(c_dfDIKeyboard.rgodf[i].pguid),
|
||||
c_dfDIKeyboard.rgodf[i].dwOfs,
|
||||
c_dfDIKeyboard.rgodf[i].dwType,
|
||||
c_dfDIKeyboard.rgodf[i].dwFlags
|
||||
);
|
||||
}
|
||||
fprintf(fp,
|
||||
"};\n"
|
||||
"\n"
|
||||
"const DIDATAFORMAT c_dfDIKeyboard = { %lu, %lu, 0x%08lu, %lu, %lu, c_dfDIKeyboard_odf };\n\n",
|
||||
c_dfDIKeyboard.dwSize,
|
||||
c_dfDIKeyboard.dwObjSize,
|
||||
c_dfDIKeyboard.dwFlags,
|
||||
c_dfDIKeyboard.dwDataSize,
|
||||
c_dfDIKeyboard.dwNumObjs
|
||||
);
|
||||
|
||||
|
||||
|
||||
fprintf(fp,
|
||||
"// Mouse\n"
|
||||
"\n"
|
||||
"static DIOBJECTDATAFORMAT c_dfDIMouse_odf[] = {\n"
|
||||
);
|
||||
|
||||
for (i=0; i<c_dfDIMouse.dwNumObjs; i++) {
|
||||
fprintf(fp,
|
||||
"\t{ %s, %lu, 0x%08lu, 0x%08lu },\n",
|
||||
WhatGUID(c_dfDIMouse.rgodf[i].pguid),
|
||||
c_dfDIMouse.rgodf[i].dwOfs,
|
||||
c_dfDIMouse.rgodf[i].dwType,
|
||||
c_dfDIMouse.rgodf[i].dwFlags
|
||||
);
|
||||
}
|
||||
fprintf(fp,
|
||||
"};\n"
|
||||
"\n"
|
||||
"const DIDATAFORMAT c_dfDIMouse = { %lu, %lu, 0x%08lu, %lu, %lu, c_dfDIMouse_odf };\n\n",
|
||||
c_dfDIMouse.dwSize,
|
||||
c_dfDIMouse.dwObjSize,
|
||||
c_dfDIMouse.dwFlags,
|
||||
c_dfDIMouse.dwDataSize,
|
||||
c_dfDIMouse.dwNumObjs
|
||||
);
|
||||
|
||||
|
||||
|
||||
fprintf(fp,
|
||||
"// Joystick\n"
|
||||
"\n"
|
||||
"static DIOBJECTDATAFORMAT c_dfDIJoystick_odf[] = {\n"
|
||||
);
|
||||
|
||||
for (i=0; i<c_dfDIJoystick.dwNumObjs; i++) {
|
||||
fprintf(fp,
|
||||
"\t{ %s, %lu, 0x%08lu, 0x%08lu },\n",
|
||||
WhatGUID(c_dfDIJoystick.rgodf[i].pguid),
|
||||
c_dfDIJoystick.rgodf[i].dwOfs,
|
||||
c_dfDIJoystick.rgodf[i].dwType,
|
||||
c_dfDIJoystick.rgodf[i].dwFlags
|
||||
);
|
||||
}
|
||||
fprintf(fp,
|
||||
"};\n"
|
||||
"\n"
|
||||
"const DIDATAFORMAT c_dfDIJoystick = { %lu, %lu, 0x%08lu, %lu, %lu, c_dfDIJoystick_odf };\n\n",
|
||||
c_dfDIJoystick.dwSize,
|
||||
c_dfDIJoystick.dwObjSize,
|
||||
c_dfDIJoystick.dwFlags,
|
||||
c_dfDIJoystick.dwDataSize,
|
||||
c_dfDIJoystick.dwNumObjs
|
||||
);
|
||||
|
||||
|
||||
fclose(fp);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,103 +0,0 @@
|
|||
#include "compat.h"
|
||||
|
||||
#define MAXNUMTILES 256
|
||||
|
||||
int artversion, numtiles;
|
||||
int localtilestart, localtileend;
|
||||
short tilesizx[MAXNUMTILES], tilesizy[MAXNUMTILES];
|
||||
int picanm[MAXNUMTILES];
|
||||
|
||||
FILE * openartfile(char *fn)
|
||||
{
|
||||
FILE *fh;
|
||||
|
||||
fh = fopen(fn,"rb");
|
||||
if (!fh) return NULL;
|
||||
|
||||
fread(&artversion,4,1,fh); if (artversion != 1) { puts("Bad art version"); goto fail; }
|
||||
fread(&numtiles,4,1,fh);
|
||||
fread(&localtilestart,4,1,fh);
|
||||
fread(&localtileend,4,1,fh);
|
||||
numtiles = localtileend-localtilestart+1;
|
||||
if (numtiles > MAXNUMTILES) { puts("Too many tiles"); goto fail; }
|
||||
fread(tilesizx,2,numtiles,fh);
|
||||
fread(tilesizy,2,numtiles,fh);
|
||||
fread(picanm,4,numtiles,fh);
|
||||
|
||||
return fh;
|
||||
fail:
|
||||
fclose(fh);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char const * palfile = "palette.dat", * voxfile = "output.vox";
|
||||
int tilenum;
|
||||
int depth;
|
||||
FILE *artfh, *voxfh, *palfh;
|
||||
int tilesz;
|
||||
unsigned char palette[768];
|
||||
unsigned char *tiledata;
|
||||
int i;
|
||||
|
||||
if (argc < 4) {
|
||||
puts("givedepth <artfile.art> <tilenum> <depth> [palette.dat] [output.vox]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
tilenum = atoi(argv[2]);
|
||||
depth = atoi(argv[3]);
|
||||
if (argc >= 4) palfile = argv[4];
|
||||
if (argc >= 5) voxfile = argv[5];
|
||||
|
||||
palfh = fopen(palfile,"rb");
|
||||
if (!palfh) {
|
||||
puts("Failure opening palette file");
|
||||
return 1;
|
||||
}
|
||||
fread(palette,768,1,palfh);
|
||||
fclose(palfh);
|
||||
|
||||
artfh = openartfile(argv[1]);
|
||||
if (!artfh) {
|
||||
puts("Failure opening art file");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (tilenum < 0 || tilenum > numtiles) {
|
||||
puts("Tilenum out of range in art file");
|
||||
fclose(artfh);
|
||||
return 1;
|
||||
}
|
||||
for (i=0; i<tilenum; i++) fseek(artfh, tilesizx[i] * tilesizy[i], SEEK_CUR);
|
||||
|
||||
tilesz = tilesizx[tilenum]*tilesizy[tilenum];
|
||||
tiledata = (unsigned char *)malloc(tilesz);
|
||||
if (!tiledata) {
|
||||
puts("Could not allocate memory for tile");
|
||||
fclose(artfh);
|
||||
return 1;
|
||||
}
|
||||
|
||||
fread(tiledata, tilesz, 1, artfh);
|
||||
fclose(artfh);
|
||||
|
||||
voxfh = fopen(voxfile,"wb");
|
||||
if (!voxfh) {
|
||||
puts("Could not create output file");
|
||||
free(tiledata);
|
||||
return 1;
|
||||
}
|
||||
fwrite(&depth,4,1,voxfh);
|
||||
fwrite(&tilesizx[tilenum],4,1,voxfh);
|
||||
fwrite(&tilesizy[tilenum],4,1,voxfh);
|
||||
for (i=0; i<depth; i++) {
|
||||
fwrite(tiledata,tilesz,1,voxfh);
|
||||
}
|
||||
fwrite(palette,768,1,voxfh);
|
||||
|
||||
free(tiledata);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,83 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
def makehighpalookuppixel(pal, rgb):
|
||||
hsv = list(colorsys.rgb_to_hsv(*rgb))
|
||||
if pal == 0:
|
||||
# no-op, pass through
|
||||
return rgb
|
||||
# frozen, blue light
|
||||
elif pal == 1:
|
||||
# make everything blueish
|
||||
hsv[0] = 0.66
|
||||
return list(colorsys.hsv_to_rgb(*hsv))
|
||||
# nightvision
|
||||
elif pal == 6:
|
||||
# make everything green and reverse brightness
|
||||
hsv[0] = 0.33
|
||||
hsv[2] = 1.0 - hsv[2]
|
||||
#hsv[1] = 0.5
|
||||
return list(colorsys.hsv_to_rgb(*hsv))
|
||||
# pal 20
|
||||
elif pal == 20:
|
||||
# blue to gray by removing all saturation
|
||||
if (hsv[0] > 0.6 and hsv[0] < 0.7):
|
||||
hsv[1] = 0
|
||||
# orange and brown to blue
|
||||
if (hsv[0] > 0.04 and hsv[0] < 0.13):
|
||||
hsv[0] = 0.66
|
||||
# purple and reddish to blue
|
||||
if (hsv[0] > 0.7 and hsv[0] < 0.9):
|
||||
hsv[0] = 0.66
|
||||
# green to blue
|
||||
if (hsv[0] > 0.30 and hsv[0] < 0.36):
|
||||
hsv[0] = 0.66
|
||||
return list(colorsys.hsv_to_rgb(*hsv))
|
||||
else:
|
||||
print "unknown pal!"
|
||||
sys.exit()
|
||||
|
||||
import colorsys
|
||||
import sys
|
||||
import struct
|
||||
|
||||
if (len(sys.argv) != 3):
|
||||
print "Usage: python highpalookupmaker.py palnum outfile"
|
||||
sys.exit()
|
||||
|
||||
# bit depth per dimension
|
||||
xbits = 7
|
||||
ybits = 7
|
||||
zbits = 7
|
||||
|
||||
xdim = 1 << xbits
|
||||
ydim = 1 << ybits
|
||||
zdim = 1 << zbits
|
||||
|
||||
palnum = int(sys.argv[1])
|
||||
|
||||
pixels = []
|
||||
pixelcount = xdim * ydim * zdim
|
||||
curpix = 0.0
|
||||
|
||||
fo = open(sys.argv[2], "w")
|
||||
|
||||
# throw in a TGA header in there, this way they'll be able to directly edit it if they feel like it
|
||||
fo.write(struct.pack("=BBBHHBHHHHBB", 0, 0, 2, 0, 0, 0, 0, 0, 16384, 128, 32, 0))
|
||||
|
||||
print "Creating highpalookup map %s for palette %d with depth %d:%d:%d..." % (sys.argv[2], palnum, xbits, ybits, zbits)
|
||||
|
||||
for k in range(zdim):
|
||||
for j in range(ydim):
|
||||
for i in range(xdim):
|
||||
rgb = [float(i) / (xdim - 1), float(j) / (ydim - 1), float(k) / (zdim - 1)]
|
||||
rgb = makehighpalookuppixel(palnum, rgb)
|
||||
# save as BGRA as that's what TGA uses
|
||||
pixels.append(struct.pack('BBBB', int(rgb[2] * 255), int(rgb[1] * 255), int(rgb[0] * 255), 255))
|
||||
curpix += 1
|
||||
if (curpix % 128 == 0):
|
||||
print "\r%f%% done." % (curpix * 100 / pixelcount),
|
||||
|
||||
fo.writelines(pixels)
|
||||
fo.close()
|
||||
|
||||
print "\n"
|
|
@ -1,122 +0,0 @@
|
|||
|
||||
#include "compat.h"
|
||||
#ifndef USE_OPENGL
|
||||
# define USE_OPENGL
|
||||
#endif
|
||||
#define ANIMVPX_STANDALONE
|
||||
#include "animvpx.h"
|
||||
|
||||
|
||||
static void print_info(const char *prefix, const animvpx_ivf_header_t *hdr)
|
||||
{
|
||||
printf("%s%d x %d, %d frames @ %d frames / %d seconds (%.3f fps%s)\n", prefix,
|
||||
hdr->width, hdr->height, hdr->numframes, hdr->fpsnumer, hdr->fpsdenom,
|
||||
(hdr->fpsdenom==0 ? 0 : (double)hdr->fpsnumer/hdr->fpsdenom),
|
||||
hdr->fpsnumer>=1000 ? " --> 30 fps" : "");
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int fd, dowrite, err;
|
||||
animvpx_ivf_header_t hdr;
|
||||
|
||||
union { uint16_t i; char c[2]; } u;
|
||||
u.c[0] = 1;
|
||||
u.c[1] = 0;
|
||||
if (u.i != 1)
|
||||
{
|
||||
fprintf(stderr, "This program is only for little-endian machines.\n");
|
||||
return 255;
|
||||
}
|
||||
|
||||
if (argc == 2 && argv[1][0]=='-')
|
||||
goto usage;
|
||||
|
||||
if (argc != 2 && argc != 4 && argc != 5)
|
||||
{
|
||||
usage:
|
||||
fprintf(stderr, "Usage: %s <file.ivf> [<fpsnumerator> <fpsdenominator> [-force]]\n"
|
||||
" Without -force, <fpsnumerator> must be < 1000.\n"
|
||||
" If <fpsnumerator> is >= 1000, the actual frame rate\n"
|
||||
" is set to 30 fps on playback.\n",
|
||||
argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
dowrite = (argc >= 4);
|
||||
|
||||
fd = open(argv[1], dowrite ? O_RDWR : O_RDONLY);
|
||||
if (fd < 0)
|
||||
{
|
||||
fprintf(stderr, "Could't open \"%s\" for %s: %s\n", argv[1],
|
||||
dowrite ? "reading/writing":"reading", strerror(errno));
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (read(fd, &hdr, sizeof(hdr)) != sizeof(hdr))
|
||||
{
|
||||
fprintf(stderr, "Couldn't read IVF header: %s\n", strerror(errno));
|
||||
return 3;
|
||||
}
|
||||
|
||||
err = animvpx_check_header(&hdr);
|
||||
if (err)
|
||||
{
|
||||
fprintf(stderr, "Header check failed with code %d (not an IVF file?)\n", err);
|
||||
return 4;
|
||||
}
|
||||
|
||||
if (!dowrite)
|
||||
{
|
||||
print_info("", &hdr);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned long numer = strtoul(argv[2], NULL, 10);
|
||||
unsigned long denom = strtoul(argv[3], NULL, 10);
|
||||
uint32_t numer32=numer, denom32=denom;
|
||||
const int NUMER_OFS = 16; //offsetof(animvpx_ivf_header_t, fpsnumer);
|
||||
|
||||
if (denom == 0)
|
||||
{
|
||||
fprintf(stderr, "FPS denominator must not be zero!\n");
|
||||
return 4;
|
||||
}
|
||||
|
||||
if (numer >= 1000 && (argc!=5 || strcmp(argv[4], "-force")))
|
||||
{
|
||||
fprintf(stderr, "FPS numerator must be < 1000, or -force must be passed as 5th arg.\n");
|
||||
return 5;
|
||||
}
|
||||
|
||||
if (numer32 != numer || denom32 != denom)
|
||||
{
|
||||
fprintf(stderr, "Out of range number passed.\n");
|
||||
return 6;
|
||||
}
|
||||
|
||||
print_info("Old: ", &hdr);
|
||||
hdr.fpsnumer = numer32;
|
||||
hdr.fpsdenom = denom32;
|
||||
print_info("New: ", &hdr);
|
||||
|
||||
if (lseek(fd, NUMER_OFS, SEEK_SET) != NUMER_OFS)
|
||||
{
|
||||
fprintf(stderr, "lseek failed: %s\n", strerror(errno));
|
||||
return 7;
|
||||
}
|
||||
|
||||
err = 0;
|
||||
err |= (write(fd, &numer32, 4) != 4);
|
||||
err |= (write(fd, &denom32, 4) != 4);
|
||||
|
||||
if (err)
|
||||
{
|
||||
fprintf(stderr, "Warning: data not fully written.\n");
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,177 +0,0 @@
|
|||
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
|
||||
// Ken Silverman's official web site: "http://www.advsys.net/ken"
|
||||
// See the included license file "BUILDLIC.TXT" for license info.
|
||||
//
|
||||
// This file has been modified from Ken Silverman's original release
|
||||
// by Jonathon Fowler (jf@jonof.id.au)
|
||||
|
||||
#include "compat.h"
|
||||
#include "kplib.h"
|
||||
|
||||
#include <utime.h>
|
||||
|
||||
#define MAXFILES 4096
|
||||
|
||||
static char buf[65536];
|
||||
|
||||
static int numfiles, anyfiles4extraction;
|
||||
static char marked4extraction[MAXFILES];
|
||||
static char filelist[MAXFILES][16];
|
||||
static int fileoffs[MAXFILES+1], fileleng[MAXFILES];
|
||||
|
||||
void findfiles(const char *dafilespec)
|
||||
{
|
||||
char t[13];
|
||||
int i;
|
||||
|
||||
for(i=numfiles-1;i>=0;i--)
|
||||
{
|
||||
memcpy(t,filelist[i],12);
|
||||
t[12] = 0;
|
||||
|
||||
if (Bwildmatch(t,dafilespec)) {
|
||||
marked4extraction[i] = 1;
|
||||
anyfiles4extraction = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i, j, k, l, fil, fil2;
|
||||
struct Bstat stbuf;
|
||||
|
||||
int onlylist = (argc==2);
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
Bprintf("KEXTRACT <groupfile.grp> [@file or filespec...] by Kenneth Silverman\n");
|
||||
Bprintf(" This program extracts files from a previously grouped group file.\n");
|
||||
Bprintf(" You can extract files using the ? and * wildcards.\n");
|
||||
Bprintf(" Ex: kextract stuff.dat tiles000.art nukeland.map palette.dat\n");
|
||||
Bprintf(" (stuff.dat is the group file, the rest are the files to extract)\n");
|
||||
Bprintf(" kextract stuff.grp\n");
|
||||
Bprintf(" (simply lists the contents of stuff.grp)\n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
if ((fil = Bopen(argv[1],BO_BINARY|BO_RDONLY,BS_IREAD)) == -1)
|
||||
{
|
||||
Bprintf("Error: %s could not be opened\n",argv[1]);
|
||||
return(0);
|
||||
}
|
||||
|
||||
Bread(fil,buf,16);
|
||||
if ((buf[0] != 'K') || (buf[1] != 'e') || (buf[2] != 'n') ||
|
||||
(buf[3] != 'S') || (buf[4] != 'i') || (buf[5] != 'l') ||
|
||||
(buf[6] != 'v') || (buf[7] != 'e') || (buf[8] != 'r') ||
|
||||
(buf[9] != 'm') || (buf[10] != 'a') || (buf[11] != 'n'))
|
||||
{
|
||||
Bclose(fil);
|
||||
Bprintf("Error: %s not a valid group file\n",argv[1]);
|
||||
return(0);
|
||||
}
|
||||
numfiles = *((int*)&buf[12]); numfiles = B_LITTLE32(numfiles);
|
||||
|
||||
Bread(fil,filelist,numfiles<<4);
|
||||
|
||||
j = 0;
|
||||
for(i=0;i<numfiles;i++)
|
||||
{
|
||||
k = *((int*)&filelist[i][12]); k = B_LITTLE32(k);
|
||||
filelist[i][12] = 0;
|
||||
fileoffs[i] = j;
|
||||
j += k;
|
||||
}
|
||||
fileoffs[numfiles] = j;
|
||||
|
||||
if (onlylist)
|
||||
{
|
||||
for (i=0; i<numfiles; i++)
|
||||
Bprintf("%s\t\t%d\n", filelist[i], fileoffs[i+1]-fileoffs[i]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
for(i=0;i<numfiles;i++) marked4extraction[i] = 0;
|
||||
|
||||
anyfiles4extraction = 0;
|
||||
for(i=argc-1;i>1;i--)
|
||||
{
|
||||
if (argv[i][0] == '@')
|
||||
{
|
||||
if ((fil2 = Bopen(&argv[i][1],BO_BINARY|BO_RDONLY,BS_IREAD)) != -1)
|
||||
{
|
||||
l = Bread(fil2,buf,65536);
|
||||
j = 0;
|
||||
while ((j < l) && (buf[j] <= 32)) j++;
|
||||
while (j < l)
|
||||
{
|
||||
k = j;
|
||||
while ((k < l) && (buf[k] > 32)) k++;
|
||||
|
||||
buf[k] = 0;
|
||||
findfiles(&buf[j]);
|
||||
j = k+1;
|
||||
|
||||
while ((j < l) && (buf[j] <= 32)) j++;
|
||||
}
|
||||
Bclose(fil2);
|
||||
}
|
||||
}
|
||||
else
|
||||
findfiles(argv[i]);
|
||||
}
|
||||
|
||||
if (anyfiles4extraction == 0)
|
||||
{
|
||||
Bclose(fil);
|
||||
Bprintf("No files found in group file with those names\n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
if (Bfstat(fil, &stbuf) == -1)
|
||||
stbuf.st_mtime = 0;
|
||||
|
||||
for(i=0;i<numfiles;i++)
|
||||
{
|
||||
if (marked4extraction[i] == 0) continue;
|
||||
|
||||
fileleng[i] = fileoffs[i+1]-fileoffs[i];
|
||||
|
||||
if ((fil2 = Bopen(filelist[i],BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
|
||||
{
|
||||
Bprintf("Error: Could not write to %s\n",filelist[i]);
|
||||
continue;
|
||||
}
|
||||
Bprintf("Extracting %s...\n",filelist[i]);
|
||||
Blseek(fil,fileoffs[i]+((numfiles+1)<<4),SEEK_SET);
|
||||
for(j=0;j<fileleng[i];j+=65536)
|
||||
{
|
||||
k = min(fileleng[i]-j,65536);
|
||||
Bread(fil,buf,k);
|
||||
if (Bwrite(fil2,buf,k) < k)
|
||||
{
|
||||
Bprintf("Write error (drive full?)\n");
|
||||
Bclose(fil2);
|
||||
Bclose(fil);
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
Bclose(fil2);
|
||||
|
||||
if (stbuf.st_mtime != 0)
|
||||
{
|
||||
struct utimbuf times;
|
||||
|
||||
times.modtime = stbuf.st_mtime;
|
||||
times.actime = Btime();
|
||||
|
||||
Butime(filelist[i],×);
|
||||
}
|
||||
}
|
||||
Bclose(fil);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,173 +0,0 @@
|
|||
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
|
||||
// Ken Silverman's official web site: "http://www.advsys.net/ken"
|
||||
// See the included license file "BUILDLIC.TXT" for license info.
|
||||
//
|
||||
// This file has been modified from Ken Silverman's original release
|
||||
// by Jonathon Fowler (jf@jonof.id.au)
|
||||
|
||||
#include "compat.h"
|
||||
#include "kplib.h"
|
||||
|
||||
// Glibc doesn't provide this function, so for the sake of less ugliess
|
||||
// for all platforms, here's a replacement just for this program.
|
||||
static void jstrupr(char *s) { while (*s) { *s = Btoupper(*s); s++; } }
|
||||
|
||||
#define MAXFILES 4096
|
||||
|
||||
static char buf[65536]; // These limits should be abolished one day
|
||||
|
||||
static int numfiles;
|
||||
static char filespec[MAXFILES][128], filelist[MAXFILES][16];
|
||||
static int fileleng[MAXFILES];
|
||||
|
||||
|
||||
static char const * matchstr = "*.*";
|
||||
int checkmatch(const struct Bdirent *a)
|
||||
{
|
||||
if (a->mode & BS_IFDIR) return 0; // is a directory
|
||||
if (a->namlen > 12) return 0; // name too long
|
||||
return Bwildmatch(a->name, matchstr);
|
||||
}
|
||||
|
||||
int filesize(const char *path, const char *name)
|
||||
{
|
||||
char p[BMAX_PATH];
|
||||
struct stat st;
|
||||
|
||||
strcpy(p, path);
|
||||
strcat(p, "/");
|
||||
strcat(p, name);
|
||||
|
||||
if (!stat(p, &st)) return st.st_size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void findfiles(const char *dafilespec)
|
||||
{
|
||||
struct Bdirent *name;
|
||||
int daspeclen;
|
||||
char daspec[128];
|
||||
char const * dir;
|
||||
BDIR *di;
|
||||
|
||||
strcpy(daspec,dafilespec);
|
||||
daspeclen=strlen(daspec);
|
||||
while ((daspec[daspeclen] != '\\') && (daspec[daspeclen] != '/') && (daspeclen > 0)) daspeclen--;
|
||||
if (daspeclen > 0) {
|
||||
daspec[daspeclen]=0;
|
||||
dir = daspec;
|
||||
matchstr = &daspec[daspeclen+1];
|
||||
} else {
|
||||
dir = ".";
|
||||
matchstr = daspec;
|
||||
}
|
||||
|
||||
di = Bopendir(dir);
|
||||
if (!di) return;
|
||||
|
||||
while ((name = Breaddir(di))) {
|
||||
if (!checkmatch(name)) continue;
|
||||
|
||||
strcpy(&filelist[numfiles][0],name->name);
|
||||
jstrupr(&filelist[numfiles][0]);
|
||||
fileleng[numfiles] = name->size;
|
||||
filelist[numfiles][12] = (char)(fileleng[numfiles]&255);
|
||||
filelist[numfiles][13] = (char)((fileleng[numfiles]>>8)&255);
|
||||
filelist[numfiles][14] = (char)((fileleng[numfiles]>>16)&255);
|
||||
filelist[numfiles][15] = (char)((fileleng[numfiles]>>24)&255);
|
||||
|
||||
strcpy(filespec[numfiles],dir);
|
||||
strcat(filespec[numfiles], "/");
|
||||
strcat(filespec[numfiles],name->name);
|
||||
|
||||
numfiles++;
|
||||
if (numfiles > MAXFILES)
|
||||
{
|
||||
Bprintf("FATAL ERROR: TOO MANY FILES SELECTED! (MAX is 4096)\n");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
Bclosedir(di);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i, j, k, l, fil, fil2;
|
||||
|
||||
if (argc < 3)
|
||||
{
|
||||
Bprintf("KGROUP <grouped file><@file or filespec...> by Kenneth Silverman\n");
|
||||
Bprintf(" This program collects many files into 1 big uncompressed file called a\n");
|
||||
Bprintf(" group file\n");
|
||||
Bprintf(" Ex: kgroup stuff.dat *.art *.map *.k?? palette.dat tables.dat\n");
|
||||
Bprintf(" (stuff.dat is the group file, the rest are the files to add)\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
numfiles = 0;
|
||||
for(i=argc-1;i>1;i--)
|
||||
{
|
||||
if (argv[i][0] == '@')
|
||||
{
|
||||
if ((fil = Bopen(&argv[i][1],BO_BINARY|BO_RDONLY,BS_IREAD)) != -1)
|
||||
{
|
||||
l = Bread(fil,buf,65536);
|
||||
j = 0;
|
||||
while ((j < l) && (buf[j] <= 32)) j++;
|
||||
while (j < l)
|
||||
{
|
||||
k = j;
|
||||
while ((k < l) && (buf[k] > 32)) k++;
|
||||
|
||||
buf[k] = 0;
|
||||
findfiles(&buf[j]);
|
||||
j = k+1;
|
||||
|
||||
while ((j < l) && (buf[j] <= 32)) j++;
|
||||
}
|
||||
Bclose(fil);
|
||||
}
|
||||
}
|
||||
else
|
||||
findfiles(argv[i]);
|
||||
}
|
||||
|
||||
if ((fil = Bopen(argv[1],BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
|
||||
{
|
||||
Bprintf("Error: %s could not be opened\n",argv[1]);
|
||||
exit(0);
|
||||
}
|
||||
Bwrite(fil,"KenSilverman",12);
|
||||
Bwrite(fil,&numfiles,4);
|
||||
Bwrite(fil,filelist,numfiles<<4);
|
||||
|
||||
for(i=0;i<numfiles;i++)
|
||||
{
|
||||
Bprintf("Adding %s...\n",filespec[i]);
|
||||
if ((fil2 = Bopen(filespec[i],BO_BINARY|BO_RDONLY,BS_IREAD)) == -1)
|
||||
{
|
||||
Bprintf("Error: %s not found\n",filespec[i]);
|
||||
Bclose(fil);
|
||||
return(0);
|
||||
}
|
||||
for(j=0;j<fileleng[i];j+=65536)
|
||||
{
|
||||
k = min(fileleng[i]-j,65536);
|
||||
Bread(fil2,buf,k);
|
||||
if (Bwrite(fil,buf,k) < k)
|
||||
{
|
||||
Bclose(fil2);
|
||||
Bclose(fil);
|
||||
Bprintf("OUT OF HD SPACE!\n");
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
Bclose(fil2);
|
||||
}
|
||||
Bclose(fil);
|
||||
Bprintf("Saved to %s.\n",argv[1]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
|
||||
#include "compat.h"
|
||||
|
||||
typedef struct { float x, y, z; } point3d;
|
||||
|
||||
typedef struct
|
||||
{ int id, vers, skinxsiz, skinysiz, framebytes; // id:"IPD2", vers:8
|
||||
int numskins, numverts, numuv, numtris, numglcmds, numframes;
|
||||
int ofsskins, ofsuv, ofstris, ofsframes, ofsglcmds, ofseof; // ofsskins: skin names (64 bytes each)
|
||||
} md2typ;
|
||||
|
||||
typedef struct { point3d mul, add; } frametyp;
|
||||
|
||||
int main (const int argc, const char **argv)
|
||||
{
|
||||
BFILE *fil;
|
||||
int i, leng;
|
||||
char *fbuf;
|
||||
float zoffset = 0.0f;
|
||||
md2typ *head;
|
||||
frametyp *fptr;
|
||||
|
||||
if (argc != 4)
|
||||
{
|
||||
Bputs("KMD2TOOL <MD2 in file> <MD2 out file> <z offset> by Ken Silverman");
|
||||
return(1);
|
||||
}
|
||||
if (!Bstrcasecmp(argv[1],argv[2]))
|
||||
{
|
||||
Bputs("Error: input and output filenames cannot be the same");
|
||||
return(2);
|
||||
}
|
||||
|
||||
zoffset = Batof(argv[3]);
|
||||
if (0.0f == zoffset)
|
||||
{
|
||||
Bputs("Error: offset of zero");
|
||||
return(3);
|
||||
}
|
||||
|
||||
fil = Bfopen(argv[1],"rb");
|
||||
if (!fil)
|
||||
{
|
||||
Bputs("Error: could not open input MD2");
|
||||
return(4);
|
||||
}
|
||||
|
||||
Bfseek(fil, 0, SEEK_END);
|
||||
leng = Bftell(fil);
|
||||
Bfseek(fil, 0, SEEK_SET);
|
||||
|
||||
fbuf = (char *)Bmalloc(leng * sizeof(char));
|
||||
if (!fbuf)
|
||||
{
|
||||
Bputs("Error: Could not allocate buffer");
|
||||
return(5);
|
||||
}
|
||||
|
||||
Bfread(fbuf,leng,1,fil);
|
||||
Bfclose(fil);
|
||||
|
||||
head = (md2typ *)fbuf;
|
||||
if ((head->id != 0x32504449) && (head->vers != 8)) // "IDP2"
|
||||
{
|
||||
Bfree(fbuf);
|
||||
Bputs("Error: input is not an MD2 file");
|
||||
return(6);
|
||||
}
|
||||
|
||||
for(i=0; i<head->numframes; ++i)
|
||||
{
|
||||
fptr = (frametyp *)&fbuf[head->ofsframes+head->framebytes*i];
|
||||
Bprintf("frame %2d scale:%f,%f,%f offs:%f,%f,%f\n",i,fptr->mul.x,fptr->mul.y,fptr->mul.z,fptr->add.x,fptr->add.y,fptr->add.z);
|
||||
fptr->add.z += zoffset;
|
||||
}
|
||||
|
||||
fil = Bfopen(argv[2],"wb");
|
||||
if (!fil)
|
||||
{
|
||||
Bputs("Error: could not open output file for writing");
|
||||
return(7);
|
||||
}
|
||||
Bfwrite(fbuf,leng,1,fil);
|
||||
Bfclose(fil);
|
||||
|
||||
Bfree(fbuf);
|
||||
|
||||
return(0);
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
// gcc b.c -Lc:/mingw32/lib -lmingw32 -lSDLmain -lSDL
|
||||
|
||||
#include "compat.h"
|
||||
#include "sdl_inc.h"
|
||||
|
||||
#include "sdlkeytrans.cpp"
|
||||
|
||||
#undef main
|
||||
|
||||
int main(void)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
buildkeytranslationtable();
|
||||
|
||||
for (i = 0; i < sizeof(keytranslation); i++) {
|
||||
if (i>0) printf(", ");
|
||||
if (i%8 == 7) printf("\n");
|
||||
printf("%d", keytranslation[i]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,413 +0,0 @@
|
|||
#include "compat.h"
|
||||
|
||||
#define PI 3.141592653589793
|
||||
|
||||
typedef struct { float x, y; } point2d;
|
||||
typedef struct { float x, y, z; } point3d;
|
||||
typedef struct { float x, y, z; int32_t n; } kgln_t;
|
||||
typedef struct { int32_t w, s; } vertlist_t;
|
||||
typedef struct { float x, y; int32_t n, ns, nw; } wall_t;
|
||||
typedef struct { float z[2]; point2d grad[2]; wall_t *wall; int32_t n; } sect_t;
|
||||
static int32_t numsects;
|
||||
static sect_t *sec;
|
||||
|
||||
//Build1 format variables:
|
||||
typedef struct { int16_t picnum, heinum; int8_t shade; uint8_t pal, xpanning, ypanning; } build7surf_t;
|
||||
typedef struct
|
||||
{
|
||||
int16_t wallptr, wallnum;
|
||||
int32_t z[2]; int16_t stat[2]; build7surf_t surf[2];
|
||||
uint8_t visibility, filler;
|
||||
int16_t lotag, hitag, extra;
|
||||
} build7sect_t;
|
||||
typedef struct
|
||||
{
|
||||
int32_t x, y;
|
||||
int16_t point2, nextwall, nextsect, cstat, picnum, overpicnum;
|
||||
int8_t shade;
|
||||
uint8_t pal, xrepeat, yrepeat, xpanning, ypanning;
|
||||
int16_t lotag, hitag, extra;
|
||||
} build7wall_t;
|
||||
static build7sect_t b7sec;
|
||||
static build7wall_t b7wal;
|
||||
|
||||
static void checknextwalls (void)
|
||||
{
|
||||
float x0, y0, x1, y1;
|
||||
int32_t s0, w0, w0n, s1, w1, w1n;
|
||||
|
||||
//Clear all nextsect/nextwalls
|
||||
for (s0=0;s0<numsects;s0++)
|
||||
for (w0=0;w0<sec[s0].n;w0++) sec[s0].wall[w0].ns = sec[s0].wall[w0].nw = -1;
|
||||
|
||||
for (s1=1;s1<numsects;s1++)
|
||||
for (w1=0;w1<sec[s1].n;w1++)
|
||||
{
|
||||
x0 = sec[s1].wall[w1].x; y0 = sec[s1].wall[w1].y; w1n = sec[s1].wall[w1].n+w1;
|
||||
x1 = sec[s1].wall[w1n].x; y1 = sec[s1].wall[w1n].y;
|
||||
for (s0=0;s0<s1;s0++)
|
||||
for (w0=0;w0<sec[s0].n;w0++)
|
||||
if ((sec[s0].wall[w0].x == x1) && (sec[s0].wall[w0].y == y1))
|
||||
{
|
||||
w0n = sec[s0].wall[w0].n+w0;
|
||||
if ((sec[s0].wall[w0n].x == x0) && (sec[s0].wall[w0n].y == y0))
|
||||
{
|
||||
sec[s1].wall[w1].ns = s0;
|
||||
sec[s1].wall[w1].nw = w0;
|
||||
sec[s0].wall[w0].ns = s1;
|
||||
sec[s0].wall[w0].nw = w1;
|
||||
goto cnw_break2;
|
||||
}
|
||||
}
|
||||
cnw_break2:;
|
||||
}
|
||||
}
|
||||
|
||||
static void shellsrt (float *a, int32_t n)
|
||||
{
|
||||
float t;
|
||||
int32_t i, j, g;
|
||||
|
||||
for (g=(n>>1);g;g>>=1)
|
||||
for (i=0;i<n-g;i++)
|
||||
for (j=i;(j>=0)&&(a[j]>a[j+g]);j-=g)
|
||||
{ t = a[j]; a[j] = a[j+g]; a[j+g] = t; }
|
||||
}
|
||||
|
||||
static float getslopez (sect_t *s, int32_t i, float x, float y)
|
||||
{
|
||||
wall_t *wal = s->wall;
|
||||
return (wal[0].x-x)*s->grad[i].x + (wal[0].y-y)*s->grad[i].y + s->z[i];
|
||||
}
|
||||
|
||||
typedef struct { float x[4], y[2]; wall_t * pwal[2]; } zoid_t;
|
||||
static int32_t sect2trap (wall_t *wal, int32_t n, zoid_t **retzoids, int32_t *retnzoids)
|
||||
{
|
||||
zoid_t *zoids = 0;
|
||||
float f, x0, y0, x1, y1, sy0, sy1, cury, *secy = NULL, *trapx0 = NULL, *trapx1 = NULL;
|
||||
int32_t i, j, g, s, secn, ntrap, tot, zoidalloc;
|
||||
wall_t * k;
|
||||
wall_t ** pwal = NULL;
|
||||
|
||||
(*retzoids) = 0; (*retnzoids) = 0; if (n < 3) return 0;
|
||||
|
||||
secy = (float *)malloc(n*sizeof(secy[0])); if (!secy) goto badret;
|
||||
trapx0 = (float *)malloc(n*sizeof(trapx0[0])); if (!trapx0) goto badret;
|
||||
trapx1 = (float *)malloc(n*sizeof(trapx1[0])); if (!trapx1) goto badret;
|
||||
pwal = (wall_t **)malloc(n*sizeof(pwal[0])); if (!pwal) goto badret;
|
||||
|
||||
for (i=n-1;i>=0;i--) secy[i] = wal[i].y;
|
||||
shellsrt(secy,n);
|
||||
for (i=0,secn=0,cury=-1e32f;i<n;i++) //remove dups
|
||||
if (secy[i] > cury) { secy[secn++] = cury = secy[i]; }
|
||||
|
||||
zoidalloc = secn*2; //just a guess (not guaranteed to fit)
|
||||
zoids = (zoid_t *)malloc(zoidalloc*sizeof(zoid_t)); if (!zoids) goto badret;
|
||||
|
||||
tot = 0;
|
||||
for (s=0;s<secn-1;s++)
|
||||
{
|
||||
sy0 = secy[s]; sy1 = secy[s+1]; ntrap = 0;
|
||||
for (i=0;i<n;i++) //FIX:optimize
|
||||
{
|
||||
x0 = wal[i].x; y0 = wal[i].y; j = wal[i].n+i;
|
||||
x1 = wal[j].x; y1 = wal[j].y;
|
||||
if (y0 > y1)
|
||||
{
|
||||
f = x0; x0 = x1; x1 = f;
|
||||
f = y0; y0 = y1; y1 = f;
|
||||
}
|
||||
if ((y0 >= sy1) || (y1 <= sy0)) continue;
|
||||
if (y0 < sy0) x0 = (sy0-wal[i].y)*(wal[j].x-wal[i].x)/(wal[j].y-wal[i].y) + wal[i].x;
|
||||
if (y1 > sy1) x1 = (sy1-wal[i].y)*(wal[j].x-wal[i].x)/(wal[j].y-wal[i].y) + wal[i].x;
|
||||
trapx0[ntrap] = x0; trapx1[ntrap] = x1; pwal[ntrap] = &wal[i]; ntrap++;
|
||||
}
|
||||
for (g=(ntrap>>1);g;g>>=1)
|
||||
for (i=0;i<ntrap-g;i++)
|
||||
for (j=i;j>=0;j-=g)
|
||||
{
|
||||
if (trapx0[j]+trapx1[j] <= trapx0[j+g]+trapx1[j+g]) break;
|
||||
f = trapx0[j]; trapx0[j] = trapx0[j+g]; trapx0[j+g] = f;
|
||||
f = trapx1[j]; trapx1[j] = trapx1[j+g]; trapx1[j+g] = f;
|
||||
k = pwal[j]; pwal[j] = pwal[j+g]; pwal[j+g] = k;
|
||||
}
|
||||
|
||||
if (tot+ntrap > zoidalloc)
|
||||
{
|
||||
zoidalloc <<= 1; if (tot+ntrap > zoidalloc) zoidalloc = tot+ntrap;
|
||||
zoids = (zoid_t *)realloc(zoids,zoidalloc*sizeof(zoid_t)); if (!zoids) goto badret;
|
||||
}
|
||||
for (i=0;i<ntrap;i=j+1)
|
||||
{
|
||||
j = i+1; if ((trapx0[i+1] <= trapx0[i]) && (trapx1[i+1] <= trapx1[i])) continue;
|
||||
while ((j+2 < ntrap) && (trapx0[j+1] <= trapx0[j]) && (trapx1[j+1] <= trapx1[j])) j += 2;
|
||||
zoids[tot].x[0] = trapx0[i]; zoids[tot].x[1] = trapx0[j]; zoids[tot].y[0] = sy0;
|
||||
zoids[tot].x[3] = trapx1[i]; zoids[tot].x[2] = trapx1[j]; zoids[tot].y[1] = sy1;
|
||||
zoids[tot].pwal[0] = pwal[i]; zoids[tot].pwal[1] = pwal[j];
|
||||
tot++;
|
||||
}
|
||||
}
|
||||
(*retzoids) = zoids; (*retnzoids) = tot; return 1;
|
||||
badret:;
|
||||
free(secy);
|
||||
free(trapx0);
|
||||
free(trapx1);
|
||||
free(pwal);
|
||||
free(zoids);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t getwalls (int32_t s, int32_t w, vertlist_t *ver, int32_t maxverts)
|
||||
{
|
||||
vertlist_t tver;
|
||||
wall_t *wal, *wal2;
|
||||
float fx, fy;
|
||||
int32_t i, j, k, bs, bw, nw, vn;
|
||||
|
||||
wal = sec[s].wall; bs = wal[w].ns;
|
||||
if ((unsigned)bs >= (unsigned)numsects) return 0;
|
||||
|
||||
vn = 0; nw = wal[w].n+w; bw = wal[w].nw;
|
||||
do
|
||||
{
|
||||
wal2 = sec[bs].wall; i = wal2[bw].n+bw; //Make sure it's an opposite wall
|
||||
if ((wal[w].x == wal2[i].x) && (wal[nw].x == wal2[bw].x) &&
|
||||
(wal[w].y == wal2[i].y) && (wal[nw].y == wal2[bw].y))
|
||||
{ if (vn < maxverts) { ver[vn].s = bs; ver[vn].w = bw; vn++; } }
|
||||
bs = wal2[bw].ns;
|
||||
bw = wal2[bw].nw;
|
||||
} while (bs != s);
|
||||
|
||||
//Sort next sects by order of height in middle of wall (crap sort)
|
||||
fx = (wal[w].x+wal[nw].x)*.5f;
|
||||
fy = (wal[w].y+wal[nw].y)*.5f;
|
||||
for (k=1;k<vn;k++)
|
||||
for (j=0;j<k;j++)
|
||||
if (getslopez(&sec[ver[j].s],0,fx,fy) + getslopez(&sec[ver[j].s],1,fx,fy) >
|
||||
getslopez(&sec[ver[k].s],0,fx,fy) + getslopez(&sec[ver[k].s],1,fx,fy))
|
||||
{ tver = ver[j]; ver[j] = ver[k]; ver[k] = tver; }
|
||||
return(vn);
|
||||
}
|
||||
|
||||
static int32_t wallclip (kgln_t *pol, kgln_t *npol)
|
||||
{
|
||||
float f, dz0, dz1;
|
||||
|
||||
dz0 = pol[3].z-pol[0].z; dz1 = pol[2].z-pol[1].z;
|
||||
if (dz0 > 0.0) //do not include null case for rendering
|
||||
{
|
||||
npol[0] = pol[0];
|
||||
if (dz1 > 0.0) //do not include null case for rendering
|
||||
{
|
||||
npol[1] = pol[1];
|
||||
npol[2] = pol[2];
|
||||
npol[3] = pol[3];
|
||||
npol[0].n = npol[1].n = npol[2].n = 1; npol[3].n = -3;
|
||||
return 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
f = dz0/(dz0-dz1);
|
||||
npol[1].x = (pol[1].x-pol[0].x)*f + pol[0].x;
|
||||
npol[1].y = (pol[1].y-pol[0].y)*f + pol[0].y;
|
||||
npol[1].z = (pol[1].z-pol[0].z)*f + pol[0].z;
|
||||
npol[2] = pol[3];
|
||||
npol[0].n = npol[1].n = 1; npol[2].n = -2;
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
if (dz1 <= 0.0) return 0; //do not include null case for rendering
|
||||
f = dz0/(dz0-dz1);
|
||||
npol[0].x = (pol[1].x-pol[0].x)*f + pol[0].x;
|
||||
npol[0].y = (pol[1].y-pol[0].y)*f + pol[0].y;
|
||||
npol[0].z = (pol[1].z-pol[0].z)*f + pol[0].z;
|
||||
npol[1] = pol[1];
|
||||
npol[2] = pol[2];
|
||||
npol[0].n = npol[1].n = 1; npol[2].n = -2;
|
||||
return 3;
|
||||
}
|
||||
|
||||
// //STL binary format:
|
||||
//char filler[80];
|
||||
//uint32_t numtris;
|
||||
//for (i=0;i<numtris;i++)
|
||||
//{
|
||||
// point3d norm, v[3]; //vertices are CCW and must be + coords
|
||||
// int16_t filler;
|
||||
//}
|
||||
static void saveasstl (char const * filnam)
|
||||
{
|
||||
#define MAXVERTS 256 //WARNING:not dynamic
|
||||
vertlist_t verts[MAXVERTS];
|
||||
kgln_t pol[4], npol[4];
|
||||
point3d fp[3], fp2;
|
||||
point2d *grad;
|
||||
wall_t *wal;
|
||||
zoid_t *zoids;
|
||||
FILE *fil;
|
||||
float f, fz;
|
||||
int32_t i, j, k, n, w, s, nw, wn, vn, s0, cf0, s1, cf1, isflor, nzoids;
|
||||
int32_t numtris;
|
||||
char tbuf[80];
|
||||
|
||||
fil = fopen(filnam,"wb"); if (!fil) return;
|
||||
memset(tbuf,0,80);
|
||||
fwrite(tbuf,80,1,fil); //header ignored in STL
|
||||
numtris = 0;
|
||||
fwrite(&numtris,4,1,fil); //dummy write
|
||||
|
||||
for (s=0;s<numsects;s++)
|
||||
{
|
||||
//draw sector filled
|
||||
for (isflor=0;isflor<2;isflor++)
|
||||
{
|
||||
wal = sec[s].wall; fz = sec[s].z[isflor]; grad = &sec[s].grad[isflor]; n = sec[s].n;
|
||||
|
||||
if (!sect2trap(wal,n,&zoids,&nzoids)) continue;
|
||||
|
||||
for (i=0;i<nzoids;i++)
|
||||
{
|
||||
for (j=0,n=0;j<4;j++)
|
||||
{
|
||||
pol[n].x = zoids[i].x[j];
|
||||
pol[n].y = zoids[i].y[j>>1];
|
||||
if ((!n) || (pol[n].x != pol[n-1].x) || (pol[n].y != pol[n-1].y))
|
||||
{
|
||||
pol[n].z = (wal[0].x-pol[n].x)*grad->x + (wal[0].y-pol[n].y)*grad->y + fz;
|
||||
pol[n].n = 1; n++;
|
||||
}
|
||||
}
|
||||
if (n < 3) continue;
|
||||
pol[n-1].n = 1-n;
|
||||
|
||||
fp[0].x = pol[0].x; fp[0].y = pol[0].y; fp[0].z = pol[0].z;
|
||||
for (j=2;j<n;j++)
|
||||
{
|
||||
k = j-isflor; fp[1].x = pol[k].x; fp[1].y = pol[k].y; fp[1].z = pol[k].z;
|
||||
k = j-1+isflor; fp[2].x = pol[k].x; fp[2].y = pol[k].y; fp[2].z = pol[k].z;
|
||||
//fp2 = unit norm
|
||||
fp2.x = (fp[1].y-fp[0].y)*(fp[2].z-fp[0].z) - (fp[1].z-fp[0].z)*(fp[2].y-fp[0].y);
|
||||
fp2.y = (fp[1].z-fp[0].z)*(fp[2].x-fp[0].x) - (fp[1].x-fp[0].x)*(fp[2].z-fp[0].z);
|
||||
fp2.z = (fp[1].x-fp[0].x)*(fp[2].y-fp[0].y) - (fp[1].y-fp[0].y)*(fp[2].x-fp[0].x);
|
||||
f = fp2.x*fp2.x + fp2.y*fp2.y + fp2.z*fp2.z; if (f > 0.f) f = -1.f/sqrtf(f);
|
||||
fp2.x *= f; fp2.y *= f; fp2.z *= f; fwrite(&fp2,4*3,1,fil);
|
||||
fwrite(fp,4*3*3,1,fil); fwrite(tbuf,2,1,fil); //2 bytes of filler
|
||||
numtris++;
|
||||
}
|
||||
}
|
||||
free(zoids);
|
||||
}
|
||||
|
||||
wal = sec[s].wall; wn = sec[s].n;
|
||||
for (w=0;w<wn;w++)
|
||||
{
|
||||
nw = wal[w].n+w; vn = getwalls(s,w,verts,MAXVERTS);
|
||||
pol[0].x = wal[ w].x; pol[0].y = wal[ w].y; pol[0].n = 1;
|
||||
pol[1].x = wal[nw].x; pol[1].y = wal[nw].y; pol[1].n = 1;
|
||||
pol[2].x = wal[nw].x; pol[2].y = wal[nw].y; pol[2].n = 1;
|
||||
pol[3].x = wal[ w].x; pol[3].y = wal[ w].y; pol[3].n =-3;
|
||||
for (k=0;k<=vn;k++) //Warning: do not reverse for loop!
|
||||
{
|
||||
if (k > 0) { s0 = verts[k-1].s; cf0 = 1; } else { s0 = s; cf0 = 0; }
|
||||
if (k < vn) { s1 = verts[k ].s; cf1 = 0; } else { s1 = s; cf1 = 1; }
|
||||
|
||||
pol[0].z = getslopez(&sec[s0],cf0,pol[0].x,pol[0].y);
|
||||
pol[1].z = getslopez(&sec[s0],cf0,pol[1].x,pol[1].y);
|
||||
pol[2].z = getslopez(&sec[s1],cf1,pol[2].x,pol[2].y);
|
||||
pol[3].z = getslopez(&sec[s1],cf1,pol[3].x,pol[3].y);
|
||||
i = wallclip(pol,npol); if (!i) continue;
|
||||
|
||||
fp[0].x = npol[0].x; fp[0].y = npol[0].y; fp[0].z = npol[0].z;
|
||||
for (j=2;j<i;j++)
|
||||
{
|
||||
fp[1].x = npol[j-1].x; fp[1].y = npol[j-1].y; fp[1].z = npol[j-1].z;
|
||||
fp[2].x = npol[j ].x; fp[2].y = npol[j ].y; fp[2].z = npol[j ].z;
|
||||
//fp2 = unit norm
|
||||
fp2.x = (fp[1].y-fp[0].y)*(fp[2].z-fp[0].z) - (fp[1].z-fp[0].z)*(fp[2].y-fp[0].y);
|
||||
fp2.y = (fp[1].z-fp[0].z)*(fp[2].x-fp[0].x) - (fp[1].x-fp[0].x)*(fp[2].z-fp[0].z);
|
||||
fp2.z = (fp[1].x-fp[0].x)*(fp[2].y-fp[0].y) - (fp[1].y-fp[0].y)*(fp[2].x-fp[0].x);
|
||||
f = fp2.x*fp2.x + fp2.y*fp2.y + fp2.z*fp2.z; if (f > 0.f) f = -1.f/sqrtf(f);
|
||||
fp2.x *= f; fp2.y *= f; fp2.z *= f; fwrite(&fp2,4*3,1,fil);
|
||||
fwrite(fp,4*3*3,1,fil); fwrite(tbuf,2,1,fil); //2 bytes of filler
|
||||
numtris++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
i = ftell(fil);
|
||||
fseek(fil,80,SEEK_SET); fwrite(&numtris,4,1,fil);
|
||||
fseek(fil,i,SEEK_SET);
|
||||
fclose(fil);
|
||||
}
|
||||
|
||||
static int32_t loadmap (char *filnam)
|
||||
{
|
||||
float f, fx, fy;
|
||||
int32_t i, j, k;
|
||||
int16_t s;
|
||||
FILE *fil;
|
||||
|
||||
fil = fopen(filnam,"rb"); if (!fil) return 0;
|
||||
fread(&i,4,1,fil); if (i != 0x00000007) return 0; //not Build1 .MAP format 7
|
||||
fseek(fil,20,SEEK_SET);
|
||||
|
||||
fread(&s,2,1,fil); numsects = (int32_t)s;
|
||||
sec = (sect_t *)malloc(numsects*sizeof(sect_t));
|
||||
memset(sec,0,numsects*sizeof(sect_t));
|
||||
for (i=0;i<numsects;i++)
|
||||
{
|
||||
fread(&b7sec,sizeof(b7sec),1,fil);
|
||||
sec[i].n = b7sec.wallnum;
|
||||
sec[i].wall = (wall_t *)realloc(sec[i].wall,sec[i].n*sizeof(wall_t));
|
||||
memset(sec[i].wall,0L,sec[i].n*sizeof(wall_t));
|
||||
for (j=0;j<2;j++)
|
||||
{
|
||||
sec[i].z[j] = ((float)b7sec.z[j])*(1.f/(512.f*16.f));
|
||||
sec[i].grad[j].x = sec[i].grad[j].y = 0;
|
||||
if (b7sec.stat[j]&2) //Enable slopes flag
|
||||
sec[i].grad[j].y = ((float)b7sec.surf[j].heinum)*(1.f/4096.f);
|
||||
}
|
||||
}
|
||||
|
||||
fread(&s,2,1,fil); //numwalls
|
||||
for (i=k=0;i<numsects;i++)
|
||||
{
|
||||
for (j=0;j<sec[i].n;j++,k++)
|
||||
{
|
||||
fread(&b7wal,sizeof(b7wal),1,fil);
|
||||
sec[i].wall[j].x = ((float)b7wal.x)*(1.f/512.f);
|
||||
sec[i].wall[j].y = ((float)b7wal.y)*(1.f/512.f);
|
||||
sec[i].wall[j].n = b7wal.point2-k;
|
||||
}
|
||||
|
||||
fx = sec[i].wall[1].y-sec[i].wall[0].y;
|
||||
fy = sec[i].wall[0].x-sec[i].wall[1].x;
|
||||
f = fx*fx + fy*fy; if (f > 0.f) f = 1.f/sqrtf(f); fx *= f; fy *= f;
|
||||
for (j=0;j<2;j++)
|
||||
{
|
||||
sec[i].grad[j].x = fx*sec[i].grad[j].y;
|
||||
sec[i].grad[j].y = fy*sec[i].grad[j].y;
|
||||
}
|
||||
}
|
||||
|
||||
checknextwalls();
|
||||
fclose(fil);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
if (argc != 3)
|
||||
{
|
||||
printf("map2stl [in:Build .MAP (v7)] [out:STL file] by Ken Silverman (05/15/2009)");
|
||||
return 1;
|
||||
}
|
||||
if (!loadmap(argv[1]))
|
||||
{
|
||||
printf("error loading map\n");
|
||||
return 2;
|
||||
}
|
||||
saveasstl(argv[2]);
|
||||
return 0;
|
||||
}
|
|
@ -1,245 +0,0 @@
|
|||
|
||||
#include "compat.h"
|
||||
#include "build.h"
|
||||
#include "glad/glad.h"
|
||||
#include "mdsprite.h"
|
||||
|
||||
|
||||
static md2head_t head;
|
||||
|
||||
|
||||
static void quit(int32_t status)
|
||||
{
|
||||
exit(status);
|
||||
}
|
||||
|
||||
static md2model_t *md2load(int *fd, const char *filename, int32_t ronly)
|
||||
{
|
||||
md2model_t *m;
|
||||
int fil;
|
||||
|
||||
fil = Bopen(filename, ronly?BO_RDONLY:BO_RDWR);
|
||||
if (fil<0)
|
||||
{
|
||||
Bfprintf(stderr, "Couldn't open `%s': %s\n", filename, strerror(errno));
|
||||
quit(2);
|
||||
}
|
||||
|
||||
m = (md2model_t *)Bcalloc(1,sizeof(md2model_t)); if (!m) quit(1);
|
||||
m->mdnum = 2; m->scale = .01f;
|
||||
|
||||
Bread(fil,(char *)&head,sizeof(md2head_t));
|
||||
|
||||
head.id = B_LITTLE32(head.id); head.vers = B_LITTLE32(head.vers);
|
||||
head.skinxsiz = B_LITTLE32(head.skinxsiz); head.skinysiz = B_LITTLE32(head.skinysiz);
|
||||
head.framebytes = B_LITTLE32(head.framebytes); head.numskins = B_LITTLE32(head.numskins);
|
||||
head.numverts = B_LITTLE32(head.numverts); head.numuv = B_LITTLE32(head.numuv);
|
||||
head.numtris = B_LITTLE32(head.numtris); head.numglcmds = B_LITTLE32(head.numglcmds);
|
||||
head.numframes = B_LITTLE32(head.numframes); head.ofsskins = B_LITTLE32(head.ofsskins);
|
||||
head.ofsuv = B_LITTLE32(head.ofsuv); head.ofstris = B_LITTLE32(head.ofstris);
|
||||
head.ofsframes = B_LITTLE32(head.ofsframes); head.ofsglcmds = B_LITTLE32(head.ofsglcmds);
|
||||
head.ofseof = B_LITTLE32(head.ofseof);
|
||||
|
||||
if ((head.id != 0x32504449) || (head.vers != 8))
|
||||
{
|
||||
Bfprintf(stderr, "File `%s' is not an md2 file.\n", filename);
|
||||
quit(3);
|
||||
} //"IDP2"
|
||||
|
||||
m->numskins = head.numskins;
|
||||
m->numframes = head.numframes;
|
||||
m->numverts = head.numverts;
|
||||
m->numglcmds = head.numglcmds;
|
||||
m->framebytes = head.framebytes;
|
||||
|
||||
m->frames = (char *)Bmalloc(m->numframes*m->framebytes); if (!m->frames) quit(1);
|
||||
m->tris = (md2tri_t *)Bmalloc(head.numtris*sizeof(md2tri_t)); if (!m->tris) quit(1);
|
||||
m->uv = (md2uv_t *)Bmalloc(head.numuv*sizeof(md2uv_t)); if (!m->uv) quit(1);
|
||||
|
||||
Blseek(fil,head.ofsframes,SEEK_SET);
|
||||
if (Bread(fil,(char *)m->frames,m->numframes*m->framebytes) != m->numframes*m->framebytes)
|
||||
quit(1);
|
||||
|
||||
Blseek(fil,head.ofstris,SEEK_SET);
|
||||
if (Bread(fil,(char *)m->tris,head.numtris*sizeof(md2tri_t)) != (int32_t)(head.numtris*sizeof(md2tri_t)))
|
||||
quit(1);
|
||||
|
||||
Blseek(fil,head.ofsuv,SEEK_SET);
|
||||
if (Bread(fil,(char *)m->uv,head.numuv*sizeof(md2uv_t)) != (int32_t)(head.numuv*sizeof(md2uv_t)))
|
||||
quit(1);
|
||||
|
||||
#if B_BIG_ENDIAN != 0
|
||||
{
|
||||
char *f = (char *)m->frames;
|
||||
int32_t *l,i,j;
|
||||
md2frame_t *fr;
|
||||
|
||||
for (i = m->numframes-1; i>=0; i--)
|
||||
{
|
||||
fr = (md2frame_t *)f;
|
||||
l = (int32_t *)&fr->mul;
|
||||
for (j=5; j>=0; j--) l[j] = B_LITTLE32(l[j]);
|
||||
f += m->framebytes;
|
||||
}
|
||||
|
||||
for (i = head.numtris-1; i>=0; i--)
|
||||
{
|
||||
m->tris[i].v[0] = B_LITTLE16(m->tris[i].v[0]);
|
||||
m->tris[i].v[1] = B_LITTLE16(m->tris[i].v[1]);
|
||||
m->tris[i].v[2] = B_LITTLE16(m->tris[i].v[2]);
|
||||
m->tris[i].u[0] = B_LITTLE16(m->tris[i].u[0]);
|
||||
m->tris[i].u[1] = B_LITTLE16(m->tris[i].u[1]);
|
||||
m->tris[i].u[2] = B_LITTLE16(m->tris[i].u[2]);
|
||||
}
|
||||
for (i = head.numuv-1; i>=0; i--)
|
||||
{
|
||||
m->uv[i].u = B_LITTLE16(m->uv[i].u);
|
||||
m->uv[i].v = B_LITTLE16(m->uv[i].v);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
*fd = fil;
|
||||
return(m);
|
||||
}
|
||||
|
||||
|
||||
static void usage_and_quit()
|
||||
{
|
||||
Bfprintf(stderr,
|
||||
"Usage:\n"
|
||||
" md2tool <modelfile>.md2: display info about model\n"
|
||||
" md2tool -minmax <minx>,<miny>,<minz>:<maxx>,<maxy>,<maxz> <modelfile>.md2:\n"
|
||||
" modify `scale' and `translate' fields of MD2 (in-place) to produce given bounds\n"
|
||||
);
|
||||
quit(1);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *fn=NULL, *cp;
|
||||
int32_t fd=-1, i, j;
|
||||
|
||||
int32_t doinfo=1;
|
||||
|
||||
// md2 mul[x,y,z], add[x,y,z]
|
||||
float mx,my,mz, ax,ay,az;
|
||||
|
||||
// desired model bounds
|
||||
float dminx=0,dminy=0,dminz=0, dmaxx=1,dmaxy=1,dmaxz=1;
|
||||
|
||||
// md2 uint8-coordinate bounds
|
||||
uint8_t maxv[3]={0,0,0};
|
||||
uint8_t minv[3]={255,255,255};
|
||||
|
||||
md2frame_t *fr;
|
||||
uint8_t *vp;
|
||||
|
||||
md2model_t *m;
|
||||
|
||||
if (argc<=1)
|
||||
usage_and_quit();
|
||||
|
||||
for (i=1; i<argc; i++)
|
||||
{
|
||||
cp = argv[i];
|
||||
|
||||
if (cp[0]=='-')
|
||||
{
|
||||
if (!strcmp(cp, "-minmax"))
|
||||
{
|
||||
doinfo=0;
|
||||
if (i+1 >= argc)
|
||||
usage_and_quit();
|
||||
if (Bsscanf(argv[i+1], "%f,%f,%f:%f,%f,%f", &dminx,&dminy,&dminz, &dmaxx,&dmaxy,&dmaxz)!=6)
|
||||
usage_and_quit();
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
Bfprintf(stderr, "unrecognized option `%s'\n", cp);
|
||||
quit(2);
|
||||
}
|
||||
}
|
||||
else
|
||||
fn = cp;
|
||||
}
|
||||
|
||||
if (!fn)
|
||||
usage_and_quit();
|
||||
|
||||
m = md2load(&fd, fn, doinfo);
|
||||
|
||||
fr = (md2frame_t *)m->frames;
|
||||
mx=fr->mul.x; my=fr->mul.y; mz=fr->mul.z;
|
||||
ax=fr->add.x; ay=fr->add.y; az=fr->add.z;
|
||||
|
||||
for (i=0, vp=fr->verts->v; i<m->numverts; i++, vp+=sizeof(md2vert_t))
|
||||
{
|
||||
for (j=0; j<3; j++)
|
||||
{
|
||||
maxv[j] = max(maxv[j], vp[j]);
|
||||
minv[j] = min(minv[j], vp[j]);
|
||||
}
|
||||
}
|
||||
|
||||
if (doinfo)
|
||||
{
|
||||
Bprintf("------ %s ------\n", fn);
|
||||
Bprintf("numframes: %d\n", m->numframes);
|
||||
Bprintf("numverts: %d\n", m->numverts);
|
||||
Bprintf("numtris: %d\n", head.numtris);
|
||||
Bprintf("\n");
|
||||
Bprintf("ofsframes: %x\n", head.ofsframes);
|
||||
Bprintf("framebytes: %d\n", head.framebytes);
|
||||
// Bprintf("framebytes: %d, calculated=%d\n", head.framebytes, sizeof(md2frame_t)+(m->numverts-1)*sizeof(md2vert_t));
|
||||
Bprintf("\n");
|
||||
|
||||
Bprintf("mul=%f %f %f\n", mx, my, mz);
|
||||
Bprintf("add=%f %f %f\n", ax, ay, az);
|
||||
|
||||
Bprintf("min xyz (s+t) = %f %f %f\n", minv[0]*mx+ax, minv[1]*my+ay, minv[2]*mz+az);
|
||||
Bprintf("max xyz (s+t) = %f %f %f\n", maxv[0]*mx+ax, maxv[1]*my+ay, maxv[2]*mz+az);
|
||||
|
||||
Bprintf("\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (maxv[0]-minv[0]>0) mx = (dmaxx-dminx)/(maxv[0]-minv[0]); else mx=0;
|
||||
if (maxv[1]-minv[1]>0) my = (dmaxy-dminy)/(maxv[1]-minv[1]); else my=0;
|
||||
if (maxv[2]-minv[2]>0) mz = (dmaxz-dminz)/(maxv[2]-minv[2]); else mz=0;
|
||||
|
||||
if (mx==0||my==0||mz==0)
|
||||
{
|
||||
Bfprintf(stderr, "max[x,y,z]-min[x,y,z] must each be grater 0!\n");
|
||||
quit(2);
|
||||
}
|
||||
|
||||
ax = dmaxx-maxv[0]*mx;
|
||||
ay = dmaxy-maxv[1]*my;
|
||||
az = dmaxz-maxv[2]*mz;
|
||||
|
||||
#define ISNAN(x) ((x)!=(x))
|
||||
#define ISINF(x) ((x!=0)&&(x/2==x))
|
||||
|
||||
if (ISNAN(mx)||ISNAN(my)||ISNAN(mz)||ISNAN(ax)||ISNAN(ay)||ISNAN(az)||
|
||||
ISINF(mx)||ISINF(my)||ISINF(mz)||ISINF(ax)||ISINF(ay)||ISINF(az))
|
||||
{
|
||||
Bfprintf(stderr, "Calculation resulted in NaN or Inf.\n");
|
||||
quit(2);
|
||||
}
|
||||
|
||||
Blseek(fd,head.ofsframes,SEEK_SET);
|
||||
if (Bwrite(fd, &mx, sizeof(mx))!=sizeof(mx)) { perror("write"); quit(3); }
|
||||
if (Bwrite(fd, &my, sizeof(my))!=sizeof(my)) { perror("write"); quit(3); }
|
||||
if (Bwrite(fd, &mz, sizeof(mz))!=sizeof(mz)) { perror("write"); quit(3); }
|
||||
if (Bwrite(fd, &ax, sizeof(ax))!=sizeof(ax)) { perror("write"); quit(3); }
|
||||
if (Bwrite(fd, &ay, sizeof(ay))!=sizeof(ay)) { perror("write"); quit(3); }
|
||||
if (Bwrite(fd, &az, sizeof(az))!=sizeof(az)) { perror("write"); quit(3); }
|
||||
Bclose(fd);
|
||||
|
||||
Bprintf("wrote scale and translate of `%s'.\n", fn);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,251 +0,0 @@
|
|||
#include "compat.h"
|
||||
|
||||
struct hsv {
|
||||
float h, s, v;
|
||||
};
|
||||
|
||||
struct rgb {
|
||||
float r, g, b;
|
||||
};
|
||||
|
||||
struct gradient {
|
||||
int start, len, chompends;
|
||||
struct hsv startcolour, endcolour;
|
||||
};
|
||||
|
||||
float min2(float x, float y);
|
||||
float max2(float x, float y);
|
||||
void convertHSVtoRGB(struct hsv *hsv, struct rgb *rgb);
|
||||
int showusage(void);
|
||||
int readscript(char *fn);
|
||||
|
||||
struct gradient ramps[256];
|
||||
int nramps = 0;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct hsv palette[256], lerpstep, lerped;
|
||||
struct rgb rgbidx;
|
||||
unsigned char rgbout[3];
|
||||
int idx, step, rampnum;
|
||||
FILE* fh;
|
||||
char const * outfile = "palette.dat";
|
||||
|
||||
memset(palette,0,sizeof(palette));
|
||||
|
||||
if (argc < 2) return showusage();
|
||||
if (readscript(argv[1])) return 1;
|
||||
if (argc >= 3) outfile = argv[2];
|
||||
|
||||
for (rampnum = 0; rampnum < nramps; rampnum++) {
|
||||
idx = ramps[rampnum].start;
|
||||
step = ramps[rampnum].len;
|
||||
if (ramps[rampnum].chompends & 1) step++;
|
||||
if (ramps[rampnum].chompends & 2) step++;
|
||||
lerpstep.h = (ramps[rampnum].endcolour.h - ramps[rampnum].startcolour.h) / (float)step;
|
||||
lerpstep.s = (ramps[rampnum].endcolour.s - ramps[rampnum].startcolour.s) / (float)step;
|
||||
lerpstep.v = (ramps[rampnum].endcolour.v - ramps[rampnum].startcolour.v) / (float)step;
|
||||
lerped = ramps[rampnum].startcolour;
|
||||
if (ramps[rampnum].chompends & 1) {
|
||||
step--;
|
||||
lerped.h += lerpstep.h;
|
||||
lerped.s += lerpstep.s;
|
||||
lerped.v += lerpstep.v;
|
||||
}
|
||||
if (ramps[rampnum].chompends & 2) step--;
|
||||
|
||||
for (; step > 0; step--,idx++) {
|
||||
palette[idx].h = lerped.h;
|
||||
palette[idx].s = lerped.s;
|
||||
palette[idx].v = lerped.v;
|
||||
lerped.h += lerpstep.h;
|
||||
lerped.s += lerpstep.s;
|
||||
lerped.v += lerpstep.v;
|
||||
}
|
||||
}
|
||||
|
||||
fh = fopen(outfile,"wb");
|
||||
if (!fh) return 1;
|
||||
|
||||
for (idx=0; idx<256; idx++) {
|
||||
convertHSVtoRGB(&palette[idx], &rgbidx);
|
||||
//printf("Index %d: r=%g g=%g b=%g\n",idx,rgbidx.r,rgbidx.g,rgbidx.b);
|
||||
rgbout[0] = (unsigned char)min2(255,max2(0,(int)(rgbidx.r * 255.0))) >> 2;
|
||||
rgbout[1] = (unsigned char)min2(255,max2(0,(int)(rgbidx.g * 255.0))) >> 2;
|
||||
rgbout[2] = (unsigned char)min2(255,max2(0,(int)(rgbidx.b * 255.0))) >> 2;
|
||||
fwrite(rgbout,3,1,fh);
|
||||
}
|
||||
|
||||
fclose(fh);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
float min2(float x, float y)
|
||||
{
|
||||
return x < y ? x : y;
|
||||
}
|
||||
|
||||
float max2(float x, float y)
|
||||
{
|
||||
return x > y ? x : y;
|
||||
}
|
||||
|
||||
// http://www.cs.rit.edu/~ncs/color/t_convert.html
|
||||
void convertHSVtoRGB(struct hsv *hsv, struct rgb *rgb)
|
||||
{
|
||||
int i;
|
||||
float f, p, q, t;
|
||||
if( hsv->s == 0 ) {
|
||||
// achromatic (grey)
|
||||
rgb->r = rgb->g = rgb->b = hsv->v;
|
||||
return;
|
||||
}
|
||||
hsv->h /= 60; // sector 0 to 5
|
||||
i = floor( hsv->h );
|
||||
f = hsv->h - i; // factorial part of h
|
||||
p = hsv->v * ( 1 - hsv->s );
|
||||
q = hsv->v * ( 1 - hsv->s * f );
|
||||
t = hsv->v * ( 1 - hsv->s * ( 1 - f ) );
|
||||
switch( i ) {
|
||||
case 0:
|
||||
rgb->r = hsv->v;
|
||||
rgb->g = t;
|
||||
rgb->b = p;
|
||||
break;
|
||||
case 1:
|
||||
rgb->r = q;
|
||||
rgb->g = hsv->v;
|
||||
rgb->b = p;
|
||||
break;
|
||||
case 2:
|
||||
rgb->r = p;
|
||||
rgb->g = hsv->v;
|
||||
rgb->b = t;
|
||||
break;
|
||||
case 3:
|
||||
rgb->r = p;
|
||||
rgb->g = q;
|
||||
rgb->b = hsv->v;
|
||||
break;
|
||||
case 4:
|
||||
rgb->r = t;
|
||||
rgb->g = p;
|
||||
rgb->b = hsv->v;
|
||||
break;
|
||||
default: // case 5:
|
||||
rgb->r = hsv->v;
|
||||
rgb->g = p;
|
||||
rgb->b = q;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int showusage(void)
|
||||
{
|
||||
puts("mkpalette <palettescript.txt> [outputfile]");
|
||||
puts("If outputfile is not given, palette.dat is assumed");
|
||||
|
||||
puts("\nPalette script format:\n"
|
||||
" A line beginning with # is a comment, otherwise each line contains none\n"
|
||||
"values separated by spaces defining the gradient:\n"
|
||||
"\n"
|
||||
" startindex rangesize skip starthue startsat startval endhue endsat endval\n"
|
||||
"\n"
|
||||
"Any text after the end of a gradient description is ignored, so may use it\n"
|
||||
"to describe the colour.\n"
|
||||
"\n"
|
||||
"* 'startindex' specifies the first palette index to write to\n"
|
||||
"* 'rangesize' specifies the length of the gradient\n"
|
||||
"* 'skip' specifies whether the first and/or last elements of the range should\n"
|
||||
" be ignored and with 'rangesize' elements interpolated between. This is so\n"
|
||||
" you can have a gradient starting at (potentially) pure black and ending at\n"
|
||||
" (potentially) pure white but without wasting a palette index on those colours\n"
|
||||
" if they already exist, eg. in a grey ramp.\n"
|
||||
" Legal values are 0 (no skipping), 1 (skip start), 2 (skip end),\n"
|
||||
" or 3 (skip start and end).\n"
|
||||
"* 'starthue', 'startsat', 'startval' are integers specifying the beginning\n"
|
||||
" colour in Hue-Saturation-Value format.\n"
|
||||
" 'starthue' should be in the range 0-360 indicating a degrees value\n"
|
||||
" 'startsat' should be in the range 0-100 indicating a saturation percentage\n"
|
||||
" 'startval' should be in the range 0-100 indicating an intensity percentage\n"
|
||||
"* 'endhue', 'endsat', 'endval' specify the ending colour."
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int readscript(char *fn)
|
||||
{
|
||||
int start, len, skip, shue, ssat, sval, ehue, esat, eval;
|
||||
FILE *fp;
|
||||
char line[1024];
|
||||
|
||||
fp = fopen(fn,"rt");
|
||||
if (!fp) {
|
||||
puts("Error opening palette script");
|
||||
return 1;
|
||||
}
|
||||
|
||||
while (fgets(line,sizeof(line),fp)) {
|
||||
{
|
||||
// test for comment
|
||||
char *p = line;
|
||||
while (*p && (*p == ' ' || *p == '\t')) p++;
|
||||
if (*p == '#') continue;
|
||||
}
|
||||
|
||||
if (sscanf(line, "%d %d %d %d %d %d %d %d %d", &start,&len,&skip,&shue,&ssat,&sval,&ehue,&esat,&eval) < 9)
|
||||
continue;
|
||||
|
||||
if (start < 0 || start > 255) {
|
||||
printf("start index of %d is out of range 0-255\n", start);
|
||||
continue;
|
||||
}
|
||||
if (len < 1 || len > 255) {
|
||||
printf("length %d is out of range 1-255\n", len);
|
||||
continue;
|
||||
}
|
||||
if (skip != (skip&3)) {
|
||||
printf("skip value of %d is out of range 0-3\n", skip);
|
||||
continue;
|
||||
}
|
||||
if (shue < 0 || shue > 360) {
|
||||
printf("start hue %d is out of range 0-360\n", shue);
|
||||
continue;
|
||||
}
|
||||
if (ssat < 0 || ssat > 100) {
|
||||
printf("start saturation %d is out of range 0-100\n", ssat);
|
||||
continue;
|
||||
}
|
||||
if (sval < 0 || sval > 100) {
|
||||
printf("start value %d is out of range 0-100\n", sval);
|
||||
continue;
|
||||
}
|
||||
if (ehue < 0 || ehue > 360) {
|
||||
printf("end hue %d is out of range 0-360\n", shue);
|
||||
continue;
|
||||
}
|
||||
if (esat < 0 || esat > 100) {
|
||||
printf("end saturation %d is out of range 0-100\n", ssat);
|
||||
continue;
|
||||
}
|
||||
if (eval < 0 || eval > 100) {
|
||||
printf("end value %d is out of range 0-100\n", sval);
|
||||
continue;
|
||||
}
|
||||
|
||||
ramps[nramps].start = start;
|
||||
ramps[nramps].len = len;
|
||||
ramps[nramps].chompends = skip;
|
||||
ramps[nramps].startcolour.h = (float)shue;
|
||||
ramps[nramps].startcolour.s = (float)ssat / 100.0;
|
||||
ramps[nramps].startcolour.v = (float)sval / 100.0;
|
||||
ramps[nramps].endcolour.h = (float)ehue;
|
||||
ramps[nramps].endcolour.s = (float)esat / 100.0;
|
||||
ramps[nramps].endcolour.v = (float)eval / 100.0;
|
||||
nramps++;
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
|
@ -1,300 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import sys;
|
||||
|
||||
from numpy import array, zeros, ones, arange, uint32
|
||||
from numpy import vstack, hstack, hsplit, dstack, dsplit
|
||||
|
||||
from PIL.Image import frombuffer
|
||||
|
||||
|
||||
NBITS = 7;
|
||||
RESIDBITS = 8-NBITS;
|
||||
DIM = 1<<NBITS;
|
||||
|
||||
CONVFACT = 256;
|
||||
|
||||
### target hues
|
||||
green = .39; # 11, 22
|
||||
yellow = .17; # 23
|
||||
red = .04; # 21
|
||||
|
||||
|
||||
def genbasepal():
|
||||
"Generate base palette for highpalookup system. \
|
||||
All other palettes must be based on this one."
|
||||
imint = zeros([DIM, DIM, DIM], 'uint32');
|
||||
for i in range(DIM):
|
||||
for j in range(DIM):
|
||||
for k in range(DIM):
|
||||
imint[i,j,k] = ((i<<16)|(k<<8)|j)<<RESIDBITS;
|
||||
|
||||
imint = hstack(dsplit(imint, DIM));
|
||||
|
||||
imbyte = zeros([DIM, DIM*DIM, 3], 'uint8');
|
||||
|
||||
for i in range(3):
|
||||
imbyte[:,:,i] = (imint[:,:,0]>>(i*8))&255;
|
||||
|
||||
return imbyte;
|
||||
|
||||
|
||||
def getdispimg(im):
|
||||
"Get a reshaped version of the palette image IM suitable for viewing."
|
||||
# 2^NBITS x 2^NBITS*2^NBITS --> 2^(NBITS + NBITS/2) x 2^NBITS*2^(NBITS - NBITS/2)
|
||||
|
||||
if (im.shape != (DIM, DIM*DIM, 3)):
|
||||
raise ValueError("image must have shape (DIM, DIM*DIM, 3)");
|
||||
|
||||
dimfactor = 1<<(NBITS/2);
|
||||
return vstack(hsplit(im, dimfactor));
|
||||
|
||||
|
||||
def getPILimg(im):
|
||||
sz = im.shape;
|
||||
return frombuffer("RGB", [sz[1], sz[0]], im, "raw", "RGB", 0, 1);
|
||||
|
||||
|
||||
def saveimage(im, filename):
|
||||
getPILimg(im).save(filename);
|
||||
|
||||
def showpalimg(im):
|
||||
getPILimg(getdispimg(im)).show();
|
||||
|
||||
|
||||
### utility functions
|
||||
|
||||
## port of Octave's rbg2hsv
|
||||
def rgb2hsv(im):
|
||||
if (im.dtype=='uint8'):
|
||||
im = imitof(im);
|
||||
|
||||
r, g, b = im[..., 0], im[..., 1], im[..., 2];
|
||||
s, v = im.min(2), im.max(2);
|
||||
dif = v-s;
|
||||
|
||||
colored = (s != v);
|
||||
|
||||
h = zeros(r.shape, im.dtype);
|
||||
|
||||
# blue hue
|
||||
idx = ((v==b) & colored);
|
||||
h[idx] = 2./3 + 1./6*(r[idx]-g[idx])/dif[idx];
|
||||
|
||||
# green hue
|
||||
idx = ((v==g) & colored);
|
||||
h[idx] = 1./3 + 1./6*(b[idx]-r[idx])/dif[idx];
|
||||
|
||||
# red hue
|
||||
idx = ((v==r) & colored);
|
||||
h[idx] = 1./6*(g[idx]-b[idx])/dif[idx];
|
||||
h[idx] %= 1;
|
||||
|
||||
s[~colored] = 0;
|
||||
s[colored] = 1.0 - s[colored]/v[colored];
|
||||
|
||||
return dstack((h,s,v));
|
||||
|
||||
|
||||
## port of Octave's hsv2rbg
|
||||
def hsv2rgb(imh):
|
||||
imh[imh<0] = 0;
|
||||
imh[imh>1] = 1;
|
||||
|
||||
h, s, v = imh[..., 0], imh[..., 1], imh[..., 2];
|
||||
|
||||
rgb = v*(1.0-s);
|
||||
rgb = dstack((rgb, rgb, rgb));
|
||||
|
||||
hue = dstack((h-2./3, h, h-1./3))%1;
|
||||
f = s*v;
|
||||
f = dstack((f, f, f));
|
||||
|
||||
rgb += f * (6.0 * (hue < 1./6)*hue
|
||||
+ ((hue >= 1./6) & (hue < 1./2))
|
||||
+ ((hue >= 1./2) & (hue < 2./3))*(4.0 - 6.0*hue));
|
||||
|
||||
return imftoi(rgb);
|
||||
|
||||
|
||||
def imftoi(im):
|
||||
im = im.copy();
|
||||
if (im.dtype=='uint8'):
|
||||
return im
|
||||
im *= CONVFACT;
|
||||
im[im>255] = 255;
|
||||
return im.astype('uint8');
|
||||
|
||||
def imitof(im):
|
||||
if (im.dtype=='float32'):
|
||||
return im.copy();
|
||||
return im.astype('float32')/CONVFACT;
|
||||
|
||||
|
||||
###
|
||||
def genpal(basepal, basepalhsv, pal):
|
||||
"Generate a highpalookup image for palette number PAL. \
|
||||
BASEPALHSV should the precomputed HSV representation of BASEPAL."
|
||||
|
||||
if (basepal.dtype != 'uint8'):
|
||||
raise TypeError('BASEPAL should be uint8.');
|
||||
|
||||
if (pal==0):
|
||||
return basepal;
|
||||
|
||||
bph = basepalhsv;
|
||||
h,s,v = bph[..., 0], bph[..., 1], bph[..., 2];
|
||||
|
||||
bluemask = (h>0.52) & (h<0.8) & (s>0.2);
|
||||
|
||||
# all true mask will be used unless overridden
|
||||
mask = ones(h.shape, 'bool');
|
||||
|
||||
|
||||
## PHRP r176 defs:
|
||||
#
|
||||
# tint { pal 1 red 100 green 120 blue 148 flags 1 }
|
||||
# tint { pal 2 red 255 green 48 blue 0 flags 0 }
|
||||
# tint { pal 4 red 0 green 0 blue 0 flags 0 }
|
||||
# tint { pal 6 red 224 green 255 blue 112 flags 3 }
|
||||
# tint { pal 7 red 172 green 157 blue 140 flags 0 }
|
||||
# tint { pal 8 red 199 green 226 blue 113 flags 1 }
|
||||
#
|
||||
# bit 1: greyscale (max)
|
||||
# bit 2: invert (255-x)
|
||||
# colorization: min(int(C*C')/64, 255)
|
||||
|
||||
if (pal in [1,2,4,6,7,8]):
|
||||
rgbf = { 1: [100, 120, 148, 1],
|
||||
2: [255, 48, 0, 0],
|
||||
4: [0, 0, 0, 0],
|
||||
6: [224, 255, 112, 3],
|
||||
7: [172, 157, 140, 0],
|
||||
8: [199, 226, 113, 1]}
|
||||
|
||||
newrgb = basepal.astype('uint32');
|
||||
|
||||
flags = rgbf[pal][3]
|
||||
|
||||
if (flags&1): # greyscale
|
||||
newrgb = newrgb.max(2);
|
||||
newrgb = dstack((newrgb, newrgb, newrgb)).copy();
|
||||
|
||||
if (flags&2): # invert
|
||||
newrgb = 255-newrgb;
|
||||
|
||||
# colorize
|
||||
for i in range(3):
|
||||
newrgb[:,:,i] *= rgbf[pal][i]
|
||||
newrgb[:,:,i] /= 255
|
||||
newrgb[newrgb>255] = 255
|
||||
|
||||
return newrgb.astype('uint8');
|
||||
|
||||
# plagman:
|
||||
# if (pal==1):
|
||||
# h[:] = 0.66;
|
||||
|
||||
# elif (pal==6):
|
||||
# h[:] = 0.33;
|
||||
# v = 1.0 - v;
|
||||
|
||||
elif (pal==20):
|
||||
m1 = ((h>0.6) & (h<0.7));
|
||||
m2 = ((h>0.04) & (h<0.13));
|
||||
m3 = ((h>0.7) & (h<0.9));
|
||||
m4 = ((h>0.3) & (h<0.36));
|
||||
mask = m1 | m2 | m3 | m4;
|
||||
|
||||
# blue to gray by removing all saturation
|
||||
s[m1] = 0.0;
|
||||
# orange and brown to blue
|
||||
h[m2] = 0.66;
|
||||
# purple and reddish to blue
|
||||
h[m3] = 0.66
|
||||
# green to blue
|
||||
h[m4] = 0.66;
|
||||
|
||||
# helixhorned:
|
||||
elif (pal==11):
|
||||
mask = bluemask;
|
||||
h[mask] = green;
|
||||
s[mask] += 0.1;
|
||||
|
||||
elif (pal==12):
|
||||
mask = bluemask;
|
||||
h[mask] = 0.0;
|
||||
s[mask] = 0.0;
|
||||
|
||||
elif (pal==13):
|
||||
mask = bluemask;
|
||||
h[mask] = 0.0;
|
||||
s[mask] = 0.0;
|
||||
v[mask] *= 0.7;
|
||||
|
||||
elif (pal==16):
|
||||
mask = bluemask;
|
||||
s[mask] += 0.1;
|
||||
v[mask] -= 0.1;
|
||||
|
||||
elif (pal==21):
|
||||
mask = bluemask;
|
||||
h[mask] = red;
|
||||
s[mask] += 0.3;
|
||||
|
||||
elif (pal==23):
|
||||
mask = bluemask;
|
||||
h[mask] = yellow;
|
||||
s[mask] += 0.12;
|
||||
v[mask] *= 1.15;
|
||||
|
||||
elif (pal==99):
|
||||
mask = bluemask;
|
||||
v[mask] = 0;
|
||||
|
||||
# user:
|
||||
# ...
|
||||
|
||||
else:
|
||||
raise ValueError("unknown pal {0}!".format(pal));
|
||||
|
||||
# ---
|
||||
newrgb = hsv2rgb(dstack((h, s, v)));
|
||||
|
||||
nmask = ~mask;
|
||||
|
||||
r = mask*newrgb[:,:,0] + nmask*basepal[:,:,0];
|
||||
g = mask*newrgb[:,:,1] + nmask*basepal[:,:,1];
|
||||
b = mask*newrgb[:,:,2] + nmask*basepal[:,:,2];
|
||||
|
||||
# PIL doesn't seem to like views/shallow copies
|
||||
return dstack((r, g, b)).copy();
|
||||
|
||||
|
||||
## main
|
||||
if (__name__ == "__main__"):
|
||||
|
||||
argc = len(sys.argv);
|
||||
if (argc == 1):
|
||||
print "Usage: python prhighpal.py (palnums ...)"
|
||||
sys.exit();
|
||||
|
||||
print "Generating base palette..."
|
||||
bp = genbasepal();
|
||||
bph = rgb2hsv(bp);
|
||||
|
||||
for i in xrange(1, argc):
|
||||
palnum = int(sys.argv[i]);
|
||||
filename = "hipal{0}_gen.png".format(palnum);
|
||||
print "Generating palnum", palnum, "image ...";
|
||||
palimg = genpal(bp.copy(), bph.copy(), palnum);
|
||||
print "Writing", filename, "...";
|
||||
saveimage(palimg, filename);
|
||||
|
||||
print "\nDEF code:\n"
|
||||
for i in xrange(1, argc):
|
||||
palnum = int(sys.argv[i]);
|
||||
if (palnum==0):
|
||||
continue;
|
||||
filename = "hipal{0}_gen.png".format(palnum);
|
||||
print "highpalookup { pal", palnum, "file", filename, "}";
|
|
@ -1,154 +0,0 @@
|
|||
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
|
||||
// Ken Silverman's official web site: "http://www.advsys.net/ken"
|
||||
// See the included license file "BUILDLIC.TXT" for license info.
|
||||
//
|
||||
// This file has been modified from Ken Silverman's original release
|
||||
// by Jonathon Fowler (jf@jonof.id.au)
|
||||
|
||||
#include "compat.h"
|
||||
#include "pragmas.h"
|
||||
#include "colmatch.h"
|
||||
|
||||
#define MAXPALOOKUPS 256
|
||||
|
||||
static int numshades, transratio;
|
||||
static char const * const palettefilename = "palette.dat";
|
||||
static uint8_t origpalookup[MAXPALOOKUPS<<8], palookup[MAXPALOOKUPS<<8], transluc[65536];
|
||||
static uint8_t origpalette[768], palette[768];
|
||||
|
||||
static char getshade(char dashade, char dacol)
|
||||
{
|
||||
int r, g, b, t;
|
||||
char *ptr;
|
||||
|
||||
ptr = (char *)&palette[dacol*3];
|
||||
t = divscale16(numshades-dashade,numshades);
|
||||
r = ((ptr[0]*t+32768)>>16);
|
||||
g = ((ptr[1]*t+32768)>>16);
|
||||
b = ((ptr[2]*t+32768)>>16);
|
||||
return(paletteGetClosestColor(r,g,b));
|
||||
}
|
||||
|
||||
static char gettrans(char dat1, char dat2, int datransratio)
|
||||
{
|
||||
int r, g, b;
|
||||
char *ptr, *ptr2;
|
||||
|
||||
ptr = (char *)&palette[dat1*3];
|
||||
ptr2 = (char *)&palette[dat2*3];
|
||||
r = ptr[0]; r += (((ptr2[0]-r)*datransratio+128)>>8);
|
||||
g = ptr[1]; g += (((ptr2[1]-g)*datransratio+128)>>8);
|
||||
b = ptr[2]; b += (((ptr2[2]-b)*datransratio+128)>>8);
|
||||
return(paletteGetClosestColor(r,g,b));
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char col, ch;
|
||||
short orignumshades;
|
||||
int fil, i, j, rscale, gscale, bscale;
|
||||
|
||||
ch = 13;
|
||||
if (argc>1) {
|
||||
if (argv[1][0] == '-') {
|
||||
if (argv[1][1] == 't') { ch = 32; puts("Updating translucency table ONLY"); }
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
}
|
||||
|
||||
if ((argc != 3) && (argc != 6))
|
||||
{
|
||||
Bprintf("TRANSPAL [-t]<numshades><trans#(0-inv,256-opa)><r><g><b> by Kenneth Silverman\n");
|
||||
Bprintf(" Ex #1: transpal 32 170 30 59 11 (I use these values in my BUILD demo)\n");
|
||||
Bprintf(" \xc0\xc4\xc4\xc1\xc4\xc4\xc1\xc4\xc4\xc4 The RGB scales are optional\n");
|
||||
Bprintf(" Ex #2: transpal 64 160\n\n");
|
||||
Bprintf("Once tables are generated, the optional -t switch determines what to save:\n");
|
||||
Bprintf(" Exclude -t to update both the shade table and transluscent table\n");
|
||||
Bprintf(" Include -t to update the transluscent table ONLY\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
numshades = Batol(argv[1]);
|
||||
transratio = Batol(argv[2]);
|
||||
|
||||
if (argc == 6)
|
||||
{
|
||||
rscale = Batol(argv[3]);
|
||||
gscale = Batol(argv[4]);
|
||||
bscale = Batol(argv[5]);
|
||||
}
|
||||
else
|
||||
{
|
||||
rscale = 30;
|
||||
gscale = 59;
|
||||
bscale = 11;
|
||||
}
|
||||
|
||||
if ((numshades < 1) || (numshades > 256))
|
||||
{ Bprintf("Invalid number of shades\n"); exit(0); }
|
||||
if ((transratio < 0) || (transratio > 256))
|
||||
{ Bprintf("Invalid transluscent ratio\n"); exit(0); }
|
||||
|
||||
if ((fil = Bopen(palettefilename,BO_BINARY|BO_RDONLY,BS_IREAD)) == -1)
|
||||
{
|
||||
Bprintf("%s not found",palettefilename);
|
||||
return(0);
|
||||
}
|
||||
Bread(fil,origpalette,768);
|
||||
Bread(fil,&orignumshades,2); orignumshades = B_LITTLE16(orignumshades);
|
||||
orignumshades = min(max<int>(orignumshades,1),256);
|
||||
Bread(fil,origpalookup,(int)orignumshades<<8);
|
||||
Bclose(fil);
|
||||
|
||||
for (int k = 0; k < 768; k++)
|
||||
palette[k] = origpalette[k] << 2;
|
||||
|
||||
initdivtables();
|
||||
initfastcolorlookup_scale(rscale,gscale,bscale);
|
||||
initfastcolorlookup_palette(palette);
|
||||
initfastcolorlookup_gridvectors();
|
||||
|
||||
for(i=0;i<numshades;i++)
|
||||
for(j=0;j<256;j++)
|
||||
{
|
||||
col = getshade((char)i,(char)j);
|
||||
palookup[(i<<8)+j] = col;
|
||||
}
|
||||
|
||||
for(i=0;i<256;i++)
|
||||
for(j=0;j<256;j++)
|
||||
{
|
||||
col = gettrans((char)i,(char)j,transratio);
|
||||
transluc[(i<<8)+j] = col;
|
||||
}
|
||||
|
||||
if (ch == 13)
|
||||
{
|
||||
short s;
|
||||
if ((fil = Bopen(palettefilename,BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
|
||||
{ Bprintf("Couldn't save file %s",palettefilename); return(0); }
|
||||
Bwrite(fil,origpalette,768);
|
||||
s = B_LITTLE16(numshades); Bwrite(fil,&s,2);
|
||||
Bwrite(fil,palookup,numshades<<8);
|
||||
Bwrite(fil,transluc,65536);
|
||||
Bclose(fil);
|
||||
Bprintf("Shade table AND transluscent table updated\n");
|
||||
}
|
||||
else if (ch == 32)
|
||||
{
|
||||
short s;
|
||||
if ((fil = Bopen(palettefilename,BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
|
||||
{ Bprintf("Couldn't save file %s",palettefilename); return(0); }
|
||||
Bwrite(fil,origpalette,768);
|
||||
s = B_LITTLE16(orignumshades); Bwrite(fil,&s,2);
|
||||
Bwrite(fil,origpalookup,(int)orignumshades<<8);
|
||||
Bwrite(fil,transluc,65536);
|
||||
Bclose(fil);
|
||||
Bprintf("Transluscent table updated\n");
|
||||
}
|
||||
else
|
||||
Bprintf("Palette file wasn't touched\n");
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,192 +0,0 @@
|
|||
/*
|
||||
.SSI File Unpacker
|
||||
Copyright (c) 2003 Jonathon Fowler
|
||||
|
||||
This is a small program to extract the files from the .SSI package format
|
||||
which Sunstorm Interactive expansion packs for games like Duke Nukem 3D
|
||||
are distributed in. It is unsupported but should errors arise, bug reports
|
||||
are welcome.
|
||||
|
||||
Update: 12 June 2003
|
||||
|
||||
This updated version includes the ability to extract the SSI revision 2
|
||||
format as used in Duke Carribean.
|
||||
|
||||
|
||||
This program is distributed under the terms of the GNU General Public
|
||||
License Version 2 which can be found in the included GNU.txt file.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
|
||||
Jonathon Fowler
|
||||
jf@jonof.id.au
|
||||
http://www.jonof.id.au/
|
||||
*/
|
||||
/*
|
||||
NOTE: This program does not fall under BUILDLIC.
|
||||
*/
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
FILE *fp, *ofp;
|
||||
int32_t i,j=0;
|
||||
int32_t version;
|
||||
int32_t numfiles;
|
||||
unsigned char numchars;
|
||||
char title[33];
|
||||
char description[3][71];
|
||||
struct file {
|
||||
char name[13];
|
||||
int32_t length;
|
||||
} *filenames;
|
||||
char runfile[13] = "<unknown>";
|
||||
char buf[1024];
|
||||
int32_t mode=0, param;
|
||||
|
||||
puts("unpackssi - .SSI File Unpacker\n"
|
||||
"Copyright (c) 2003 Jonathon Fowler\n"
|
||||
"This software is distributed under the terms of the GNU General Public License.");
|
||||
|
||||
if (argc<2) {
|
||||
puts("\nUsage: unpackssi [-l] <ssifile.ssi> [ssifile2.ssi ...]");
|
||||
puts(" Unpacks the contents of an SSI file (like those which Sunstorm Interactive");
|
||||
puts(" expansion packs for Duke Nukem 3D are distributed in) to the current");
|
||||
puts(" directory. NOTE: Any files which already exist and have the same name as the");
|
||||
puts(" files contained in the SSI file will be overwritten when extracting.");
|
||||
puts("\nSwitches:");
|
||||
puts(" -l List files (no extraction)\n");
|
||||
return -1;
|
||||
} else {
|
||||
param = 1;
|
||||
if (argv[1][0] == '-') {
|
||||
param++;
|
||||
switch (argv[1][1]) {
|
||||
case 'l': mode = 1; break;
|
||||
default: printf("Unrecognised switch: %c.\n", argv[1][1]); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (param < argc) {
|
||||
puts("");
|
||||
|
||||
fp = fopen(argv[param],"rb");
|
||||
if (!fp) return -2;
|
||||
|
||||
fread(&version, 4, 1, fp);
|
||||
if (version != 1 && version != 2) {
|
||||
fclose(fp);
|
||||
puts("Error: Unrecognized SSI version.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("File is SSI Version %i\n", version);
|
||||
|
||||
fread(&numfiles, 4, 1, fp);
|
||||
|
||||
fread(&numchars, 1, 1, fp);
|
||||
if (numchars > 32) numchars = 32;
|
||||
fread(title, 32, 1, fp);
|
||||
title[numchars] = 0;
|
||||
|
||||
if (version == 2) {
|
||||
fread(&numchars, 1, 1, fp);
|
||||
if (numchars > 12) numchars = 12;
|
||||
fread(runfile, 12, 1, fp);
|
||||
runfile[numchars] = 0;
|
||||
}
|
||||
|
||||
for (i=0;i<3;i++) {
|
||||
fread(&numchars, 1, 1, fp);
|
||||
if (numchars > 70) numchars = 70;
|
||||
fread(description[i], 70, 1, fp);
|
||||
description[i][numchars] = 0;
|
||||
}
|
||||
|
||||
filenames = (struct file *)malloc(sizeof(struct file) * numfiles);
|
||||
if (!filenames) {
|
||||
fclose(fp);
|
||||
puts("Error: Failed allocating memory for file index.");
|
||||
return -2;
|
||||
}
|
||||
|
||||
for (i=0;i<numfiles;i++) {
|
||||
fread(&numchars, 1, 1, fp);
|
||||
if (numchars > 12) numchars = 12;
|
||||
fread(filenames[i].name, 12, 1, fp);
|
||||
filenames[i].name[numchars] = 0;
|
||||
|
||||
fread(&filenames[i].length, 4, 1, fp);
|
||||
|
||||
// seek past some stuff I can't seem to fully decipher at the moment
|
||||
fseek(fp, 34+1+69, SEEK_CUR);
|
||||
}
|
||||
|
||||
printf("File: %s\n"
|
||||
"Package Title: %s\n"
|
||||
"Description: %s\n"
|
||||
" %s\n"
|
||||
" %s\n"
|
||||
"Run Filename: %s\n\n"
|
||||
, argv[param], title, description[0], description[1], description[2], runfile);
|
||||
|
||||
if (mode == 1) {
|
||||
j=0;
|
||||
puts("File listing:");
|
||||
}
|
||||
|
||||
for (i=0;i<numfiles;i++) {
|
||||
if (mode == 0) {
|
||||
ofp = fopen(filenames[i].name, "wb");
|
||||
if (!ofp) {
|
||||
printf("Error: Failed creating %s. Unpack operation cancelled.\n", filenames[i].name);
|
||||
break;
|
||||
}
|
||||
|
||||
printf("Unpacking %s (%i bytes)...", filenames[i].name, filenames[i].length);
|
||||
|
||||
for (j=filenames[i].length; j>1024; j-=1024) {
|
||||
fread(buf, 1024, 1, fp);
|
||||
fwrite(buf, 1024, 1, ofp);
|
||||
}
|
||||
if (j) {
|
||||
fread(buf, j, 1, fp);
|
||||
fwrite(buf, j, 1, ofp);
|
||||
}
|
||||
|
||||
fclose(ofp);
|
||||
puts("done");
|
||||
} else if (mode == 1) {
|
||||
printf(" %-12s %i bytes\n", filenames[i].name, filenames[i].length);
|
||||
j += filenames[i].length;
|
||||
}
|
||||
}
|
||||
|
||||
if (mode == 1) {
|
||||
puts("");
|
||||
printf(" %i files, %i bytes\n", numfiles, j);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
free(filenames);
|
||||
|
||||
param++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,140 +0,0 @@
|
|||
// VGA Font Grabber
|
||||
// Copyright (c) 1997 Jonathon Fowler
|
||||
// This is a DOS program originally written with Borland Turbo C++ for DOS 3.1
|
||||
|
||||
|
||||
#include <dos.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int font, width, height, numchars;
|
||||
struct REGPACK r;
|
||||
FILE *fp;
|
||||
|
||||
printf("VGA Font Grabber\n"
|
||||
"Copyright (c) 1997 Jonathon Fowler\n");
|
||||
|
||||
do {
|
||||
printf("\nSelect which font to grab:\n"
|
||||
" 1. 8-by-8 ROM\n"
|
||||
" 2. 8-by-14 ROM\n"
|
||||
" 3. 8-by-16 ROM\n"
|
||||
" 4. 9-by-16 ROM\n"
|
||||
" 5. 9-by-14 ROM\n"
|
||||
" 6. Quit\n"
|
||||
" > ");
|
||||
scanf("%d",&font);
|
||||
|
||||
switch (font) {
|
||||
case 1:
|
||||
printf("Getting 8-by-8 ROM font...");
|
||||
|
||||
if ((fp = fopen("88vga.dat", "wb")) != NULL) {
|
||||
width = 8;
|
||||
height = 8;
|
||||
numchars = 256;
|
||||
|
||||
r.r_ax = 0x1130; // locate the font (1st half)
|
||||
r.r_bx = 0x0300;
|
||||
intr(0x10, &r);
|
||||
|
||||
fwrite(MK_FP(r.r_es, r.r_bp), 1, (8 * 128), fp);
|
||||
|
||||
r.r_ax = 0x1130; // locate the font (2nd half)
|
||||
r.r_bx = 0x0400;
|
||||
intr(0x10, &r);
|
||||
|
||||
fwrite(MK_FP(r.r_es, r.r_bp), 1, (8 * 128), fp);
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
printf("Done\n");
|
||||
break;
|
||||
case 2:
|
||||
printf("Getting 8-by-14 ROM font...");
|
||||
|
||||
if ((fp = fopen("814vga.dat", "wb")) != NULL) {
|
||||
width = 8;
|
||||
height = 14;
|
||||
numchars = 256;
|
||||
|
||||
r.r_ax = 0x1130; // locate the font
|
||||
r.r_bx = 0x0200;
|
||||
intr(0x10, &r);
|
||||
|
||||
fwrite(MK_FP(r.r_es, r.r_bp), 1, (14 * 256), fp);
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
printf("Done\n");
|
||||
break;
|
||||
case 3:
|
||||
printf("Getting 8-by-16 ROM font...");
|
||||
|
||||
if ((fp = fopen("816vga.dat", "wb")) != NULL) {
|
||||
width = 8;
|
||||
height = 16;
|
||||
numchars = 256;
|
||||
|
||||
r.r_ax = 0x1130; // locate the font
|
||||
r.r_bx = 0x0600;
|
||||
intr(0x10, &r);
|
||||
|
||||
fwrite(MK_FP(r.r_es, r.r_bp), 1, (16 * 256), fp);
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
printf("Done\n");
|
||||
break;
|
||||
case 4:
|
||||
printf("Getting 9-by-16 ROM font...");
|
||||
|
||||
if ((fp = fopen("916vga.dat", "wb")) != NULL) {
|
||||
width = 9;
|
||||
height = 16;
|
||||
numchars = 256;
|
||||
|
||||
r.r_ax = 0x1130; // locate the font
|
||||
r.r_bx = 0x0700;
|
||||
intr(0x10, &r);
|
||||
|
||||
fwrite(MK_FP(r.r_es, r.r_bp), 1, (16 * 256) *2, fp);
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
printf("Done\n");
|
||||
break;
|
||||
case 5:
|
||||
printf("Getting 9-by-14 ROM font...");
|
||||
|
||||
if ((fp = fopen("914vga.dat", "wb")) != NULL) {
|
||||
width = 9;
|
||||
height = 16;
|
||||
numchars = 256;
|
||||
|
||||
r.r_ax = 0x1130; // locate the font
|
||||
r.r_bx = 0x0500;
|
||||
intr(0x10, &r);
|
||||
|
||||
fwrite(MK_FP(r.r_es, r.r_bp), 1, (14 * 256)* 2, fp);
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
printf("Done\n");
|
||||
break;
|
||||
case 6:
|
||||
break;
|
||||
default:
|
||||
printf("Please try again\n");
|
||||
break;
|
||||
}
|
||||
} while (font != 6);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,267 +0,0 @@
|
|||
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
|
||||
// Ken Silverman's official web site: "http://www.advsys.net/ken"
|
||||
// See the included license file "BUILDLIC.TXT" for license info.
|
||||
//
|
||||
// This file has been modified from Ken Silverman's original release
|
||||
// by Jonathon Fowler (jf@jonof.id.au)
|
||||
|
||||
#include "compat.h"
|
||||
#include "pragmas.h"
|
||||
|
||||
#define MAXWADS 4096
|
||||
|
||||
static int artversion, localtilestart, localtileend;
|
||||
static int fil1, fil2;
|
||||
static char wadata[MAXWADS][8];
|
||||
static int wadplc[MAXWADS], wadlen[MAXWADS], numwads;
|
||||
static int xoffses[1024], ylookup[256], picanm[MAXWADS];
|
||||
static short tilesizx[MAXWADS], tilesizy[MAXWADS];
|
||||
static char pal[768], palookup[8192];
|
||||
static char screen[65536], tempbuf[131072];
|
||||
|
||||
|
||||
void loadwadheader(void)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
Bread(fil1,&tempbuf[0],12);
|
||||
numwads = ((int)tempbuf[4])+(((int)tempbuf[5])<<8)+(((int)tempbuf[6])<<16)+(((int)tempbuf[7])<<24);
|
||||
i = ((int)tempbuf[8])+(((int)tempbuf[9])<<8)+(((int)tempbuf[10])<<16)+(((int)tempbuf[11])<<24);
|
||||
Blseek(fil1,i,BSEEK_SET);
|
||||
Bread(fil1,&tempbuf[0],numwads*16);
|
||||
j = 0;
|
||||
for(i=0;i<numwads;i++)
|
||||
{
|
||||
wadplc[i] = ((int)tempbuf[j])+(((int)tempbuf[j+1])<<8)+(((int)tempbuf[j+2])<<16)+(((int)tempbuf[j+3])<<24);
|
||||
j += 4;
|
||||
wadlen[i] = ((int)tempbuf[j])+(((int)tempbuf[j+1])<<8)+(((int)tempbuf[j+2])<<16)+(((int)tempbuf[j+3])<<24);
|
||||
j += 4;
|
||||
wadata[i][0] = tempbuf[j+0]; wadata[i][1] = tempbuf[j+1];
|
||||
wadata[i][2] = tempbuf[j+2]; wadata[i][3] = tempbuf[j+3];
|
||||
wadata[i][4] = tempbuf[j+4]; wadata[i][5] = tempbuf[j+5];
|
||||
wadata[i][6] = tempbuf[j+6]; wadata[i][7] = tempbuf[j+7];
|
||||
j += 8;
|
||||
}
|
||||
}
|
||||
|
||||
void convpalette(void)
|
||||
{
|
||||
int i, fil3;
|
||||
short danumshades;
|
||||
|
||||
i = 0;
|
||||
while (Bstrncasecmp(wadata[i],"PLAYPAL",7) != 0) i++;
|
||||
Blseek(fil1,wadplc[i],BSEEK_SET);
|
||||
Bread(fil1,pal,768);
|
||||
for(i=0;i<768;i++) pal[i] >>= 2;
|
||||
|
||||
i = 0;
|
||||
while (Bstrncasecmp(wadata[i],"COLORMAP",8) != 0) i++;
|
||||
Blseek(fil1,wadplc[i],BSEEK_SET);
|
||||
Bread(fil1,palookup,8192);
|
||||
|
||||
if ((fil3 = Bopen("palette.dat",BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
|
||||
{ Bprintf("Cannot save palette.dat\n"); exit(0); }
|
||||
Bwrite(fil3,pal,768);
|
||||
danumshades = 32;
|
||||
Bwrite(fil3,&danumshades,2);
|
||||
Bwrite(fil3,palookup,8192);
|
||||
Bclose(fil3);
|
||||
}
|
||||
|
||||
void saveart (short tilenum, short xlen, short ylen)
|
||||
{
|
||||
int i, x, p, pend;
|
||||
|
||||
pend = ylookup[ylen];
|
||||
|
||||
tilesizx[tilenum] = xlen;
|
||||
tilesizy[tilenum] = ylen;
|
||||
i = 0;
|
||||
for(x=0;x<xlen;x++)
|
||||
for(p=x;p<pend;p+=320)
|
||||
tempbuf[i++] = screen[p];
|
||||
if (Bwrite(fil2,&tempbuf[0],i) < 0)
|
||||
{
|
||||
Bprintf("NOT ENOUGH DISK SPACE!\n");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
void savenames(void)
|
||||
{
|
||||
BFILE * fil3;
|
||||
int i;
|
||||
|
||||
fil3 = Bfopen("names.h","w");
|
||||
|
||||
if (fil3 != NULL)
|
||||
{
|
||||
Bfprintf(fil3,"//Be careful when changing this file - it is parsed by Editart and Build.\n");
|
||||
|
||||
for(i=0; i<numwads; i++)
|
||||
if (wadata[i][0] != 0)
|
||||
Bfprintf(fil3,"#define %s %d\n", wadata[i], i);
|
||||
|
||||
Bfclose(fil3);
|
||||
}
|
||||
}
|
||||
|
||||
void showart (char const * part)
|
||||
{
|
||||
char yoff;
|
||||
short xsiz, ysiz;
|
||||
int i, z, zx, x, p, pend, curplc;
|
||||
|
||||
curplc = -1;
|
||||
if ((Bstrncasecmp(part,"L_START",7) == 0) || (Bstrncasecmp(part,"S_START",7) == 0) || (Bstrncasecmp(part,"P_START",7) == 0))
|
||||
{
|
||||
if (Bstrncasecmp(part,"L_START",7) == 0)
|
||||
z = 462;
|
||||
else
|
||||
{
|
||||
z = 0;
|
||||
while (Bstrncasecmp(wadata[z],part,7) != 0) z++;
|
||||
z++;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (Bstrncasecmp(wadata[z],"P1_START",8) == 0) z++;
|
||||
if (Bstrncasecmp(wadata[z],"P1_END",6) == 0) z++;
|
||||
if (Bstrncasecmp(wadata[z],"P2_START",8) == 0) z++;
|
||||
if (Bstrncasecmp(wadata[z],"S_START",7) == 0) break;
|
||||
if (Bstrncasecmp(wadata[z],"S_END",5) == 0) break;
|
||||
if (Bstrncasecmp(wadata[z],"P_END",5) == 0) break;
|
||||
|
||||
if (curplc != wadplc[z]) Blseek(fil1,wadplc[z],BSEEK_SET);
|
||||
read(fil1,&tempbuf[0],wadlen[z]);
|
||||
curplc = wadplc[z]+wadlen[z];
|
||||
|
||||
xsiz = (int)tempbuf[0]+(((int)tempbuf[1])<<8);
|
||||
ysiz = (int)tempbuf[2]+(((int)tempbuf[3])<<8);
|
||||
if ((xsiz <= 0) || (ysiz <= 0) || (xsiz > 320) || (ysiz > 200)) goto skipit;
|
||||
i = 8;
|
||||
for(zx=0;zx<xsiz;zx++)
|
||||
{
|
||||
xoffses[zx] = ((int)tempbuf[i])+(((int)tempbuf[i+1])<<8)+(((int)tempbuf[i+2])<<16)+(((int)tempbuf[i+3])<<24);
|
||||
i += 4;
|
||||
}
|
||||
|
||||
clearbuf(screen,ylookup[ysiz]>>2,0xffffffff);
|
||||
|
||||
for(x=0;x<xsiz;x++)
|
||||
{
|
||||
i = xoffses[x];
|
||||
yoff = tempbuf[i++];
|
||||
while (yoff != 255)
|
||||
{
|
||||
p = ylookup[yoff]+x;
|
||||
pend = p+ylookup[tempbuf[i]];
|
||||
i += 2;
|
||||
for(;p<pend;p+=320)
|
||||
screen[p] = tempbuf[i++];
|
||||
i++;
|
||||
yoff = tempbuf[i++];
|
||||
}
|
||||
}
|
||||
|
||||
saveart(z,xsiz,ysiz);
|
||||
skipit:
|
||||
z++;
|
||||
} while (z < numwads);
|
||||
}
|
||||
else
|
||||
{
|
||||
z = 0;
|
||||
while (Bstrncasecmp(wadata[z],part,7) != 0) z++;
|
||||
z++;
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (Bstrncasecmp(wadata[z],"F1_START",8) == 0) z++;
|
||||
if (Bstrncasecmp(wadata[z],"F1_END",6) == 0) z++;
|
||||
if (Bstrncasecmp(wadata[z],"F_END",5) == 0) break;
|
||||
|
||||
if (wadlen[z] == 4096)
|
||||
{
|
||||
if (curplc != wadplc[z]) Blseek(fil1,wadplc[z],BSEEK_SET);
|
||||
Bread(fil1,&tempbuf[0],4096);
|
||||
curplc = wadplc[z]+4096;
|
||||
i = 0;
|
||||
for(x=0;x<64;x++)
|
||||
for(p=x;p<320*64;p+=320)
|
||||
screen[p] = tempbuf[i++];
|
||||
|
||||
saveart(z,64,64);
|
||||
}
|
||||
|
||||
z++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i, j, endoffile;
|
||||
char wadfile[80];
|
||||
|
||||
Bprintf("Wad2Art! Copyright 1995 by Ken Silverman\n");
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
Bprintf("Command line parameters: Wad2Art <Doom IWAD file>\n");
|
||||
Bprintf(" Creates TILES000.ART, PALETTE.DAT, and NAMES.H in current directory.\n");
|
||||
Bprintf(" Ex: wad2art c:\\doom\\doom.wad\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
strcpy(wadfile,argv[1]);
|
||||
if (strchr(wadfile,'.') == 0) strcat(wadfile,".wad");
|
||||
if ((fil1 = Bopen(wadfile,BO_BINARY|BO_RDONLY,BS_IREAD)) == -1)
|
||||
{ Bprintf("Wad not found\n"); exit(0); }
|
||||
if ((fil2 = Bopen("tiles000.art",BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
|
||||
{ Bprintf("Can't open art file\n"); exit(0); }
|
||||
|
||||
j = 0;
|
||||
for(i=0;i<256;i++) { ylookup[i] = j; j += 320; }
|
||||
|
||||
Bprintf("Loading wad header...\n");
|
||||
loadwadheader();
|
||||
Blseek(fil2,16+(numwads<<3),SEEK_SET);
|
||||
for(i=0;i<numwads;i++)
|
||||
{ tilesizx[i] = 0; tilesizy[i] = 0; picanm[i] = 0L; }
|
||||
|
||||
Bprintf("Saving names.h\n");
|
||||
savenames();
|
||||
Bprintf("Converting palette\n");
|
||||
convpalette();
|
||||
|
||||
Bprintf("Saving tiles000.art\n");
|
||||
showart("L_START");
|
||||
showart("S_START");
|
||||
showart("P_START");
|
||||
showart("F_START");
|
||||
|
||||
Bprintf("Saving tiles000.art header\n");
|
||||
artversion = 1; localtilestart = 0; localtileend = numwads-1;
|
||||
|
||||
endoffile = Btell(fil2);
|
||||
Blseek(fil2,0,BSEEK_SET);
|
||||
Bwrite(fil2,&artversion,4);
|
||||
Bwrite(fil2,&numwads,4);
|
||||
Bwrite(fil2,&localtilestart,4);
|
||||
Bwrite(fil2,&localtileend,4);
|
||||
Bwrite(fil2,&tilesizx[0],numwads<<1);
|
||||
Bwrite(fil2,&tilesizy[0],numwads<<1);
|
||||
Bwrite(fil2,&picanm[0],numwads<<2);
|
||||
Blseek(fil2,endoffile,BSEEK_SET);
|
||||
|
||||
Bclose(fil2);
|
||||
Bclose(fil1);
|
||||
|
||||
Bprintf("Congratulations! Your disk actually had enough space this time!\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue