Add files via upload

This commit is contained in:
Furkan Mudanyali 2020-10-24 07:02:45 +03:00 committed by GitHub
parent 94048fa411
commit bbfe37c610
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 19681 additions and 0 deletions

75
CMakeLists.txt Normal file
View File

@ -0,0 +1,75 @@
cmake_minimum_required(VERSION 2.8)
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
if(DEFINED ENV{DOLCESDK})
set(CMAKE_TOOLCHAIN_FILE "$ENV{DOLCESDK}/share/dolce.toolchain.cmake" CACHE PATH "toolchain file")
else()
message(FATAL_ERROR "Please define DOLCESDK to point to your SDK path!")
endif()
endif()
project(CreepTea)
set(DOLCE_APP_NAME "Creep Tea Demo")
set(DOLCE_TITLEID "CREEPTEA0")
set(DOLCE_VERSION "01.00")
include("$ENV{DOLCESDK}/share/dolce.cmake" REQUIRED)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11 -o3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -o3")
link_directories(
${CMAKE_CURRENT_BINARY_DIR}
)
add_executable(${PROJECT_NAME}
ZeDemo.c
engine3d.c
env1.c
generate3d.c
precalcs.c
render3d.c
bitfonts.c
effects.c
env3.c
env2.c
sky1.c
sky2.c
loading.c
sky3.c
)
target_link_libraries(${PROJECT_NAME}
pthread
SDL
mikmod
vita2d
gcov
m
SceThreadmgr_stub
SceRtcUser_stub
SceCtrl_stub
SceGxm_stub
SceAudio_stub
SceSysmem_stub
SceThreadmgr_stub
SceHid_stub
SceDisplay_stub
SceDisplayUser_stub
SceCommonDialog_stub
SceSysmodule_stub
SceTouch_stub
ScePower_stub
)
dolce_create_self(${PROJECT_NAME}.self ${PROJECT_NAME})
dolce_create_vpk(${PROJECT_NAME}.vpk ${DOLCE_TITLEID} ${PROJECT_NAME}.self
VERSION ${DOLCE_VERSION}
NAME ${DOLCE_APP_NAME}
FILE sce_sys/icon0.png sce_sys/icon0.png
FILE sce_sys/livearea/contents/bg.png sce_sys/livearea/contents/bg.png
FILE sce_sys/livearea/contents/startup.png sce_sys/livearea/contents/startup.png
FILE sce_sys/livearea/contents/template.xml sce_sys/livearea/contents/template.xml
FILE sce_sys/creeptea.mod creeptea.mod
FILE sce_sys/magnolia.3do magnolia.3do
FILE sce_sys/gp2x.3do gp2x.3do
)

8
CreepTea.yml Normal file
View File

@ -0,0 +1,8 @@
CreepTea:
attributes: 0
version:
major: 1
minor: 0
main:
start: module_start
stop: module_stop

69
Makefile Normal file
View File

@ -0,0 +1,69 @@
# Project: ZeDemo
# Makefile created by Dev-C++ 4.9.9.2
CPP = ~/.local/dolcesdk/bin/arm-dolce-eabi-g++
CC = ~/.local/dolcesdk/bin/arm-dolce-eabi-gcc
WINDRES = windres
RES =
OBJ = engine3d.o env1.o generate3d.o precalcs.o render3d.o bitfonts.o ZeDemo.o effects.o env3.o env2.o sky1.o sky2.o loading.o sky3.o $(RES)
LINKOBJ = engine3d.o env1.o generate3d.o precalcs.o render3d.o bitfonts.o ZeDemo.o effects.o env3.o env2.o sky1.o sky2.o loading.o sky3.o $(RES)
LIBS = -L"~/.local/dolcesdk/arm-dolce-eabi/lib" -s -static -lmikmod -lSDL -lpthread -lm -lgcov
INCS = -I"~/.local/dolcesdk/arm-dolce-eabi/include"
CXXINCS = -I"~/.local/dolcesdk/arm-dolce-eabi/include"
BIN = ZeDemo.gpe
CXXFLAGS = $(CXXINCS) -w -fexpensive-optimizations -O3
CFLAGS = $(INCS) -w -fexpensive-optimizations -O3
RM = rm -f
.PHONY: all all-before all-after clean clean-custom
all: all-before ZeDemo.gpe all-after
clean: clean-custom
${RM} $(OBJ) $(BIN)
$(BIN): $(OBJ)
$(CC) $(LINKOBJ) -o "ZeDemo.gpe" $(LIBS)
engine3d.o: engine3d.c
$(CC) -c engine3d.c -o engine3d.o $(CFLAGS)
env1.o: env1.c
$(CC) -c env1.c -o env1.o $(CFLAGS)
generate3d.o: generate3d.c
$(CC) -c generate3d.c -o generate3d.o $(CFLAGS)
precalcs.o: precalcs.c
$(CC) -c precalcs.c -o precalcs.o $(CFLAGS)
render3d.o: render3d.c
$(CC) -c render3d.c -o render3d.o $(CFLAGS)
bitfonts.o: bitfonts.c
$(CC) -c bitfonts.c -o bitfonts.o $(CFLAGS)
ZeDemo.o: ZeDemo.c
$(CC) -c ZeDemo.c -o ZeDemo.o $(CFLAGS)
effects.o: effects.c
$(CC) -c effects.c -o effects.o $(CFLAGS)
env3.o: env3.c
$(CC) -c env3.c -o env3.o $(CFLAGS)
env2.o: env2.c
$(CC) -c env2.c -o env2.o $(CFLAGS)
sky1.o: sky1.c
$(CC) -c sky1.c -o sky1.o $(CFLAGS)
sky2.o: sky2.c
$(CC) -c sky2.c -o sky2.o $(CFLAGS)
loading.o: loading.c
$(CC) -c loading.c -o loading.o $(CFLAGS)
sky3.o: sky3.c
$(CC) -c sky3.c -o sky3.o $(CFLAGS)

245
ZeDemo.c Normal file
View File

@ -0,0 +1,245 @@
#include <math.h>
#include <math_neon.h>
#include <stdio.h>
#include <sys/unistd.h>
#include <SDL/SDL.h>
#include <mikmod.h>
#include <newlib.h>
#include "ZeDemo.h"
#include "effects.h"
#include "precalcs.h"
#include "engine3d.h"
#include <psp2/power.h>
#include <psp2/kernel/clib.h>
#include <psp2/kernel/processmgr.h>
SDL_Surface *screen;
SDL_Joystick *joystick;
SDL_Event event;
MODULE *module;
int quit = 0;
int nfrm=0, pfrm=0;
int fps=0, atime=0;
int partime=0, prticks=0;
char sbuffer[64];
int part = 0;
int nparts = 5;
extern int objshow_num, objshow_rmode, objshow_shade;
int maxobj = 7, maxshade = 13;
int rmode = 4;
int zbflag = 0;
extern int render_shit;
extern unsigned short shades[64][256];
extern unsigned short loading[];
void InitMusic()
{
MikMod_RegisterAllDrivers();
MikMod_RegisterAllLoaders();
md_mode |= DMODE_SOFT_MUSIC;
MikMod_Init("");
module = Player_Load("app0:creeptea.mod", 64, 0);
if (module) {
Player_Start(module);
}
}
void Wait(int seconds)
{
int atime = SDL_GetTicks();
while(SDL_GetTicks() - atime < (seconds * 1000)){};
}
void ClearScreen()
{
memset((unsigned int*)screen->pixels, 0, sizeof(unsigned short) * SSIZE);
}
void Script()
{
unsigned short *vram = (unsigned short*)screen->pixels;
prticks = SDL_GetTicks() - partime;
int leblast = 2192;
//printf("DEBUG: Script() Part case Number = %d\n", part);
switch(part)
{
case 0:
Floor(vram, 64, 64);
objshow_num = 0;
objshow_shade = 1;
objshow_rmode = GOURAUD;
render_shit = 0;
RunScene3d(vram,0);
if (prticks>leblast*6) part = 1;
break;
case 1:
Radial(vram,1);
if (prticks>leblast*11.75) part = 2;
break;
case 2:
DrawSky(vram);
objshow_num = 1;
objshow_shade = 1;
objshow_rmode = ENVMAP;
render_shit = 0;
RunScene3d(vram,1);
if (prticks>leblast*23) part = 3;
break;
case 3:
Polarplasma(vram, shades[4]);
objshow_num = 2;
objshow_shade = 6;
objshow_rmode = GOURAUD;
render_shit = 0;
RunScene3d(vram,0);
if (prticks>leblast*34.5) part = 4;
break;
case 4:
Plasma(vram, shades[5]);
objshow_num = 3;
objshow_shade = 2;
objshow_rmode = GOURAUD;
render_shit = 0;
RunScene3d(vram,0);
if (prticks>leblast*46) part = 5;
break;
case 5:
ClearScreen();
objshow_num = 6;
render_shit = 1;
RunScene3d(vram,0);
if (prticks>leblast*57.5)
{
InitRadialBitmap2();
part = 6;
}
break;
case 6:
Radial(vram,0);
if (prticks>leblast*68.5)
quit = 1;
break;
default:
break;
}
}
void Init()
{
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0)
{
printf("DEBUG: SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0. Failed\n");
sceKernelExitProcess(0);
}
screen = SDL_SetVideoMode(WIDTH, HEIGHT, 16, SDL_SWSURFACE);
if (!screen)
{
printf("DEBUG: screen Failed.\n");
sceKernelExitProcess(0);
}
SDL_SetVideoModeScaling(118, 0, 725, 544);
joystick = SDL_JoystickOpen(0);
if (!joystick)
{
printf("DEBUG: joystick failed.\n");
sceKernelExitProcess(0);
}
SDL_ShowCursor(SDL_DISABLE);
SDL_LockSurface(screen);
int i;
unsigned short *vram = (unsigned short*)screen->pixels;
for (i = 0; i<SSIZE; i++)
*(vram+i) = loading[i];
SDL_UnlockSurface(screen);
SDL_Flip(screen);
precalcs();
partime = SDL_GetTicks();
InitMusic();
}
void CountFps()
{
if (SDL_GetTicks()-atime>=1000)
{
atime = SDL_GetTicks();
fps=(nfrm-pfrm);
pfrm=nfrm;
}
// sprintf(sbuffer, "FPS = %d", fps);
// DrawText_(8, 16, 16, sbuffer, 16, (unsigned short*)screen->pixels);
}
void CheckJoy()
{
while (SDL_PollEvent(&event))
{
switch (event.type)
{
case SDL_JOYBUTTONDOWN:
switch(event.jbutton.button)
{
case GP2X_BUTTON_START:
quit = 1;
break;
/*
case GP2X_BUTTON_L:
part = (part + 1) % nparts;
break;
case GP2X_BUTTON_R:
part--;
if (part<0) part = nparts - 1;
break;
*/
}
break;
}
}
}
int main(int argc, char *argv[])
{
//MAXIMUM SPEEEED
scePowerSetArmClockFrequency(444);
scePowerSetBusClockFrequency(222);
Init();
do{
SDL_LockSurface(screen);
Script();
CountFps();
nfrm++;
SDL_UnlockSurface(screen);
SDL_Flip(screen);
if (Player_Active())
MikMod_Update();
CheckJoy();
}while(!quit);
SDL_Quit();
Player_Stop();
Player_Free(module);
MikMod_Exit();
sceKernelExitProcess(0);
return 0;
}

289
ZeDemo.dev Normal file
View File

@ -0,0 +1,289 @@
[Project]
FileName=ZeDemo.dev
Name=ZeDemo
UnitCount=20
Type=1
Ver=1
ObjFiles=
Includes=
Libs=
PrivateResource=
ResourceIncludes=
MakeIncludes=
Compiler=
CppCompiler=
Linker=-s -static -lmikmod -lSDL -lpthread -lm_@@_
IsCpp=0
Icon=
ExeOutput=
ObjectOutput=
OverrideOutput=1
OverrideOutputName=ZeDemo.gpe
HostApplication=
Folders=
CommandLine=
UseCustomMakefile=0
CustomMakefile=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=1
CompilerSettings=0010000001001000000000
[Unit3]
FileName=env1.c
CompileCpp=0
Folder=ZeEngineGP2X
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit5]
FileName=generate3d.h
CompileCpp=0
Folder=ZeEngineGP2X
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit6]
FileName=precalcs.c
CompileCpp=0
Folder=ZeEngineGP2X
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit7]
FileName=precalcs.h
CompileCpp=0
Folder=ZeEngineGP2X
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit8]
FileName=render3d.c
CompileCpp=0
Folder=ZeEngineGP2X
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit9]
FileName=render3d.h
CompileCpp=0
Folder=ZeEngineGP2X
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit11]
FileName=ZeDemo.c
CompileCpp=0
Folder=ZeEnginePC
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit12]
FileName=ZeDemo.h
CompileCpp=0
Folder=ZeEnginePC
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit13]
FileName=effects.h
CompileCpp=0
Folder=ZeEnginePC
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit14]
FileName=effects.c
CompileCpp=0
Folder=ZeEnginePC
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit15]
FileName=env3.c
CompileCpp=0
Folder=ZeDemo
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[VersionInfo]
Major=0
Minor=1
Release=1
Build=1
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNr=0
[Unit16]
FileName=env2.c
CompileCpp=0
Folder=ZeDemo
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit17]
FileName=sky1.c
Folder=ZeDemo
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
CompileCpp=0
[Unit19]
FileName=loading.c
CompileCpp=0
Folder=ZeDemo
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit18]
FileName=..\..\PC\ZeDemo\sky2.c
CompileCpp=0
Folder=ZeDemo
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit20]
FileName=sky3.c
CompileCpp=0
Folder=ZeDemo
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit22]
FileName=..\..\PC\ZeDemo\sky2.c
CompileCpp=0
Folder=ZeDemo
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit21]
FileName=sky1.c
CompileCpp=0
Folder=ZeDemo
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit23]
FileName=loading.c
CompileCpp=0
Folder=ZeDemo
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit24]
FileName=sky3.c
CompileCpp=0
Folder=ZeDemo
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit1]
FileName=engine3d.c
CompileCpp=0
Folder=ZeEngineGP2X
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit2]
FileName=engine3d.h
CompileCpp=0
Folder=ZeEngineGP2X
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit4]
FileName=generate3d.c
CompileCpp=0
Folder=ZeEngineGP2X
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit10]
FileName=bitfonts.c
CompileCpp=0
Folder=ZeEngineGP2X
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=

26
ZeDemo.h Normal file
View File

@ -0,0 +1,26 @@
#define WIDTH 320
#define HEIGHT 240
#define SSIZE WIDTH*HEIGHT
#define GP2X_BUTTON_UP (0)
#define GP2X_BUTTON_DOWN (4)
#define GP2X_BUTTON_LEFT (2)
#define GP2X_BUTTON_RIGHT (6)
#define GP2X_BUTTON_UPLEFT (1)
#define GP2X_BUTTON_UPRIGHT (7)
#define GP2X_BUTTON_DOWNLEFT (3)
#define GP2X_BUTTON_DOWNRIGHT (5)
#define GP2X_BUTTON_CLICK (18)
#define GP2X_BUTTON_A (12)
#define GP2X_BUTTON_B (13)
#define GP2X_BUTTON_X (14)
#define GP2X_BUTTON_Y (15)
#define GP2X_BUTTON_L (10)
#define GP2X_BUTTON_R (11)
#define GP2X_BUTTON_START (8)
#define GP2X_BUTTON_SELECT (9)
#define GP2X_BUTTON_VOLUP (16)
#define GP2X_BUTTON_VOLDOWN (17)
void Wait(int seconds);

15
bitfonts.c Normal file
View File

@ -0,0 +1,15 @@
unsigned char bitfonts[] = {0,0,0,0,0,0,0,0,4,12,8,24,16,0,32,0,10,18,20,0,0,0,0,0,0,20,126,40,252,80,
0,0,6,25,124,32,248,34,28,0,4,12,72,24,18,48,32,0,14,18,20,8,21,34,29,0,32,32,64,0,0,0,
0,0,16,32,96,64,64,64,32,0,4,2,2,2,6,4,8,0,8,42,28,127,28,42,8,0,0,4,12,62,24,16,
0,0,0,0,0,0,0,0,32,64,0,0,0,60,0,0,0,0,0,0,0,0,0,0,32,0,4,12,8,24,16,48,
32,0,14,17,35,77,113,66,60,0,12,28,12,8,24,16,16,0,30,50,4,24,48,96,124,0,28,50,6,4,2,98,
60,0,2,18,36,100,126,8,8,0,15,16,24,4,2,50,28,0,14,17,32,76,66,98,60,0,126,6,12,24,16,48,
32,0,56,36,24,100,66,98,60,0,14,17,17,9,2,34,28,0,0,0,16,0,0,16,0,0,0,0,16,0,16,32,
0,0,0,0,0,0,0,0,0,0,0,0,30,0,60,0,0,0,0,0,0,0,0,0,0,0,28,50,6,12,8,0,
16,0,0,0,0,0,0,0,0,0,14,27,51,63,99,65,65,0,28,18,57,38,65,65,62,0,14,25,32,96,64,98,
60,0,12,18,49,33,65,66,60,0,30,32,32,120,64,64,60,0,31,48,32,60,96,64,64,0,14,25,32,96,68,98,
60,0,17,17,50,46,100,68,68,0,8,8,24,16,48,32,32,0,2,2,2,6,68,68,56,0,16,17,54,60,120,76,
66,0,16,48,32,96,64,64,60,0,10,21,49,33,99,66,66,0,17,41,37,101,67,66,66,0,28,50,33,97,67,66,
60,0,28,50,34,36,120,64,64,0,28,50,33,97,77,66,61,0,28,50,34,36,124,70,66,0,14,25,16,12,2,70,
60,0,126,24,16,16,48,32,32,0,17,49,35,98,70,68,56,0,66,102,36,44,40,56,48,0,33,97,67,66,86,84,
40,0,67,36,24,28,36,66,66,0,34,18,22,12,12,8,24,0,31,2,4,4,8,24,62,0};

230
effects.c Normal file
View File

@ -0,0 +1,230 @@
#include <math.h>
#include <SDL/SDL_timer.h>
#include "ZeDemo.h"
#include "effects.h"
#include "precalcs.h"
#include "engine3d.h"
#define SWAP8(x) ( (((x) >> 4) & 0x0F) | (((x) << 4) & 0xF0) )
#define SWAP16(x) ( (((x) >> 8) & 0x00FF) | (((x) << 8) & 0xFF00) )
#define SWAP32(x)( (((x) >> 24) & 0x000000FF) | (((x) >> 8) & 0x0000FF00) | (((x) << 8) & 0x00FF0000) | (((x) << 24) & 0xFF000000) )
extern unsigned int fsin1[2048], fsin2[2048], fsin3[2048];
extern int prticks;
extern unsigned short sky1[];
extern unsigned short sky2[];
short floorstuff[2*WIDTH*HEIGHT];
unsigned char dist_angle[2*WIDTH*HEIGHT];
extern unsigned char rbmp[SSIZE];
extern unsigned char gbmp[SSIZE];
extern unsigned char bbmp[SSIZE];
extern unsigned char rbuffer[SSIZE];
extern unsigned char gbuffer[SSIZE];
extern unsigned char bbuffer[SSIZE];
extern short radir0[SSIZE];
extern short radir1[SSIZE];
extern short radir2[SSIZE];
extern short radir3[SSIZE];
extern short radir4[SSIZE];
extern short radir5[SSIZE];
void Polarplasma(unsigned short *vram, unsigned short shade[])
{
int x,y;
unsigned char c;
unsigned int c0;
unsigned int *vram32 = (unsigned int*)vram;
unsigned int k = prticks>>3;
int i, j = 0;
for (i=0; i<WIDTH*HEIGHT; i+=2)
{
c = dist_angle[j] + dist_angle[j+1] + k;
c0 = shade[c];
c = dist_angle[j+2] + dist_angle[j+3] + k;
*vram32++ = (shade[c]<<16) | c0;
j+=4;
}
}
void Plasma(unsigned short *vram, unsigned short shade[])
{
unsigned int *vram32 = (unsigned int*)vram;
unsigned int k = (prticks>>4)%438;
unsigned int x, y;
for (y=0; y<240; y++)
for (x=0; x<320; x+=8)
{
*vram32++ = shade[(fsin1[x] + fsin2[y] + fsin3[x+y+k]) & 255] | (shade[(fsin1[x+1] + fsin2[y] + fsin3[x+y+k+1]) & 255]<<16);
*vram32++ = shade[(fsin1[x+2] + fsin2[y] + fsin3[x+y+k+2]) & 255] | (shade[(fsin1[x+3] + fsin2[y] + fsin3[x+y+k+3]) & 255]<<16);
*vram32++ = shade[(fsin1[x+4] + fsin2[y] + fsin3[x+y+k+4]) & 255] | (shade[(fsin1[x+5] + fsin2[y] + fsin3[x+y+k+5]) & 255]<<16);
*vram32++ = shade[(fsin1[x+6] + fsin2[y] + fsin3[x+y+k+6]) & 255] | (shade[(fsin1[x+7] + fsin2[y] + fsin3[x+y+k+7]) & 255]<<16);
}
}
void DrawSky(unsigned short *vram)
{
int x, y, xp, yp = 256*255;
unsigned int *vram32 = (unsigned int*)vram;
unsigned int c0;
for (y=0; y<HEIGHT; y++)
{
for (x=0; x<WIDTH; x+=2)
{
xp = (x-(WIDTH>>1)) & 255;
c0 = sky1[xp + yp];
xp = (x+1-(WIDTH>>1)) & 255;
*vram32++ = (sky1[xp + yp]<<16) | c0;
}
yp-=256;
}
}
void Floor(unsigned short *vram, float ra, float zm)
{
int x,y;
int u,v;
int ira = SDL_GetTicks()>>4;
int izm = zm;
unsigned int c,i;
unsigned int *vram32 = (unsigned int*)vram;
i=0;
for (y=0;y<HEIGHT - (HEIGHT>>2);y++)
{
for (x=0;x<WIDTH;x+=2)
{
u = floorstuff[i+1] & 127;
v = (floorstuff[i] + ira) & 127;
c = sky2[u + (v<<7)];
u = floorstuff[i+3] & 127;
v = (floorstuff[i+2] + ira) & 127;
c = c | (sky2[u + (v<<7)]<<16);
i+=4;
*vram32++=c;
}
}
}
void Radial(unsigned short *avram, int fick)
{
int x,y,i,ri,sum;
int r,g,b;
int k = prticks/12;
int dcx = sin((double)k/73.0)*(WIDTH>>1);
int dcy = fick * sin((double)k/112.0)*(HEIGHT>>1);
int dci = dcx + dcy*WIDTH;
unsigned short *vram;
//Initialize the buffer or something
unsigned int *rbuffer32 = (unsigned int*)rbuffer, *gbuffer32 = (unsigned int*)gbuffer, *bbuffer32 = (unsigned int*)bbuffer;
for (i=0; i<SSIZE; i+=4)
{
*rbuffer32++ = rbmp[i] | (rbmp[i+1]<<8) | (rbmp[i+2]<<16) | (rbmp[i+3]<<24);
*gbuffer32++ = gbmp[i] | (gbmp[i+1]<<8) | (gbmp[i+2]<<16) | (gbmp[i+3]<<24);
*bbuffer32++ = bbmp[i] | (bbmp[i+1]<<8) | (bbmp[i+2]<<16) | (bbmp[i+3]<<24);
}
/*
Quadrants:
Q2 | Q1
---|--- <= The Screen
Q3 | Q4
Q1 and Q4 are kinda broken rn.
*/
// Quadrant 1
vram=(unsigned short*)avram + WIDTH/2 + (HEIGHT/2-1)*WIDTH + dci;
i=WIDTH/2 + (HEIGHT/2-1)*WIDTH + dci;
ri=0;
for (y=HEIGHT/2-1+dcy; y>=0; y--)
{
for (x=WIDTH/2+dcx; x<WIDTH; x++)
{
rbuffer[i] = (rbuffer[i] + rbuffer[i + radir3[ri]] + rbuffer[i + radir4[ri]] + rbuffer[i + radir5[ri]])>>2;
gbuffer[i] = (gbuffer[i] + gbuffer[i + radir3[ri]] + gbuffer[i + radir4[ri]] + gbuffer[i + radir5[ri]])>>2;
bbuffer[i] = (bbuffer[i] + bbuffer[i + radir3[ri]] + bbuffer[i + radir4[ri]] + bbuffer[i + radir5[ri]])>>2;
//RGB565 0xFFFF
*vram++ = ((rbuffer[i] >> 3) << 11) | ((gbuffer[i] >> 2) << 5) | (bbuffer[i] >> 3);
i++;
ri++;
}
i=i-3*(WIDTH/2)+dcx;
ri+=WIDTH/2+dcx;
vram=vram-3*(WIDTH/2)+dcx;
}
// Quadrant 2
vram=(unsigned short*)avram + (WIDTH/2 - 1) + (HEIGHT/2 - 1)*WIDTH + dci;
i=(WIDTH/2-1) + (HEIGHT/2-1)*WIDTH + dci;
ri=0;
for (y=HEIGHT/2-1+dcy; y>=0; y--)
{
for (x=WIDTH/2-1+dcx; x>=0; x--)
{
rbuffer[i] = (rbuffer[i] + rbuffer[i - radir0[ri]] + rbuffer[i - radir1[ri]] + rbuffer[i - radir2[ri]])>>2;
gbuffer[i] = (gbuffer[i] + gbuffer[i - radir0[ri]] + gbuffer[i - radir1[ri]] + gbuffer[i - radir2[ri]])>>2;
bbuffer[i] = (bbuffer[i] + bbuffer[i - radir0[ri]] + bbuffer[i - radir1[ri]] + bbuffer[i - radir2[ri]])>>2;
//RGB565 0xFFFF
//correct
*vram-- = ((rbuffer[i] >> 3) << 11) | ((gbuffer[i] >> 2) << 5) | (bbuffer[i] >> 3);
i--;
ri++;
}
i=i-WIDTH/2+dcx;
ri+=WIDTH/2-dcx;
vram=vram-WIDTH/2+dcx;
}
// Quadrant 3
vram=(unsigned short*)avram + (WIDTH/2 - 1) + (HEIGHT/2)*WIDTH + dci;
i=(WIDTH/2-1) + (HEIGHT/2)*WIDTH + dci;
ri=0;
for (y=HEIGHT/2+dcy; y<HEIGHT; y++)
{
for (x=WIDTH/2-1+dcx; x>=0; x--)
{
rbuffer[i] = (rbuffer[i] + rbuffer[i - radir3[ri]] + rbuffer[i - radir4[ri]] + rbuffer[i - radir5[ri]])>>2;
gbuffer[i] = (gbuffer[i] + gbuffer[i - radir3[ri]] + gbuffer[i - radir4[ri]] + gbuffer[i - radir5[ri]])>>2;
bbuffer[i] = (bbuffer[i] + bbuffer[i - radir3[ri]] + bbuffer[i - radir4[ri]] + bbuffer[i - radir5[ri]])>>2;
//RGB565 0xFFFF
*vram-- = ((rbuffer[i] >> 3) << 11) | ((gbuffer[i] >> 2) << 5) | (bbuffer[i] >> 3);
i--;
ri++;
}
i+=3*(WIDTH/2)+dcx;
ri+=WIDTH/2-dcx;
vram+=3*(WIDTH/2)+dcx;
}
// Quadrant 4
vram=(unsigned short*)avram + WIDTH/2 + (HEIGHT/2)*WIDTH + dci;
i=WIDTH/2 + (HEIGHT/2)*WIDTH + dci;
ri=0;
for (y=HEIGHT/2+dcy; y<HEIGHT; y++)
{
for (x=WIDTH/2+dcx; x<WIDTH; x++)
{
rbuffer[i] = (rbuffer[i] + rbuffer[i + radir0[ri]] + rbuffer[i + radir1[ri]] + rbuffer[i + radir2[ri]])>>2;
gbuffer[i] = (gbuffer[i] + gbuffer[i + radir0[ri]] + gbuffer[i + radir1[ri]] + gbuffer[i + radir2[ri]])>>2;
bbuffer[i] = (bbuffer[i] + bbuffer[i + radir0[ri]] + bbuffer[i + radir1[ri]] + bbuffer[i + radir2[ri]])>>2;
//RGB565 0xFFFF
*vram++ = ((rbuffer[i] >> 3) << 11) | ((gbuffer[i] >> 2) << 5) | (bbuffer[i] >> 3);
i++;
ri++;
}
i+=WIDTH/2+dcx;
ri+=WIDTH/2+dcx;
vram+=WIDTH/2+dcx;
}
}

5
effects.h Normal file
View File

@ -0,0 +1,5 @@
void Plasma(unsigned short *vram, unsigned short shade[]);
void Floor(unsigned short *vram, float ra, float zm);
void DrawSky(unsigned short *vram);
void Polarplasma(unsigned short *vram, unsigned short shade[]);
void Radial(unsigned short *avram, int fick);

407
engine3d.c Normal file
View File

@ -0,0 +1,407 @@
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include "engine3d.h"
#include "generate3d.h"
#include "render3d.h"
#include "ZeDemo.h"
point3d fpts[MAXDATA];
point3d norms[MAXDATA];
point3d pt_norms[MAXDATA];
point2d spts[MAXDATA];
point3d spls[MAXDATA];
unsigned int btime = 0, dtime = 0, dtime2 = 0;
unsigned short swp[MAXDATA];
const float proj = 256;
extern unsigned int RenderMode;
extern object3d object[16];
extern int prticks;
extern int maxobj;
int objshow_num = 0, objshow_rmode = GOURAUD, objshow_shade = 1;
int render_shit = 1;
int lightcalc = LIGHTVIEW;
#define fp_mul 256
#define fp_shr 8
#define proj_shr 8
int iii = 0;
void Init3d()
{
int i;
for (i=0; i<maxobj; i++)
{
printf("DEBUG: Init3d i=%d ", i);
InitTestObject(&object[i],i);
printf("DEBUG: InitTestObject Done\n", i);
}
}
vector3d CrossProduct(vector3d v1, vector3d v2)
{
vector3d v;
v.x=v1.y*v2.z-v1.z*v2.y;
v.y=v1.z*v2.x-v1.x*v2.z;
v.z=v1.x*v2.y-v1.y*v2.x;
return v;
}
int DotProduct(vector3d v1, vector3d v2)
{
return v1.x*v2.x + v1.y*v2.y + v1.z*v2.z;
}
vector3d Normalize(vector3d v)
{
int d=sqrt(v.x*v.x+v.y*v.y+v.z*v.z);
if (d!=0)
{
v.x=(v.x<<fp_shr)/d;
v.y=(v.y<<fp_shr)/d;
v.z=(v.z<<fp_shr)/d;
}
else
{
v.x = 0;
v.y = 0;
v.z = 0;
}
return v;
}
vector3d NegVec(vector3d v)
{
v.x=-v.x;
v.y=-v.y;
v.z=-v.z;
return v;
}
void translate3d (object3d *obj)
{
int i;
int objposx = obj->pos.x * fp_mul;
int objposy = obj->pos.y * fp_mul;
int objposz = obj->pos.z * fp_mul;
for (i=0; i<obj->npts; i++)
{
fpts[i].x += objposx;
fpts[i].y += objposy;
fpts[i].z += objposz;
}
}
void rotate3d (object3d *obj)
{
float cosxr = cos(obj->rot.x); float cosyr = cos(obj->rot.y); float coszr = cos(obj->rot.z);
float sinxr = sin(obj->rot.x); float sinyr = sin(obj->rot.y); float sinzr = sin(obj->rot.z);
int xvx = (cosyr * coszr) * fp_mul; int xvy = (sinxr * sinyr * coszr - cosxr * sinzr) * fp_mul; int xvz = (cosxr * sinyr * coszr + sinxr * sinzr) * fp_mul;
int yvx = (cosyr * sinzr) * fp_mul; int yvy = (cosxr * coszr + sinxr * sinyr * sinzr) * fp_mul; int yvz = (-sinxr * coszr + cosxr * sinyr * sinzr) * fp_mul;
int zvx = (-sinyr) * fp_mul; int zvy = (sinxr * cosyr) * fp_mul; int zvz = (cosxr * cosyr) * fp_mul;
int x, y, z;
int i;
for (i=0; i<obj->npts; i++)
{
x = obj->point[i].x;
y = obj->point[i].y;
z = obj->point[i].z;
fpts[i].x = x * xvx + y * xvy + z * xvz;
fpts[i].y = x * yvx + y * yvy + z * yvz;
fpts[i].z = x * zvx + y * zvy + z * zvz;
}
}
void rotate3d_normals (object3d *obj)
{
float cosxr = cos(obj->rot.x); float cosyr = cos(obj->rot.y); float coszr = cos(obj->rot.z);
float sinxr = sin(obj->rot.x); float sinyr = sin(obj->rot.y); float sinzr = sin(obj->rot.z);
int xvx = (cosyr * coszr) * fp_mul; int xvy = (sinxr * sinyr * coszr - cosxr * sinzr) * fp_mul; int xvz = (cosxr * sinyr * coszr + sinxr * sinzr) * fp_mul;
int yvx = (cosyr * sinzr) * fp_mul; int yvy = (cosxr * coszr + sinxr * sinyr * sinzr) * fp_mul; int yvz = (-sinxr * coszr + cosxr * sinyr * sinzr) * fp_mul;
int zvx = (-sinyr) * fp_mul; int zvy = (sinxr * cosyr) * fp_mul; int zvz = (cosxr * cosyr) * fp_mul;
int x, y, z;
int i;
for (i=0; i<obj->npls; i++)
{
x = obj->normal[i].x;
y = obj->normal[i].y;
z = obj->normal[i].z;
norms[i].x = x * xvx + y * xvy + z * xvz;
norms[i].y = x * yvx + y * yvy + z * yvz;
norms[i].z = x * zvx + y * zvy + z * zvz;
}
}
void rotate3d_pt_normals (object3d *obj)
{
float cosxr = cos(obj->rot.x); float cosyr = cos(obj->rot.y); float coszr = cos(obj->rot.z);
float sinxr = sin(obj->rot.x); float sinyr = sin(obj->rot.y); float sinzr = sin(obj->rot.z);
int xvx = (cosyr * coszr) * fp_mul; int xvy = (sinxr * sinyr * coszr - cosxr * sinzr) * fp_mul; int xvz = (cosxr * sinyr * coszr + sinxr * sinzr) * fp_mul;
int yvx = (cosyr * sinzr) * fp_mul; int yvy = (cosxr * coszr + sinxr * sinyr * sinzr) * fp_mul; int yvz = (-sinxr * coszr + cosxr * sinyr * sinzr) * fp_mul;
int zvx = (-sinyr) * fp_mul; int zvy = (sinxr * cosyr) * fp_mul; int zvz = (cosxr * cosyr) * fp_mul;
int x, y, z;
int i;
for (i=0; i<obj->npts; i++)
{
x = obj->pt_normal[i].x;
y = obj->pt_normal[i].y;
z = obj->pt_normal[i].z;
pt_norms[i].x = x * xvx + y * xvy + z * xvz;
pt_norms[i].y = x * yvx + y * yvy + z * yvz;
pt_norms[i].z = x * zvx + y * zvy + z * zvz;
}
}
void project3d (object3d *obj)
{
int i;
int smul = 1;
for (i=0; i<obj->npts; i++)
if (fpts[i].z > 0)
{
spts[i].x = ((fpts[i].x << proj_shr) / (fpts[i].z/smul)) + (WIDTH>>1);
spts[i].y = ((fpts[i].y << proj_shr) / (fpts[i].z/smul)) + (HEIGHT>>1);
}
}
void CalcPolyColorStatic(object3d *obj)
{
int i, c;
for (i=0; i<obj->npls; i++)
{
c = norms[i].z>>8;
if (c<0) c=0;
if (c>255) c=255;
spls[i].c = c;
}
}
void CalcPointColorStatic(object3d *obj)
{
int i, c;
for (i=0; i<obj->npts; i++)
{
c = pt_norms[i].z>>8;
if (c<0) c=0;
if (c>255) c=255;
spts[i].c = c;
}
}
void CalcPolyColorDynamic(object3d *obj)
{
vector3d light, v;
light.x = 0;
light.y = 0;
light.z = 256;
float c;
int i;
for (i=0; i<obj->npls; i++)
{
v.x = norms[i].x;
v.y = norms[i].y;
v.z = norms[i].z;
c = DotProduct(v,light);
spls[i].c = c;
if (c<0) spls[i].c = 0;
if (spls[i].c>255) spls[i].c = 255;
}
}
void CalcPointColorDynamic(object3d *obj)
{
vector3d light, v;
light.x = 0;
light.y = 0;
light.z = 256;
float c;
int i;
for (i=0; i<obj->npts; i++)
{
v.x = pt_norms[i].x;
v.y = pt_norms[i].y;
v.z = pt_norms[i].z;
c = DotProduct(v,light);
if (c<0) c = 0;
if (c>255) c = 255;
spts[i].c = c;
}
}
void CalcPointColor(object3d *obj)
{
if (lightcalc==LIGHTVIEW) CalcPointColorStatic(obj);
if (lightcalc==LIGHTMOVE) CalcPointColorDynamic(obj);
}
void CalcPolyColor(object3d *obj)
{
if (lightcalc==LIGHTVIEW) CalcPolyColorStatic(obj);
if (lightcalc==LIGHTMOVE) CalcPolyColorDynamic(obj);
}
void Calc3d(object3d *obj)
{
rotate3d(obj);
translate3d(obj);
project3d(obj);
}
void quicksort (int lo, int hi, int data[])
{
int m1 = lo;
int m2 = hi;
int temp0;
unsigned short temp1;
int mp = data[(lo + hi)>>1];
while (m1<=m2)
{
while (data[m1] < mp) m1++;
while (mp < data[m2]) m2--;
if (m1<=m2)
{
temp0 = data[m1]; data[m1] = data[m2]; data[m2] = temp0;
temp1 = swp[m1]; swp[m1] = swp[m2]; swp[m2] = temp1;
m1++;
m2--;
}
}
if (m2>lo) quicksort(lo, m2, data);
if (m1<hi) quicksort(m1, hi, data);
}
void BlurGrid(object3d *obj)
{
if (prticks - dtime >= 1024)
{
dtime = prticks;
int x, y;
int c = 255;
int xp = (rand()%14) - 7;
int yp = (rand()%14) - 7;
for (y=-1; y<2; y++)
for (x=-1; x<2; x++)
obj->point[((33>>1)+x + xp) + ((33>>1)+y + yp)*33].z = c;
}
if (prticks - dtime2 >= 512)
{
dtime2 = prticks;
int x, y;
int c = 63;
int xp = (rand()%14) - 7;
int yp = (rand()%14) - 7;
for (y=-1; y<2; y++)
for (x=-1; x<2; x++)
obj->point[((33>>1)+x + xp) + ((33>>1)+y + yp)*33].z = c;
}
if (prticks - btime >= 32)
{
btime = prticks;
int x, y, i;
for (i=0; i<1; i++)
for (y=1; y<32; y++)
for (x=1; x<32; x++)
obj->point[x+y*33].z = (obj->point[x-1+y*33].z + obj->point[x+1+y*33].z + obj->point[x+(y+1)*33].z + obj->point[x+(y-1)*33].z)>>2;
}
}
void RunObjectShow(unsigned short *vram)
{
int objn = objshow_num;
if (objn==6)
object[objn].rot.y = -((prticks/3.0) / D2R);
if (objn==0)
{
object[objn].pos.y = 64;
object[objn].rot.x = -PI/2;
object[objn].rot.y = -prticks/2048.0;
}
if (objn==1)
{
object[objn].pos.y = 0;
object[objn].pos.z = 384;
object[objn].rot.x = -PI/4;
object[objn].rot.y = -prticks/2048.0;
}
if (objn==2)
{
object[objn].pos.y = 1024;
object[objn].rot.x = PI;
object[objn].rot.y = -prticks/2048.0;
}
if (objn==3)
{
object[objn].pos.y = 96 + sin(prticks/512.0)*24;
object[objn].rot.x = +PI/2;
object[objn].rot.y = -prticks/2048.0;
BlurGrid(&object[objn]);
}
Calc3d(&object[objn]);
if (render_shit==1)
Render(&object[objn], vram);
else
{
RenderMode = objshow_rmode;
RenderOld(&object[objn], objshow_shade, vram);
}
}
void RunScene3d(unsigned short *vram, int sn)
{
int objn;
switch(sn)
{
case 0:
RunObjectShow(vram);
break;
case 1:
Wave(&object[1]);
RunObjectShow(vram);
break;
default:
break;
}
}

140
engine3d.h Normal file
View File

@ -0,0 +1,140 @@
#define vbn 512
#define MAXDATA 262144
#define POINTS 1
#define WIRE 2
#define FLAT 4
#define GOURAUD 8
#define ENVMAP 16
#define TEXTURE 32
#define VBALLS 0
#define TEXTUREPLASMA 128
#define ZBUFFER 256
#define LIGHTVIEW 0
#define LIGHTMOVE 1
#define PI 3.14151693
#define D2R 180.0/PI
typedef struct vector3d
{
int x;
int y;
int z;
} vector3d;
typedef struct point2d
{
int x;
int y;
unsigned short c;
} point2d;
typedef struct point3d
{
int x;
int y;
int z;
unsigned short c;
} point3d;
typedef struct texture
{
unsigned int tshr;
unsigned short *bitmap;
}texture;
typedef struct material
{
int rmode;
int nshade;
int ntexture;
unsigned short **shade;
texture **txtr;
} material;
typedef struct tcord
{
int u, v;
} tcord;
typedef struct poly2d
{
int p0; tcord tc0;
int p1; tcord tc1;
int p2; tcord tc2;
int c;
int m;
} poly2d;
typedef struct line2d
{
int p0;
int p1;
int c;
}line2d;
typedef struct rot3d
{
float x;
float y;
float z;
}rot3d;
typedef struct pos3d
{
float x;
float y;
float z;
}pos3d;
typedef struct object3d
{
int npts, npls, nlns;
point3d *point;
poly2d *poly;
line2d *line;
vector3d *normal;
vector3d *pt_normal;
material *mtrl;
rot3d rot;
pos3d pos;
}object3d;
vector3d CrossProduct(vector3d v1, vector3d v2);
int DotProduct(vector3d v1, vector3d v2);
vector3d Normalize(vector3d v);
vector3d NegVec(vector3d v);
void Init3d();
void RunScene3d(unsigned short *vram, int sn);
void Calc3d(object3d *obj);
void rotate3d (object3d *obj);
void translate3d (object3d *obj);
void project3d (object3d *obj);
void rotate3d_normals (object3d *obj);
void rotate3d_pt_normals (object3d *obj);
void CalcPointColor(object3d *obj);
void CalcPolyColor(object3d *obj);
void quicksort (int lo, int hi, int data[]);

256
env1.c Normal file
View File

@ -0,0 +1,256 @@
unsigned short env1[] = {4196,4196,4196,4196,4196,4164,4164,4164,6212,6212,6212,4132,4164,4132,4132,4132,
6212,6212,6212,6213,6212,6212,4132,6212,6213,6212,6213,6213,6213,6213,6213,8262,
8262,8262,8294,8262,8262,8262,12392,12393,12425,10344,10343,8261,6212,4131,4132,4164,
4164,4164,4163,4163,4163,4163,4163,4163,2115,2115,2115,2114,2115,2115,2147,2115,
4196,4196,4196,4196,4196,4196,6212,6212,6213,6212,6212,4132,4132,4132,4132,4132,
6180,4131,4131,4164,4132,6212,4164,6212,6213,6213,6213,8293,8261,8294,8294,8294,
10375,10376,10376,10343,10343,10343,12392,12393,12393,10343,10343,8261,4132,4132,4164,4164,
4164,4164,4163,4163,4163,4163,4163,4163,2115,2114,2147,2147,2147,2147,4195,2147,
4195,4195,4196,6244,4196,4164,6212,6212,6212,6212,4132,4132,4132,4132,6212,4164,
4132,4164,4131,4131,4131,4163,4164,6212,6245,8326,8326,8326,8326,8327,8327,10376,
10408,12457,14538,12458,12458,14506,14506,14506,14442,12425,12392,10343,6180,4131,4164,4164,
4131,4132,4164,4164,4163,4196,4164,2147,2115,2115,2147,2147,2147,2147,2147,2115,
2115,4195,4196,4196,4196,4164,6212,6212,6212,6180,6180,4132,4132,4132,6212,6212,
4163,4131,4131,4131,4163,4164,6244,6245,6278,8358,8359,8359,8359,8359,10440,12521,
14602,12490,14570,14603,14571,14538,16587,16588,18636,18636,16556,14473,8262,6180,4131,4131,
4131,4164,4164,4164,4163,4164,4196,4195,4195,4196,4195,4195,2147,2115,2147,4195,
4195,4195,4195,4163,4164,4164,4164,4164,6212,6180,4132,4164,4164,4164,6212,4164,
4163,4131,4163,4164,4164,6245,6245,6278,8326,8358,8391,8391,8359,10439,10472,14635,
16748,14667,14635,14635,14603,14603,16652,18733,18766,20782,20783,16555,12392,8261,6180,4131,
6180,4164,4163,4164,4163,4163,6244,4196,4163,4196,4195,4195,4195,4195,4195,4196,
4195,4195,4163,4163,4164,4164,4164,4132,4132,4132,4164,4132,4164,6212,6212,4164,
4164,4164,4164,6245,6277,6278,6310,6310,8358,8359,8391,10472,10439,10439,12553,14699,
16780,16780,16781,16781,16749,16717,18830,20879,20880,22961,22896,18701,16555,12393,8262,8229,
8261,8261,6180,6212,4164,4164,6212,6245,4164,4196,4195,2115,4195,4196,4195,4195,
4163,4163,4163,4164,4163,4164,4164,4164,4164,4132,4132,4164,4164,6212,6244,6244,
6244,6244,6245,6278,6278,6310,6310,6310,8391,8391,10472,10504,10504,10472,12585,16811,
16812,16812,16813,18926,18895,18862,18895,20977,23026,23026,22961,20847,18702,16555,14441,12425,
12393,10343,8261,6180,6212,6213,6212,6245,6245,4196,4163,4163,4195,4195,4195,2147,
4163,4163,4163,4163,4163,4163,4164,4132,4132,4132,4164,4164,4164,6212,6245,6278,
8326,6278,6277,8358,8359,8390,8358,8391,8391,10472,12585,12617,10504,12585,14698,16812,
16812,18893,16845,18926,18927,20976,21041,23090,23091,23058,22994,22960,18766,18669,16555,16555,
12392,10343,10343,8261,6212,6213,8262,8293,6245,6245,4196,4196,4195,2115,2115,2115,
4195,4195,4163,4163,4163,4163,4164,4164,4164,4164,4164,4164,6245,8326,8358,8391,
10440,8359,8358,8391,8423,8391,8391,8423,8391,8391,12585,12617,12585,12617,14698,16779,
18893,18925,18958,21039,18959,21073,21074,21010,23091,25172,23059,22993,20847,18734,18701,16587,
10343,10343,10343,10311,8261,6213,8294,8261,6213,6245,6244,4163,4163,4195,4195,2147,
4196,2115,4163,4163,4163,4163,4164,4164,6212,6212,6244,6277,8358,8359,8359,10440,
12553,10472,8391,8391,10504,8423,8391,8423,10472,10504,12617,14698,12617,12617,14698,16779,
18893,21006,21071,23120,21041,23187,21074,23123,23123,23091,23058,20944,20912,18831,18734,14506,
12424,14474,10344,10343,10311,8262,8262,8261,6213,6245,6212,4163,4195,2147,2115,2115,
4195,2115,2115,2115,4163,4163,4163,4164,6245,6245,8326,8359,10440,10473,10472,10472,
12553,12585,10472,10472,10504,10472,10471,10472,12585,12617,12617,14730,16811,16811,16779,16812,
18925,21038,21039,23120,23153,23155,21074,23188,23156,23091,20977,18863,18831,18831,16652,12457,
14506,12424,10344,12392,12393,10343,8261,8261,6213,6213,6212,4164,4163,4163,4195,2147,
4195,2115,2115,2147,4163,4163,4163,4196,6244,8358,10473,10473,12553,12586,12585,12585,
12585,12617,12585,12552,12585,10504,10504,10472,10472,12584,12617,14730,16843,16811,16779,16844,
18893,21039,23120,23153,23186,23154,23123,25236,25237,21043,18929,18896,18864,16783,12522,12490,
10409,10376,12425,14474,12425,12392,10343,8262,6213,6213,6212,4164,4164,4164,4196,4195,
2115,2114,2115,4195,4195,4195,2115,4196,6277,10440,12586,12586,12586,14666,14666,14666,
12617,14666,14698,12585,12584,12585,10504,10472,10472,10536,14698,16811,16811,16779,16779,16812,
18925,23087,23121,23154,23155,23155,27381,27414,23124,21075,18929,18928,18928,14701,12587,12522,
8359,10408,12458,14506,12425,12457,12424,10343,8261,6213,6213,4164,4164,4196,4196,4163,
2147,2147,2147,2115,4196,4195,2114,4196,8391,12586,14667,14667,14666,14698,16811,16811,
16778,14730,14730,14698,12585,12585,12585,10504,10472,12617,14730,16811,18892,16812,16812,18893,
21039,20975,23153,27348,27413,25269,25301,25269,23156,21075,21010,18962,16848,12620,12554,10473,
10441,12522,14538,12457,14539,14538,12425,10376,8295,8294,6245,6245,4164,4197,4196,2115,
2147,2147,4195,4195,4195,2114,2115,6310,10473,12587,14699,16779,16779,16779,18924,18956,
18924,16843,16811,16843,14730,12617,12617,14698,12585,14730,14730,14698,21005,18925,18893,21007,
23120,23121,27348,31574,33719,25301,23157,23189,25237,23124,21075,21042,14766,12619,10505,12554,
14636,14636,14603,16684,16684,16619,14571,14538,10408,8327,6246,6245,6246,6245,4164,4196,
2147,2115,2147,2147,2147,2115,4196,8391,10505,12586,14667,16779,16811,16778,16811,18924,
18956,18891,16843,16843,16843,14730,14730,16811,14698,16811,18924,16780,23087,21039,21039,25202,
25203,27348,33719,33719,33719,27350,23189,21076,23156,23156,23156,18961,14733,10538,10506,14668,
14700,14668,18830,18798,18765,18797,16716,14603,12521,10375,8326,6245,6245,6245,6245,6277,
2147,4196,4195,4195,2147,4229,8391,8424,12553,12586,14666,14699,16779,16811,16811,18924,
18956,21004,18956,16843,16843,18924,16844,18924,16844,16812,21038,21007,21040,25201,27315,29428,
27284,25236,33687,37944,33719,27414,23156,18962,21043,21076,23156,18928,14733,12619,12619,12620,
14668,18862,18863,18830,18829,18862,18829,14635,10441,10440,8359,6246,4165,6245,6277,4197,
4196,4196,4196,4196,6309,8424,12586,14668,16748,14700,14667,16779,16812,16811,16811,18923,
18956,21037,23117,21037,18956,18957,21037,18957,21038,21039,21072,23121,23121,31605,31606,29461,
27349,29526,35832,37944,33719,33752,27447,21075,21075,27350,23156,18961,14733,12653,14733,12652,
18895,21008,18863,20943,20942,20942,18861,14634,12521,10472,8359,6278,6213,6213,6278,6245,
4196,4196,4228,4228,6342,10505,14668,16749,18862,20943,20942,20973,21005,20972,18924,18924,
18956,21037,23150,25263,23183,23151,23184,23152,25265,25266,23153,23154,25268,31638,29493,27349,
29526,33719,35864,35832,33752,33784,23189,21043,23188,27382,23156,21042,18929,16848,16814,18928,
21009,18928,18895,18895,20974,18861,16747,16779,14666,12553,8359,8326,6213,6246,6278,6245,
4196,4228,4228,4229,8423,12587,14668,16749,18862,20976,23024,23055,23087,23118,23118,23118,
21037,21037,23150,25264,27377,25297,25265,27411,25299,27379,25268,25268,29526,33751,31574,29494,
31639,35832,35864,35864,33784,29494,18963,21075,25269,23124,21042,18994,18962,18961,21042,18929,
18960,21008,21008,20975,18861,16780,16812,16779,14666,10505,8359,8327,6246,6246,6246,6245,
4196,4196,4228,6309,10505,14701,18863,18896,20944,20944,22991,23056,25169,23120,23087,23118,
21070,21038,23119,23184,27410,29523,29491,27411,27412,25332,29494,27413,31639,35864,40057,35864,
35832,35832,40121,35832,29526,27382,21076,25237,23156,21076,21076,23157,21076,21076,21010,18961,
21074,23122,18959,18894,18861,18860,16812,14699,12586,10472,8392,8359,6246,6246,6246,6245,
4228,4196,4228,6310,8391,12587,16782,20977,23059,25106,23025,22992,23023,20975,21007,23087,
23120,23120,23152,25265,27411,31636,31637,25299,27413,27413,29494,29559,33752,40089,44346,40121,
40089,42201,46458,40089,31671,27414,27382,23189,21043,23156,23157,25302,27382,23156,21075,23188,
25268,21041,18894,18894,16813,16812,16779,14698,12585,10473,10472,8359,6246,6278,6246,6245,
4228,4228,4228,6310,8392,10506,12588,16782,20977,23026,22993,22992,20944,20943,21008,23121,
23121,25266,29491,27411,25267,25300,29525,31606,27413,29494,29494,31671,35832,37976,42201,44314,
40153,44346,48603,44314,31671,27382,29559,23156,21043,27382,27414,27414,23188,21076,23188,23188,
21075,18960,16846,18893,16812,16780,16779,14698,12586,10472,8391,8359,8326,6278,6246,6245,
4228,4228,4229,6310,8424,12587,14668,16782,18864,18799,20912,23026,25139,25171,25203,25171,
25203,29525,33718,29525,29493,27381,27413,33719,33751,33751,35832,35896,40089,40121,44378,46459,
44378,48603,48603,46491,35832,33784,33720,25269,27414,29527,31607,27414,23157,21075,21042,21074,
21041,18927,16846,16813,16780,14699,14666,14634,12553,10472,8359,8327,6278,6246,6245,6277,
4196,4228,4261,6343,8424,10506,14668,16750,18799,18832,20945,23026,23059,27285,29398,29462,
29461,31574,29525,27413,27413,31606,31639,33751,40089,40122,40121,42266,48539,46491,52764,52828,
52796,57021,57053,50716,44346,42233,33752,31639,29527,31639,31639,31671,25237,21043,21042,21074,
18960,18927,16846,16813,14699,14666,12553,12553,10472,10440,10440,8359,8327,6278,6246,6246,
4228,4228,4228,6343,10506,12587,14668,16750,16751,18832,20946,23027,23092,27286,25205,27350,
29495,31575,31574,29494,25301,29558,35832,37976,40089,46459,46491,48603,52828,52828,57021,59133,
57053,61246,61246,54908,57053,46491,40089,40089,33751,33784,37976,33752,23156,21075,21042,21042,
21009,18960,16846,16846,16780,14667,14634,14667,14667,12521,10473,10440,8359,8327,6246,6245,
4196,4196,4228,8423,12620,14701,14669,14702,16751,16752,18866,20979,23060,25206,25206,27318,
31543,31607,33720,33752,33719,33784,35896,42234,46426,48571,54941,54941,57021,57053,59165,61310,
61278,63358,61278,61278,59198,52796,46491,42201,37977,40089,37976,31639,23157,23123,21042,18961,
18928,21041,21008,18894,18893,16748,14667,14667,14667,12521,10440,10408,10408,8327,6245,6213,
4195,4228,6309,8423,10505,10506,12620,14702,16783,16784,18865,18898,20979,25141,27287,27351,
29463,33688,33720,33784,38009,40089,44314,46491,50684,52828,57021,61246,59198,61278,61310,65471,
63423,65503,63391,63391,63358,59166,52796,46459,40121,42201,40121,29527,25302,25269,21043,18961,
18961,23122,23155,18927,16781,14700,14667,14635,12522,14570,12521,12489,12489,8359,6246,6213,
4195,4229,6342,8424,8457,10539,12621,14702,16784,18898,18866,18866,18899,23093,27319,29463,
29463,29527,33720,35864,42202,44346,48571,52828,54941,54972,59165,61310,63390,65503,65503,65535,
65503,65503,65503,65503,65503,61278,57053,50683,44346,44314,38009,31607,31639,31607,23156,21042,
18928,18928,18928,18895,16782,16749,14668,14635,14603,14570,12489,10376,8327,8294,6213,4164,
2147,4196,6309,6343,10505,12588,14734,16815,18897,20979,23092,23092,21012,23093,25206,29463,
31575,31607,33719,33752,42202,50684,50716,54940,59165,59166,61310,63423,65503,65535,65535,65535,
65535,65535,65535,65535,65535,63358,59134,54941,48571,42202,35897,33752,35832,29527,25205,21011,
18897,18896,18896,20944,16782,14669,14668,14603,14570,12521,12456,10408,8327,8327,6245,4164,
2147,4228,6310,6343,8424,10539,14734,14734,14735,18897,21011,20979,20979,23092,25205,29462,
33720,35864,35832,37976,46427,50684,50716,54909,59165,61310,63423,65503,65535,65535,65535,65535,
65535,65535,65535,65535,65535,63390,59165,57053,50684,44314,35896,33720,33688,29463,23093,20979,
20979,18898,18897,20977,16783,16717,14669,14636,14603,14602,12489,10408,10375,8327,6246,4164,
4196,6309,8391,8424,8457,10539,12620,12621,14702,16816,18930,18897,18897,20978,23091,29430,
33752,35864,35864,40089,42234,46459,50652,57021,59198,63423,65503,65503,65535,65535,65535,65535,
65535,65535,65535,65535,65535,63423,59197,57053,52796,46427,38009,33688,31608,27351,23093,23060,
20979,20947,20946,18897,18896,16782,14637,14603,14571,16651,14538,10376,8327,8294,6246,4197,
4228,6310,8391,8425,10506,12620,12620,12621,16782,16815,18929,18896,16816,18929,23123,27349,
29526,33719,37944,37944,37976,42202,48539,54908,59198,63422,65503,65535,65535,65535,65535,65535,
65535,65535,65535,65535,65535,63423,59198,57053,50684,42234,35832,29463,27319,23094,23061,20980,
20915,18867,20947,18897,16783,16718,14604,14571,14572,16716,12489,10376,8327,8294,6246,6245,
4229,6310,6310,6311,8425,12620,12620,14701,16815,16847,18896,16815,18896,18928,21041,27348,
29526,27413,29525,35831,40089,44282,48539,52796,59134,61278,63423,65503,65535,65535,65535,65535,
65535,65535,65535,65535,65535,65503,61310,57085,48571,40057,31640,25239,21012,20980,20948,23028,
20948,18867,18834,16752,14638,14605,14604,14604,16652,16651,12456,10376,8327,8326,6245,4197,
4196,6310,8424,8425,8425,12619,12620,12653,14734,16814,16782,16782,18928,21073,23154,27347,
27380,25299,27380,33783,37976,44314,46427,50652,57021,59166,63390,65471,65535,65535,65535,65535,
65535,65535,65535,65535,65535,65503,63391,59198,52828,42170,35833,31544,25238,23061,20981,23061,
20948,18835,16753,14671,14638,14605,14604,14604,14539,12458,12456,10376,10375,8327,6245,4164,
2147,4229,6343,8425,10506,12587,12652,14733,14733,14734,16782,16814,21040,23154,23186,23153,
23153,25299,29557,35832,33783,37976,40121,46459,52764,54941,59133,61278,65503,65535,65535,65535,
65535,65535,65535,65535,65535,65503,61310,59133,57021,48572,40089,33688,27287,23093,23093,23061,
20980,20915,18834,16785,14638,14637,16718,16653,16620,14506,12425,10376,10376,8327,6246,4164,
4196,4229,6310,8392,8426,10539,12652,14766,16814,16846,16846,18959,21072,23153,23120,21072,
21040,23185,29492,31605,33751,38009,40121,44282,42233,46458,52828,57085,61310,65503,65535,65535,
65535,65535,65535,65535,65535,65503,61278,57021,54941,50684,40121,35833,29495,25205,20980,20947,
20948,20947,20947,20946,16752,16686,16718,16621,16587,14507,12424,10375,8295,8326,6245,4164,
4196,4229,6311,8392,10506,12620,14765,18959,18992,18927,18959,21040,21040,21072,23120,23153,
21040,21105,27379,29460,31573,33719,33751,35864,37976,42169,46426,50716,59166,61278,63390,65503,
65503,65535,65535,65535,65503,61278,59165,57053,52828,46459,35896,33752,31608,31544,27318,20980,
18867,18834,16753,16752,16719,16686,16685,16620,16587,16588,12425,10344,10375,8326,6245,4164,
4196,4229,6311,10506,12652,16814,16879,21072,21072,18991,18927,18959,21007,21040,23152,23153,
21072,23153,25266,25266,27380,27413,29494,33751,35800,40089,44378,48571,52828,57085,61246,61310,
63423,63423,65535,63423,61278,59166,54973,52860,52828,46426,35864,31639,31543,29431,27319,23125,
20980,18898,16785,16720,14638,14605,14572,14540,14507,16555,14473,12425,10375,8294,6245,4196,
4196,4229,6343,10538,12652,16846,18992,21072,21072,21039,18927,21039,21040,21040,23120,23185,
23153,21105,21073,21041,23122,25235,31574,33719,33655,35864,44314,46458,46491,54908,54909,59133,
61246,61246,61310,61310,59166,57053,52828,50684,48604,44346,35832,29527,27350,25238,25238,23093,
18899,18866,16785,16785,16752,16686,16621,14507,14474,12425,12393,12424,8295,8294,6245,4196,
4229,4229,6343,10538,14733,16846,18960,21072,21104,21072,21007,21007,18959,18927,21040,23120,
23120,21072,21040,18960,21041,25235,31510,31510,31542,33687,37977,37977,46426,48603,48571,54908,
54973,54973,57053,59166,57085,52828,50716,48539,44346,42201,35832,29495,25270,23093,23093,21013,
18867,18867,16786,16720,16752,16719,16654,16621,14507,12425,12425,10343,8294,8294,6245,4196,
4229,4230,6343,10506,14733,16846,18960,21072,21105,21072,18959,18927,18894,18926,21039,21007,
21007,21008,18960,21040,23122,25203,27285,29398,31478,33623,33655,35768,40089,40057,42202,48539,
48571,48635,52796,52828,54908,50683,50716,44378,42233,35896,31607,29463,25238,23126,23094,20948,
18835,18802,16754,16720,14639,16654,16621,16621,16556,14475,12425,10343,8294,6245,6245,4196,
4195,4229,6311,8425,12652,14766,16879,18959,21040,21039,18927,18894,16846,16846,18927,18927,
16846,18894,18959,23089,23122,25172,27221,29269,31414,31479,31511,37880,33655,31575,33719,37976,
42202,44314,50651,48539,48571,52796,44314,40122,35896,31608,25237,25270,27351,25174,25142,23030,
18835,16722,14641,14640,14607,16622,14541,16556,14475,14474,12424,10343,8294,6244,4196,4196,
4228,4229,6310,8392,10506,10539,14701,16846,18959,18959,18926,18926,16814,14733,16814,16813,
16814,18927,21008,21009,25139,27220,29269,31350,33463,29302,33559,35768,31575,31607,31607,33784,
37944,40089,42233,48571,48571,50716,42266,40089,35896,29495,27350,21044,23061,25174,23062,20949,
18836,16723,14609,16657,16655,16622,14541,14508,14475,12425,10343,8294,6245,6212,6244,4196,
6309,4229,4229,4230,8392,10538,12652,14734,16846,16846,16846,16846,14733,14733,16814,14701,
18895,18928,20976,20977,25107,29237,31318,37656,33463,29205,31383,29398,27318,27382,25269,31639,
33784,33751,40089,46458,48603,48571,46459,40089,38009,33720,25302,23093,18899,20948,23029,18836,
16723,16723,16690,16689,16656,16623,16589,14476,14474,10344,10343,8326,6245,4164,4196,4196,
4228,4229,4229,4197,8425,12620,14701,12652,14733,16846,16846,16813,14733,16846,16781,14701,
16814,16782,16815,20944,27155,31318,35479,35511,31286,29205,29270,27253,23092,25173,25269,33720,
31639,31639,38009,40121,40121,37976,42202,38009,35864,37945,29463,23093,20947,16754,16723,18803,
16658,14545,16690,18738,18737,18704,18670,16556,14474,10344,10343,8326,6244,4164,4196,4196,
4195,4196,4196,4229,6311,10506,10539,12587,14701,14766,16846,16814,16814,16814,16814,16781,
14733,16750,16783,20912,27123,31286,35415,31221,29108,29205,29270,25108,25205,25238,29462,31639,
29559,31639,35896,38009,37945,29559,37944,35896,29527,33719,29463,20979,18898,18802,14609,16657,
16657,14577,16624,18737,20817,18703,18638,16557,14475,10376,10375,6245,4164,4164,4196,4195,
4195,2147,4196,4197,4230,6343,8425,12619,14701,14733,16814,14766,16814,16814,16814,16782,
16782,16750,18799,20880,25010,31221,31189,29141,29141,29173,25075,23027,25173,27350,27382,31575,
31607,27382,35864,37976,35896,31607,31671,33719,25269,25237,25269,23092,18898,18833,14608,12495,
12495,14543,16624,16623,18671,18703,18638,16589,14506,10376,8326,6245,4195,4164,4195,2115,
2147,4195,4196,4229,6278,6310,8392,10506,10539,14733,16814,14733,14734,14734,14734,16782,
16782,14669,16718,20847,24977,29140,29108,31221,33335,27125,22994,20945,23124,29431,25270,29494,
29526,25269,31639,40089,35896,29494,25301,29494,23156,21009,23090,23123,18897,18800,16687,14542,
12429,12429,14509,16590,16589,16589,20751,16588,10345,8327,6245,4196,4163,4163,4195,4195,
2115,2147,4196,4228,4229,6278,6311,8424,10538,12652,14733,14701,12652,12653,14734,16782,
16782,14637,16718,22961,27091,27060,27059,29173,29206,22994,20880,20945,20977,23091,23124,25269,
25269,23189,27414,33783,37976,29526,23123,25236,25203,23090,20976,21009,20977,18831,16751,16686,
14541,12459,10378,12426,14508,14508,16588,14539,12425,8327,6245,4196,4163,4196,4196,4195,
4195,4196,4195,2148,4228,4229,6278,6311,8425,10506,10507,12619,12652,12620,14701,16782,
18863,16751,20913,22994,25043,25011,25010,25043,25042,18832,18831,18896,16815,18928,18961,23124,
23124,23124,25301,29493,33719,33687,27348,25267,27348,25202,23056,21008,20976,18863,16750,16685,
14604,12459,10377,10377,10377,12458,14507,12457,10408,8326,6245,4196,4196,4196,4196,4195,
4196,4196,4196,4196,4228,4229,4229,6310,6311,8392,8425,10506,14700,14701,12620,14702,
16750,18864,23026,22994,22962,25042,20881,20880,18799,18830,18864,18896,16815,16815,16848,21043,
23123,21010,23156,29461,31574,31541,27315,23153,23121,23120,21007,20974,18862,20942,16749,14635,
12523,12490,10377,10376,10376,10343,10376,10408,8326,6245,6245,4196,4228,4228,4228,4196,
4228,4228,4228,4228,4228,4228,4228,4196,4229,6311,8392,10506,12620,12620,10506,10538,
14700,18896,20978,20946,20945,20945,18832,18831,16750,18863,18897,18896,16814,16782,18896,21043,
21010,20977,23123,27349,31541,27315,23121,20975,20974,20974,20974,16812,16780,18893,16780,14602,
12522,12522,10409,8327,8327,8327,8326,8327,8326,6245,4196,4228,4229,4229,4228,4228,
4229,4228,4196,4196,4228,4228,4228,4228,4229,6309,8391,8424,8392,8425,8424,10506,
14734,16815,18896,18864,20944,18864,18831,18830,18863,16750,18863,20977,16815,16815,18896,20977,
20977,20977,25171,27316,27348,27315,23120,18894,20974,18925,18860,16779,14699,14699,16779,12586,
10473,10440,8328,8327,8294,8326,8326,6278,6277,6277,4228,4196,4196,4228,4228,4228,
4228,4228,4228,4228,4228,4228,4228,4228,4228,4228,4229,4229,4229,6310,6343,12619,
16815,18896,18896,18831,18831,18831,16782,16782,18863,16750,16782,20978,18897,18831,18831,20944,
20945,20977,23025,27251,27315,25169,23088,20974,18860,18892,16779,14699,12586,12585,12586,12586,
8392,8327,6279,8326,6278,8326,8326,6277,6277,6277,4229,4228,4195,2147,4196,4228,
4196,4196,4195,4195,4227,4195,4195,4195,2147,2147,2147,4195,4229,6310,8392,14700,
16782,16815,18864,18863,16782,16749,16749,16717,16750,14637,16749,20912,18864,18799,20847,20912,
20880,20912,20944,25137,27218,23056,20975,18861,16779,16811,14698,14666,12585,10472,10440,10440,
8359,6246,6246,6246,6245,6245,6278,6277,6277,6277,4229,4228,4195,2115,2147,4196,
2115,2115,4195,4195,4195,2147,2114,2114,2114,2115,4195,2147,4195,6310,8392,12587,
14668,16749,16750,16750,16717,14636,14636,16717,16717,14604,14604,16685,18766,18799,20847,20847,
20847,20847,20879,23024,25104,20942,18861,16780,16779,14731,14666,12585,12585,10472,8391,8359,
8359,6246,6213,4165,4164,4196,6277,6277,6277,4228,4228,4228,2147,2147,4195,4195,
4195,2147,4196,4196,4196,2115,2114,2114,2115,2115,4163,4196,4195,4196,6278,8392,
12554,12555,14635,14604,14571,12522,14571,18765,18766,16685,16620,16652,16620,18701,18734,20815,
20815,20814,20814,22959,22991,20910,16748,16747,14699,14698,14698,12553,10505,10472,8359,6279,
6278,6278,4165,4132,4164,4196,6277,6277,4229,4228,4228,2147,2147,2115,4195,4196,
4163,4163,4163,4163,4163,4163,4163,4163,4163,4163,4163,4163,4196,4196,6244,6278,
8359,10408,10409,12490,12457,12456,14538,16652,16621,18701,18669,18668,16588,18636,18669,20750,
18701,18701,18701,20813,18797,18796,14635,14667,14634,12618,14666,10472,8392,8392,8359,6278,
6246,4197,4165,4165,4164,4196,4229,4229,4228,4196,4195,4195,2147,2115,4196,4228,
4163,4163,4163,4163,4163,4163,4163,4164,4164,4163,4163,4164,6244,6212,6245,6245,
6246,8294,10375,10376,10375,10375,12425,16555,16588,16555,14475,16555,16555,16555,18636,18637,
18636,16588,16587,16652,16652,14602,12521,14634,12554,10505,12553,10440,8359,8359,8359,6246,
4165,4165,4197,4197,4196,4164,4196,4196,4228,4196,4195,4196,4195,4196,4196,4196,
4164,4164,4164,4164,4163,4163,4164,4164,4164,4164,4164,4164,6212,6245,6245,6245,
6212,6213,8294,8294,10343,10343,12392,14474,16555,14474,14441,14474,14474,16523,16555,16555,
16555,16555,14506,14538,14538,12489,12489,14634,12553,10440,10440,8359,6278,6278,6246,4165,
4164,4164,4164,4196,4196,4196,2147,2147,4196,4195,4195,4195,4195,4196,4196,2147,
4164,4164,4164,4164,4164,4164,4164,4164,4164,4132,4164,6212,4164,6212,6245,6212,
6212,6212,6212,6213,8261,8261,10342,12392,12425,12393,14473,14473,12393,12393,14473,14474,
12425,12457,12457,10408,10408,10376,10440,10440,8359,8359,8326,6246,6278,6246,4165,4164,
4164,4164,4164,4196,4196,4196,2115,2147,4195,2147,2147,2147,2147,4195,2147,2115,
4164,4131,4164,4164,6212,6212,6212,4164,4164,4132,6212,6212,6212,4132,6212,4132,
4132,4132,6212,6180,4131,6180,6213,8262,10343,10343,12392,12392,10343,10343,12392,12424,
10344,10376,10375,8294,8326,8326,8327,8326,6246,4165,4165,6245,6278,4197,4164,4164,
4164,4164,4196,4196,4228,4196,4196,4196,4195,2147,2147,2115,2147,4195,2147,2115,
4132,4132,6180,6212,6180,6180,6212,6213,6212,6212,6212,6212,6180,4132,4132,4132,
6180,6180,6180,6180,4132,6180,6212,8261,8261,6213,6213,6212,6213,8262,8294,8294,
8294,8294,8294,8326,8294,6246,6278,6278,6245,4197,4197,4197,4197,4164,4164,4196,
4196,4196,4196,4196,4196,4196,4196,4195,2147,2147,2147,2147,2115,2147,2147,2147};

256
env2.c Normal file
View File

@ -0,0 +1,256 @@
unsigned short env2[] = {0,0,0,0,0,0,0,0,0,0,0,0,2048,2048,4096,4096,
4096,4096,6144,6144,6144,8192,8192,8192,8192,8192,8192,8192,10240,10240,10240,10240,
10240,10240,10240,10240,10240,10240,8192,8192,8192,8192,8192,8192,6144,6144,6144,6144,
4096,4096,4096,2048,2048,2048,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,2048,2048,2048,4096,4096,4096,
6144,6144,6144,8192,8192,8192,8192,10240,10240,10240,10240,10240,10240,10240,10240,10240,
10240,10240,10240,10240,10240,10240,10240,10240,10240,10240,8192,8192,8192,8192,6144,6144,
6144,6144,4096,4096,4096,2048,2048,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,2048,2048,4096,4096,4096,6144,6144,
6144,8192,8192,8192,8192,10240,10240,10240,10240,10240,12288,12288,12288,12288,12288,12288,
12288,12288,12288,12288,12288,12288,12288,12288,10240,10240,10240,10240,10240,8192,8192,8192,
6144,6144,6144,4096,4096,4096,2048,2048,2048,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,2048,2048,4096,4096,6144,6144,6144,8192,
8192,8192,10240,10240,10240,10240,12288,12288,12288,12288,12288,12288,14336,14336,14336,14336,
14336,14336,14336,14336,14336,12288,12288,12288,12288,12288,12288,10240,10240,10240,10240,8192,
8192,8192,6144,6144,6144,4096,4096,2048,2048,2048,0,0,0,0,0,0,
0,0,0,0,0,0,0,2048,2048,4096,4096,6144,6144,6144,8192,8192,
8192,10240,10240,10240,12288,12288,12288,12288,14336,14336,14336,14336,14336,14336,14336,14336,
14336,14336,14336,14336,14336,14336,14336,14336,14336,12288,12288,12288,12288,10240,10240,10240,
10240,8192,8192,8192,6144,6144,4096,4096,2048,2048,2048,0,0,0,0,0,
0,0,0,0,0,0,2048,2048,4096,4096,6144,6144,8192,8192,8192,10240,
10240,10240,12288,12288,12288,14336,14336,14336,14336,14336,16384,16384,16384,16384,16384,16384,
16384,16384,16384,16384,16384,16384,16384,14336,14336,14336,14336,14336,12288,12288,12288,10240,
10240,10240,8192,8192,8192,6144,6144,4096,4096,4096,2048,2048,0,0,0,0,
0,0,0,0,0,2048,2048,4096,4096,6144,6144,8192,8192,8192,10240,10240,
12288,12288,12288,14336,14336,14336,14336,16384,16384,16384,16384,16384,16384,16384,18432,18432,
18432,18432,18432,18432,16384,16384,16384,16384,16384,16384,14336,14336,14336,14336,12288,12288,
12288,10240,10240,10240,8192,8192,6144,6144,4096,4096,4096,2048,2048,0,0,0,
0,0,0,0,2048,2048,4096,4096,6144,6144,8192,8192,10240,10240,10240,12288,
12288,12288,14336,14336,14336,16384,16384,16384,16384,18432,18432,18432,18432,18432,18432,18432,
18432,18432,18432,18432,18432,18432,18432,18432,16384,16384,16384,16384,14336,14336,14336,14336,
12288,12288,12288,10240,10240,8192,8192,6144,6144,4096,4096,2048,2048,2048,0,0,
0,0,0,2048,2048,4096,4096,6144,6144,8192,8192,10240,10240,10240,12288,12288,
14336,14336,14336,16384,16384,16384,18432,18432,18432,18432,18432,20480,20480,20480,20480,20480,
20480,20480,20480,20480,20480,20480,18432,18432,18432,18432,18432,16384,16384,16384,14336,14336,
14336,12288,12288,12288,10240,10240,8192,8192,6144,6144,4096,4096,2048,2048,0,0,
0,0,2048,2048,4096,4096,6144,6144,8192,8192,10240,10240,10240,12288,12288,14336,
14336,16384,16384,16384,18432,18432,18432,18432,20480,20480,20480,20480,20480,20480,22528,22528,
22528,22528,22528,20480,20480,20480,20480,20480,20480,18432,18432,18432,18432,16384,16384,16384,
14336,14336,14336,12288,12288,10240,10240,8192,8192,6144,6144,4096,4096,2048,2048,0,
0,0,2048,2048,4096,6144,6144,8192,8192,10240,10240,12288,12288,12288,14336,14336,
16384,16384,16384,18432,18432,18432,20480,20480,20480,22528,22528,22528,22528,24576,24576,24576,
24576,24576,24576,24576,22528,22528,22528,22528,20480,20480,20480,20480,18432,18432,18432,16384,
16384,14336,14336,14336,12288,12288,10240,10240,8192,8192,6144,6144,4096,4096,2048,2048,
2048,2048,2048,4096,4096,6144,6144,8192,8192,10240,10240,12288,12288,14336,14336,16384,
16384,18432,18432,18432,20480,20480,20480,22528,22528,24576,24576,26624,26624,26624,28672,28672,
28672,28672,28672,28672,26624,26624,24576,24576,22528,22528,20480,20480,20480,18432,18432,18432,
16384,16384,14336,14336,14336,12288,12288,10240,10240,8192,8192,6144,6144,4096,4096,2048,
2048,2048,4096,4096,6144,6144,8192,8192,10240,10240,12288,12288,14336,14336,16384,16384,
18432,18432,20480,20480,20480,22528,22528,24576,24576,26624,28672,30720,30720,32768,32768,32768,
32768,32768,32768,32768,30720,30720,28672,28672,26624,24576,22528,22528,20480,20480,20480,18432,
18432,16384,16384,16384,14336,14336,12288,12288,10240,10240,8192,8192,6144,4096,4096,2048,
2048,2048,4096,6144,6144,8192,8192,10240,10240,12288,12288,14336,14336,16384,16384,18432,
18432,20480,20480,20480,22528,24576,26624,28672,30720,30720,32768,34816,36864,36864,36864,38912,
38912,38912,36864,36864,36864,34816,32768,32768,30720,28672,26624,24576,22528,20480,20480,20480,
18432,18432,16384,16384,14336,14336,14336,12288,12288,10240,8192,8192,6144,6144,4096,4096,
4096,4096,4096,6144,8192,8192,10240,10240,12288,12288,14336,14336,16384,16384,18432,18432,
20480,20480,22528,22528,24576,26624,28672,32768,34816,36864,36864,38912,40960,40960,43008,43008,
43008,43008,43008,40960,40960,38912,38912,36864,34816,32768,30720,28672,24576,22528,22528,20480,
20480,18432,18432,16384,16384,14336,14336,12288,12288,10240,10240,8192,8192,6144,6144,4096,
4096,4096,6144,6144,8192,8192,10240,12288,12288,14336,14336,16384,16384,18432,18432,20480,
20480,22528,22528,24576,28672,30720,32768,36864,38912,40960,43008,43008,45088,45088,47136,47168,
47168,47168,47136,45088,45088,43008,43008,40960,38912,36864,34816,32768,28672,26624,24576,22528,
20480,20480,18432,18432,16384,16384,14336,14336,12288,12288,10240,10240,8192,6144,6144,4096,
4096,4096,6144,8192,8192,10240,10240,12288,12288,14336,14336,16384,18432,18432,20480,20480,
22528,22528,26624,28672,32768,34816,36864,40960,43008,45056,45088,47168,49248,49280,49312,49313,
49345,49345,49313,49280,49248,47168,47136,45056,43008,40960,38912,34816,32768,28672,26624,24576,
22528,20480,20480,18432,18432,16384,16384,14336,14336,12288,10240,10240,8192,8192,6144,6144,
4096,6144,6144,8192,8192,10240,12288,12288,14336,14336,16384,16384,18432,18432,20480,20480,
22528,26624,28672,32768,34816,38912,40960,43008,47136,47168,49280,49345,51457,51489,51521,51553,
53601,51553,51521,51489,51457,49377,49312,47200,47136,45056,43008,38912,36864,32768,30720,26624,
24576,22528,20480,20480,18432,18432,16384,14336,14336,12288,12288,10240,10240,8192,6144,6144,
6144,6144,8192,8192,10240,10240,12288,12288,14336,16384,16384,18432,18432,20480,20480,22528,
24576,28672,32768,34816,38912,43008,45056,47168,49280,49345,51489,51554,53666,53698,55778,55778,
55810,55810,55778,53698,53666,53602,51489,51425,49312,47168,45088,43008,38912,36864,32768,28672,
26624,22528,20480,20480,18432,18432,16384,16384,14336,14336,12288,10240,10240,8192,8192,6144,
6144,6144,8192,8192,10240,12288,12288,14336,14336,16384,16384,18432,20480,20480,22528,24576,
28672,30720,34816,38912,43008,45056,47168,49312,51457,53601,53666,55778,55843,55875,57955,57955,
57955,57955,57955,55875,55843,55810,53698,53634,51489,49345,47200,45088,43008,38912,36864,32768,
28672,24576,22528,20480,20480,18432,18432,16384,14336,14336,12288,12288,10240,10240,8192,6144,
6144,6144,8192,10240,10240,12288,12288,14336,16384,16384,18432,18432,20480,20480,22528,26624,
30720,34816,38912,40960,45056,47200,49345,51489,53634,55778,55843,55907,57987,58019,58052,58052,
58084,58084,58052,58051,58019,57955,55875,55810,53666,51521,49377,49280,45088,43008,38912,34816,
32768,28672,24576,22528,20480,20480,18432,16384,16384,14336,14336,12288,10240,10240,8192,8192,
6144,8192,8192,10240,10240,12288,14336,14336,16384,16384,18432,20480,20480,22528,24576,28672,
32768,36864,40960,45056,47168,49345,51489,53666,55810,55875,57987,58051,60132,60164,60196,60228,
60228,60228,60196,60196,60164,58052,58019,57955,55843,53698,51521,49377,47200,45088,43008,38912,
34816,30720,26624,22528,20480,20480,18432,18432,16384,14336,14336,12288,12288,10240,8192,8192,
6144,8192,8192,10240,12288,12288,14336,16384,16384,18432,18432,20480,22528,22528,26624,30720,
34816,38912,43008,47136,49312,51489,53666,55810,57955,58019,60132,60196,60228,62308,62341,62373,
62373,62373,62341,62341,60228,60196,60132,58051,57955,55843,53698,51521,49345,47168,45056,40960,
36864,32768,28672,24576,22528,20480,18432,18432,16384,16384,14336,12288,12288,10240,10240,8192,
8192,8192,10240,10240,12288,12288,14336,16384,16384,18432,20480,20480,22528,24576,28672,32768,
36864,40960,45056,49248,51457,53634,55810,55907,58019,60132,60196,62308,62373,62405,64485,64517,
64517,64517,64517,62437,62373,62341,60228,60164,58052,57955,55843,53666,51489,49312,47136,43008,
38912,34816,30720,26624,22528,20480,20480,18432,16384,16384,14336,14336,12288,10240,10240,8192,
8192,8192,10240,10240,12288,14336,14336,16384,18432,18432,20480,20480,22528,26624,30720,34816,
38912,43008,47168,49345,51521,53698,55875,58019,60132,60228,62341,62405,64517,64581,64645,64677,
64709,64709,64645,64581,64517,62405,62373,60228,60164,58051,57955,55810,53634,51425,47200,45056,
40960,36864,32768,28672,24576,22528,20480,18432,18432,16384,14336,14336,12288,12288,10240,8192,
8192,8192,10240,10240,12288,14336,14336,16384,18432,18432,20480,22528,24576,28672,32768,36864,
40960,45088,49248,51457,53666,55843,57987,58084,60196,62341,62405,64549,64645,64741,64836,64900,
64932,64932,64868,64773,64677,64581,62437,62373,60228,60132,58019,55875,53698,51489,49312,47136,
43008,38912,32768,28672,24576,22528,20480,18432,18432,16384,16384,14336,12288,12288,10240,8192,
8192,8192,10240,12288,12288,14336,16384,16384,18432,18432,20480,22528,24576,28672,32768,38912,
43008,47136,49312,51521,53730,55875,58019,60164,62308,62405,64549,64677,64805,64964,65059,65123,
65155,65155,65091,64996,64836,64709,64581,62405,62341,60196,58052,57955,55810,53602,49377,47168,
43008,38912,34816,30720,26624,22528,20480,20480,18432,16384,16384,14336,12288,12288,10240,10240,
8192,8192,10240,12288,12288,14336,16384,16384,18432,20480,20480,22528,26624,30720,34816,38912,
43008,47168,49377,53634,55810,57955,58084,60228,62373,64485,64613,64805,64964,65155,65251,65316,
65316,65316,65283,65187,65028,64836,64677,64517,62373,60228,60164,58019,55843,53666,51457,49248,
45088,40960,36864,30720,26624,22528,20480,20480,18432,16384,16384,14336,14336,12288,10240,10240,
8192,8192,10240,12288,12288,14336,16384,16384,18432,20480,20480,22528,26624,30720,34816,40960,
45088,47200,51457,53666,55843,58019,60164,60260,62405,64549,64741,64932,65123,65283,65381,63335,
63368,63367,63333,65315,65187,64996,64773,64581,62437,62341,60196,58051,55875,53698,51489,49280,
45088,40960,36864,32768,28672,24576,20480,20480,18432,18432,16384,14336,14336,12288,10240,10240,
8192,10240,10240,12288,12288,14336,16384,16384,18432,20480,20480,22528,26624,30720,36864,40960,
45088,49280,51489,53698,55875,58019,60164,62308,62437,64613,64805,65028,65219,65348,63368,65420,
65422,65421,65418,63333,65283,65091,64868,64645,64517,62341,60196,58052,57955,55778,51521,49313,
47136,43008,36864,32768,28672,24576,22528,20480,18432,18432,16384,14336,14336,12288,10240,10240,
8192,10240,10240,12288,14336,14336,16384,16384,18432,20480,20480,22528,26624,32768,36864,40960,
45088,49280,51489,53698,55875,58051,60196,62341,64485,64645,64836,65091,65283,63334,65419,65424,
65427,65426,65421,63367,65316,65155,64932,64709,64517,62373,60228,58084,57955,55810,51553,49345,
47168,43008,38912,32768,28672,24576,22528,20480,18432,18432,16384,14336,14336,12288,10240,10240,
8192,10240,10240,12288,14336,14336,16384,16384,18432,20480,20480,24576,26624,32768,36864,40960,
45088,49280,51489,53698,55875,58051,60196,62341,64485,64645,64868,65091,65283,63334,65420,65425,
65460,65427,65422,63368,65316,65155,64932,64709,64517,62373,60228,58084,57955,55810,53601,49345,
47168,43008,38912,32768,28672,24576,22528,20480,18432,18432,16384,14336,14336,12288,10240,10240,
8192,10240,10240,12288,12288,14336,16384,16384,18432,20480,20480,22528,26624,32768,36864,40960,
45088,49280,51489,53698,55875,58019,60196,62341,64485,64613,64836,65059,65251,63333,65419,65423,
65425,65424,65420,63335,65316,65123,64900,64677,64517,62373,60228,58052,57955,55778,51553,49313,
47168,43008,38912,32768,28672,24576,22528,20480,18432,18432,16384,14336,14336,12288,10240,10240,
8192,10240,10240,12288,12288,14336,16384,16384,18432,20480,20480,22528,26624,30720,36864,40960,
45088,49280,51489,53698,55875,58019,60164,62308,62405,64581,64773,64996,65187,65348,63335,65419,
65420,65419,63368,65381,65251,65059,64836,64645,64485,62341,60196,58052,57955,55778,51521,49312,
47136,43008,36864,32768,28672,24576,22528,20480,18432,18432,16384,14336,14336,12288,10240,10240,
8192,8192,10240,12288,12288,14336,16384,16384,18432,20480,20480,22528,26624,30720,34816,40960,
45056,47200,51425,53666,55843,57987,60132,60228,62373,64549,64709,64900,65091,65251,65348,63333,
63334,63334,65348,65283,65155,64964,64741,64581,62405,62308,60164,58019,55875,53698,51489,49280,
45088,40960,36864,32768,26624,24576,20480,20480,18432,16384,16384,14336,14336,12288,10240,10240,
8192,8192,10240,12288,12288,14336,16384,16384,18432,20480,20480,22528,24576,30720,34816,38912,
43008,47168,49345,53602,55810,57955,58052,60196,62341,62437,64581,64741,64932,65091,65187,65251,
65283,65283,65219,65123,64964,64805,64645,64517,62373,60228,60132,57987,55843,53666,51457,49248,
45088,40960,36864,30720,26624,22528,20480,20480,18432,16384,16384,14336,14336,12288,10240,10240,
8192,8192,10240,12288,12288,14336,14336,16384,18432,18432,20480,22528,24576,28672,32768,36864,
43008,45088,49280,51489,53698,55875,58019,60164,60260,62373,64517,64613,64741,64900,64996,65059,
65091,65091,65028,64932,64805,64677,64549,62405,62308,60196,58051,55907,55778,51554,49345,47168,
43008,38912,34816,30720,26624,22528,20480,20480,18432,16384,16384,14336,12288,12288,10240,8192,
8192,8192,10240,10240,12288,14336,14336,16384,18432,18432,20480,22528,24576,26624,32768,36864,
40960,45056,47200,51425,53634,55810,57955,58052,60196,62308,62373,64517,64581,64709,64773,64836,
64868,64836,64805,64741,64613,64549,62405,62341,60196,60132,57987,55843,53666,51489,49280,45088,
43008,36864,32768,28672,24576,22528,20480,18432,18432,16384,16384,14336,12288,12288,10240,8192,
8192,8192,10240,10240,12288,14336,14336,16384,16384,18432,20480,20480,22528,26624,30720,34816,
38912,43008,47136,49313,51521,53698,55843,57987,58084,60196,62308,62373,62437,64549,64581,64613,
64645,64645,64613,64549,64485,62405,62341,60228,60132,58019,55875,55778,53601,49345,47168,45056,
40960,36864,30720,26624,24576,22528,20480,18432,18432,16384,14336,14336,12288,10240,10240,8192,
8192,8192,10240,10240,12288,12288,14336,16384,16384,18432,18432,20480,22528,24576,28672,32768,
36864,40960,45056,47200,51425,53602,53730,55875,57987,58084,60196,60260,62341,62373,62405,64485,
64485,64485,62437,62405,62373,62308,60196,60132,58019,57955,55810,53634,51457,49280,47136,43008,
38912,34816,30720,24576,22528,20480,20480,18432,16384,16384,14336,14336,12288,10240,10240,8192,
6144,8192,8192,10240,12288,12288,14336,14336,16384,18432,18432,20480,20480,22528,26624,30720,
34816,38912,43008,47136,49280,51457,53634,55778,55875,57987,58052,60164,60196,60228,62308,62341,
62341,62341,62308,60260,60228,60164,58084,58019,55907,55810,53666,51489,49312,47168,43008,40960,
36864,32768,28672,24576,22528,20480,18432,18432,16384,16384,14336,12288,12288,10240,10240,8192,
6144,8192,8192,10240,10240,12288,14336,14336,16384,16384,18432,20480,20480,22528,24576,28672,
32768,36864,40960,43008,47168,49312,51457,53634,53730,55843,57955,58019,58052,60132,60164,60196,
60196,60196,60164,60164,58084,58019,57987,55875,55810,53666,51489,49345,47168,45056,40960,36864,
32768,28672,26624,22528,20480,20480,18432,18432,16384,14336,14336,12288,12288,10240,8192,8192,
6144,6144,8192,10240,10240,12288,12288,14336,16384,16384,18432,18432,20480,20480,22528,26624,
30720,32768,36864,40960,45056,47168,49312,51457,53602,53698,55810,55875,57955,57987,58019,58019,
58051,58051,58019,58019,57955,55875,55843,53698,53634,51489,49345,47200,45056,43008,38912,34816,
30720,26624,24576,22528,20480,18432,18432,16384,16384,14336,14336,12288,10240,10240,8192,8192,
6144,6144,8192,8192,10240,12288,12288,14336,14336,16384,16384,18432,20480,20480,22528,24576,
26624,30720,34816,36864,40960,45056,47168,49280,51425,51521,53634,53698,55810,55843,55875,55875,
55875,55875,55875,55843,55810,53730,53666,51521,51457,49312,47168,45056,43008,38912,34816,32768,
28672,24576,22528,20480,20480,18432,18432,16384,14336,14336,12288,12288,10240,8192,8192,6144,
6144,6144,6144,8192,10240,10240,12288,12288,14336,16384,16384,18432,18432,20480,20480,22528,
24576,26624,30720,34816,36864,40960,43008,47136,47200,49313,51425,51489,53602,53666,53698,53698,
53698,53698,53698,53666,53634,51521,51457,49345,49248,47136,45056,40960,38912,34816,32768,28672,
24576,22528,20480,20480,18432,18432,16384,16384,14336,14336,12288,10240,10240,8192,8192,6144,
4096,6144,6144,8192,8192,10240,12288,12288,14336,14336,16384,16384,18432,18432,20480,20480,
22528,24576,28672,30720,34816,36864,40960,43008,45056,47136,47200,49280,49345,51425,51489,51489,
51489,51489,51489,51457,49377,49312,49248,47168,45056,43008,40960,38912,34816,32768,28672,26624,
22528,22528,20480,20480,18432,16384,16384,14336,14336,12288,12288,10240,10240,8192,6144,6144,
4096,4096,6144,8192,8192,10240,10240,12288,12288,14336,14336,16384,16384,18432,18432,20480,
20480,22528,24576,26624,30720,32768,36864,38912,40960,43008,45056,45088,47168,47200,49280,49280,
49280,49280,49280,47200,47168,47136,45088,43008,40960,38912,36864,34816,30720,28672,26624,22528,
22528,20480,20480,18432,18432,16384,16384,14336,12288,12288,10240,10240,8192,8192,6144,4096,
4096,4096,6144,6144,8192,8192,10240,10240,12288,12288,14336,14336,16384,16384,18432,18432,
20480,20480,22528,24576,26624,30720,32768,34816,36864,38912,40960,43008,43008,45056,45088,45088,
45088,45088,45088,45088,43008,43008,40960,38912,36864,34816,32768,30720,28672,24576,22528,22528,
20480,20480,18432,18432,16384,16384,14336,14336,12288,12288,10240,8192,8192,6144,6144,4096,
2048,4096,4096,6144,6144,8192,8192,10240,12288,12288,14336,14336,16384,16384,18432,18432,
18432,20480,20480,22528,24576,26624,28672,30720,32768,34816,36864,36864,38912,40960,40960,40960,
40960,40960,40960,40960,38912,38912,36864,34816,32768,30720,28672,26624,24576,22528,20480,20480,
20480,18432,18432,16384,16384,14336,14336,12288,12288,10240,10240,8192,8192,6144,4096,4096,
2048,2048,4096,4096,6144,8192,8192,10240,10240,12288,12288,14336,14336,16384,16384,18432,
18432,18432,20480,20480,22528,22528,24576,26624,28672,30720,32768,32768,34816,34816,36864,36864,
36864,36864,36864,34816,34816,32768,32768,30720,28672,26624,24576,22528,22528,20480,20480,20480,
18432,18432,16384,16384,14336,14336,12288,12288,10240,10240,8192,8192,6144,6144,4096,4096,
2048,2048,4096,4096,6144,6144,8192,8192,10240,10240,12288,12288,14336,14336,16384,16384,
16384,18432,18432,20480,20480,20480,22528,22528,24576,26624,26624,28672,30720,30720,30720,32768,
32768,32768,30720,30720,30720,28672,28672,26624,24576,22528,22528,20480,20480,20480,18432,18432,
18432,16384,16384,14336,14336,12288,12288,10240,10240,8192,8192,6144,6144,4096,4096,2048,
2048,2048,2048,4096,4096,6144,6144,8192,8192,10240,10240,12288,12288,14336,14336,16384,
16384,16384,18432,18432,20480,20480,20480,20480,22528,22528,24576,24576,24576,26624,26624,26624,
26624,26624,26624,26624,26624,24576,24576,22528,22528,22528,20480,20480,20480,18432,18432,18432,
16384,16384,14336,14336,12288,12288,10240,10240,10240,8192,8192,6144,6144,4096,2048,2048,
0,0,2048,2048,4096,4096,6144,6144,8192,8192,10240,10240,12288,12288,14336,14336,
14336,16384,16384,18432,18432,18432,20480,20480,20480,20480,22528,22528,22528,22528,22528,22528,
24576,22528,22528,22528,22528,22528,22528,20480,20480,20480,20480,18432,18432,18432,16384,16384,
16384,14336,14336,12288,12288,12288,10240,10240,8192,8192,6144,6144,4096,4096,2048,0,
0,0,2048,2048,4096,4096,6144,6144,8192,8192,8192,10240,10240,12288,12288,14336,
14336,14336,16384,16384,16384,18432,18432,18432,18432,20480,20480,20480,20480,20480,20480,20480,
20480,20480,20480,20480,20480,20480,20480,20480,20480,18432,18432,18432,16384,16384,16384,14336,
14336,14336,12288,12288,10240,10240,10240,8192,8192,6144,6144,4096,4096,2048,2048,0,
0,0,0,2048,2048,4096,4096,6144,6144,8192,8192,8192,10240,10240,12288,12288,
12288,14336,14336,16384,16384,16384,16384,18432,18432,18432,18432,18432,20480,20480,20480,20480,
20480,20480,20480,20480,20480,18432,18432,18432,18432,18432,16384,16384,16384,16384,14336,14336,
14336,12288,12288,10240,10240,10240,8192,8192,6144,6144,4096,4096,2048,2048,0,0,
0,0,0,0,2048,2048,4096,4096,6144,6144,8192,8192,8192,10240,10240,12288,
12288,12288,14336,14336,14336,16384,16384,16384,16384,16384,18432,18432,18432,18432,18432,18432,
18432,18432,18432,18432,18432,18432,18432,18432,16384,16384,16384,16384,14336,14336,14336,12288,
12288,12288,10240,10240,8192,8192,8192,6144,6144,4096,4096,2048,2048,0,0,0,
0,0,0,0,0,2048,2048,4096,4096,6144,6144,6144,8192,8192,10240,10240,
10240,12288,12288,12288,14336,14336,14336,14336,16384,16384,16384,16384,16384,16384,16384,16384,
16384,16384,16384,16384,16384,16384,16384,16384,16384,16384,14336,14336,14336,12288,12288,12288,
12288,10240,10240,8192,8192,8192,6144,6144,4096,4096,2048,2048,0,0,0,0,
0,0,0,0,0,0,2048,2048,4096,4096,6144,6144,6144,8192,8192,8192,
10240,10240,12288,12288,12288,12288,14336,14336,14336,14336,14336,14336,16384,16384,16384,16384,
16384,16384,16384,16384,16384,16384,14336,14336,14336,14336,14336,12288,12288,12288,12288,10240,
10240,10240,8192,8192,6144,6144,6144,4096,4096,2048,2048,0,0,0,0,0,
0,0,0,0,0,0,0,2048,2048,4096,4096,4096,6144,6144,8192,8192,
8192,10240,10240,10240,12288,12288,12288,12288,12288,14336,14336,14336,14336,14336,14336,14336,
14336,14336,14336,14336,14336,14336,14336,14336,12288,12288,12288,12288,12288,10240,10240,10240,
8192,8192,8192,6144,6144,6144,4096,4096,2048,2048,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,2048,2048,4096,4096,4096,6144,6144,6144,
8192,8192,8192,10240,10240,10240,10240,12288,12288,12288,12288,12288,12288,12288,12288,12288,
14336,14336,12288,12288,12288,12288,12288,12288,12288,12288,10240,10240,10240,10240,8192,8192,
8192,8192,6144,6144,4096,4096,4096,2048,2048,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,2048,2048,2048,4096,4096,4096,6144,
6144,8192,8192,8192,8192,10240,10240,10240,10240,10240,10240,12288,12288,12288,12288,12288,
12288,12288,12288,12288,12288,12288,10240,10240,10240,10240,10240,10240,8192,8192,8192,8192,
6144,6144,6144,4096,4096,2048,2048,2048,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,2048,2048,2048,4096,4096,4096,
6144,6144,6144,6144,8192,8192,8192,8192,10240,10240,10240,10240,10240,10240,10240,10240,
10240,10240,10240,10240,10240,10240,10240,10240,10240,8192,8192,8192,8192,8192,6144,6144,
6144,4096,4096,4096,2048,2048,2048,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,2048,2048,2048,4096,
4096,4096,6144,6144,6144,6144,8192,8192,8192,8192,8192,8192,8192,8192,10240,10240,
10240,10240,10240,8192,8192,8192,8192,8192,8192,8192,8192,6144,6144,6144,6144,4096,
4096,4096,2048,2048,2048,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,2048,2048,2048,2048,
4096,4096,4096,6144,6144,6144,6144,6144,8192,8192,8192,8192,8192,8192,8192,8192,
8192,8192,8192,8192,8192,8192,8192,8192,8192,6144,6144,6144,6144,6144,4096,4096,
4096,4096,2048,2048,2048,0,0,0,0,0,0,0,0,0,0,0};

256
env3.c Normal file
View File

@ -0,0 +1,256 @@
unsigned short env3[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,32,32,0,
0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,32,32,32,32,32,32,2113,2113,2113,2113,2113,2113,
2113,2113,2113,2113,2113,2113,2113,32,32,32,32,32,32,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,32,32,32,32,2113,2113,2113,2113,2145,2145,2145,2145,2145,2145,
2145,2145,2145,2145,2145,2145,2145,2113,2113,2113,2113,32,32,32,32,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
32,32,32,32,2113,2113,2145,2145,2145,4226,4226,4226,4226,4226,4226,4258,
4258,4258,4226,4226,4226,4226,4226,4226,2145,2145,2113,2113,2113,32,32,32,
32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,
32,32,2113,2113,2113,2145,4226,4226,4226,4258,4258,4258,6339,6339,6339,6339,
6339,6339,6339,6339,6339,4258,4258,4258,4226,4226,2145,2145,2113,2113,2113,32,
32,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,32,
2113,2113,2113,2145,4226,4226,4258,4258,6339,6339,6339,6371,6371,6371,6371,6371,
6371,6371,6371,6371,6371,6371,6339,6339,6339,4258,4258,4226,4226,2145,2113,2113,
2113,32,32,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,32,32,32,2113,
2113,2145,4226,4226,4258,4258,6339,6371,6371,8452,8452,8452,8484,8484,8484,8484,
8484,8484,8484,8484,8484,8452,8452,8452,6371,6371,6339,4258,4258,4226,4226,2145,
2113,2113,32,32,32,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,32,32,2113,2113,2145,
2145,4226,4258,6339,6339,6371,8452,8452,8484,8484,10565,10565,10565,10565,10597,10597,
10597,10597,10597,10565,10565,10565,10565,8484,8484,8452,6371,6371,6339,6339,4258,4226,
2145,2145,2113,2113,32,32,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,32,32,2113,2113,2145,4226,
4226,4258,6339,6371,8452,8452,8484,10565,10565,10597,10597,10597,12678,12678,12678,12678,
12678,12678,12678,12678,12678,10597,10597,10597,10565,10565,8484,8452,8452,6371,6339,4258,
4226,4226,2145,2113,2113,32,32,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,32,32,2113,2113,2145,4226,4258,
6339,6371,6371,8452,8484,10565,10565,10597,12678,12678,12710,12710,12710,14791,14791,14791,
14791,14791,14791,14791,12710,12710,12710,12678,12678,10597,10565,10565,8484,8452,6371,6371,
6339,4258,4226,2145,2113,2113,32,32,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,32,32,2113,2113,2145,4226,4258,6339,
6371,8452,8484,10565,10565,10597,12678,12710,12710,14791,14791,14823,14823,14823,14823,14823,
14823,14823,14823,14823,14823,14823,14791,14791,12710,12710,12678,10597,10565,10565,8484,8452,
6371,6339,4258,4226,2145,2113,2113,32,32,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,32,32,2113,2113,2145,4226,4258,6339,6371,
8452,8484,10565,10597,12678,12710,12710,14791,14823,14823,16904,16904,16904,16936,16936,16936,
16936,16936,16936,16936,16904,16904,16904,14823,14823,14791,12710,12710,12678,10597,10565,8484,
8452,6371,6339,4258,4226,2145,2113,2113,32,0,0,0,0,0,0,0,
0,0,0,0,0,0,32,32,2113,2113,2145,4226,4258,6339,6371,8452,
8484,10565,10597,12678,12710,14791,14823,14823,16904,16936,16936,16936,19017,19017,19017,19017,
19017,19017,19017,19017,19017,16936,16936,16936,16904,14823,14823,14791,12710,12678,10597,10565,
8484,8452,6371,6339,4258,4226,2145,2113,32,32,0,0,0,0,0,0,
0,0,0,0,0,0,32,32,2113,2145,4226,4258,6339,6371,8452,8484,
10565,10597,12678,12710,14791,14823,16904,16936,16936,19017,19017,19049,19049,21130,21130,21130,
21130,21130,21130,21130,19049,19049,19017,19017,16936,16936,16904,14823,14791,12710,12678,10597,
10565,8484,8452,6371,6339,4258,4226,2145,2113,32,32,0,0,0,0,0,
0,0,0,0,0,32,32,2113,2145,4226,4258,6339,6371,8452,8484,10565,
12678,12710,14791,14823,16904,16936,16936,19017,19049,19049,21130,21130,21162,21162,21162,23243,
23243,23243,21162,21162,21162,21130,21130,19049,19049,19017,16936,16936,16904,14823,14791,12710,
12678,10565,8484,8452,6371,6339,4258,4226,2145,2113,32,32,0,0,0,0,
0,0,0,0,0,32,32,2113,2145,4226,4258,6371,8452,8484,10565,12678,
12710,14791,14823,16904,16936,19017,19049,21130,21130,21162,21162,23243,23243,23275,23275,23275,
23275,23275,23275,23275,23243,23243,21162,21162,21130,21130,19049,19017,16936,16904,14823,14791,
12710,12678,10565,8484,8452,6371,4258,4226,2145,2113,32,32,0,0,0,0,
0,0,0,0,32,32,2113,2145,4226,4258,6339,8452,8484,10565,10597,12710,
14791,14823,16904,16936,19017,19049,21130,21162,23243,23243,23275,25356,25356,25388,25388,25388,
25388,25388,25388,25388,25356,25356,23275,23243,23243,21162,21130,19049,19017,16936,16904,14823,
14791,12710,10597,10565,8484,8452,6339,4258,4226,2145,2113,32,32,0,0,0,
0,0,0,0,32,2113,2113,2145,4258,6339,6371,8452,10565,10597,12678,14791,
14823,16904,16936,19017,19049,21130,21162,23243,23275,25356,25388,27469,27469,27501,27501,27501,
29582,27501,27501,27501,27469,27469,25388,25356,23275,23243,21162,21130,19049,19017,16936,16904,
14823,14791,12678,10597,10565,8452,6371,6339,4258,2145,2113,2113,32,0,0,0,
0,0,0,32,32,2113,2145,4226,4258,6371,8452,8484,10597,12678,12710,14823,
16904,16936,19017,19049,21130,21162,23243,25356,25388,27469,27501,29582,29582,29614,31695,31695,
31695,31695,31695,29614,29582,29582,27501,27469,25388,25356,23243,21162,21130,19049,19017,16936,
16904,14823,12710,12678,10597,8484,8452,6371,4258,4226,2145,2113,32,0,0,0,
0,0,0,32,32,2113,4226,4258,6339,6371,8484,10565,10597,12710,14791,16904,
16936,19017,19049,21130,23243,23275,25356,25388,27469,29582,29614,31695,31727,33808,33840,33840,
33840,33840,33840,33808,31727,31695,29614,29582,27469,25388,25356,23275,23243,21130,19049,19017,
16936,16904,14791,12710,10597,10565,8484,6371,6339,4258,4226,2113,32,32,0,0,
0,0,32,32,2113,2145,4226,4258,6339,8452,8484,10597,12678,14791,14823,16904,
19017,19049,21130,21162,23275,25356,25388,27501,29582,31695,31727,33840,35921,35953,38034,38034,
38066,38034,38034,35953,35921,33840,31727,31695,29582,27501,25388,25356,23275,21162,21130,19049,
19017,16904,14823,14791,12678,10597,8484,8452,6339,4258,4226,2145,2113,32,0,0,
0,0,32,32,2113,2145,4226,6339,6371,8484,10565,10597,12710,14791,16904,16936,
19017,21130,21162,23243,25356,25388,27501,29614,31695,33808,35921,38034,38066,40147,40179,42260,
42260,42260,40179,40147,38066,38034,35921,33808,31695,29614,27501,25388,25356,23243,21162,21130,
19017,16936,16904,14791,12710,10597,10565,8452,6371,6339,4226,2145,2113,32,32,0,
0,0,32,2113,2113,4226,4258,6339,8452,8484,10597,12678,14791,14823,16904,19017,
19049,21130,23243,23275,25388,27501,29582,31695,33840,35953,38066,40179,42292,44373,44405,46486,
46486,46486,44405,44373,42292,40179,38066,35953,33840,31695,29582,27501,25388,23275,23243,21130,
19049,19017,16904,14823,14791,12678,10597,8484,8452,6339,4258,4226,2113,2113,32,0,
0,0,32,2113,2145,4226,4258,6371,8452,10565,10597,12710,14791,16904,16936,19017,
21130,21162,23275,25356,27469,29582,31695,33808,35953,38066,42260,44373,46486,48599,48631,50712,
50712,50712,48631,48599,46486,44373,42260,38066,35953,33808,31695,29582,27469,25356,23275,21162,
21130,19017,16936,16904,14791,12710,10597,10565,8452,6371,4258,4226,2145,2113,32,0,
0,0,32,2113,2145,4226,6339,6371,8484,10565,12678,12710,14823,16904,16936,19049,
21130,23243,23275,25388,27501,29614,33808,35921,38066,42260,44405,46518,48631,50744,52825,52857,
52857,52857,52825,50744,48631,46518,44405,42260,38066,35921,33808,29614,27501,25388,23275,23243,
21130,19049,16936,16904,14823,12710,12678,10565,8484,6371,6339,4226,2145,2113,32,0,
0,32,32,2113,2145,4258,6339,6371,8484,10597,12678,14791,14823,16936,19017,19049,
21162,23243,25356,27469,29582,31727,33840,38034,40179,44373,46518,50712,52825,54938,54970,57051,
57051,57051,54970,54938,52825,50712,46518,44373,40179,38034,33840,31727,29582,27469,25356,23243,
21162,19049,19017,16936,14823,14791,12678,10597,8484,6371,6339,4258,2145,2113,32,0,
0,32,2113,2113,4226,4258,6339,8452,8484,10597,12678,14791,14823,16936,19017,21130,
21162,23275,25388,27501,29614,33808,35953,40147,42292,46518,50712,52825,54970,57083,59164,59196,
59196,59196,59164,57083,54970,52857,50712,46518,42292,40147,35953,33808,29614,27501,25388,23275,
21162,21130,19017,16936,14823,14791,12678,10597,8484,8452,6339,4258,4226,2113,2113,32,
0,32,32,2113,4226,4258,6339,8452,10565,10597,12710,14791,16904,16936,19049,21130,
23243,25356,25388,29582,31695,33840,38034,42260,44405,48631,52825,54970,57083,59196,61277,61309,
61309,61309,61277,59196,57083,54970,52825,48631,44405,42260,38034,33840,31695,29582,25388,25356,
23243,21130,19049,16936,16904,14791,12710,10597,10565,8452,6339,4258,4226,2113,2113,32,
0,32,2113,2145,4226,4258,6371,8452,10565,10597,12710,14791,16904,19017,19049,21162,
23243,25356,27469,29582,31727,35921,38066,42292,46486,50712,52857,57051,59164,61277,61309,63390,
63390,63390,61309,61277,59164,57051,52857,50712,46486,42292,38066,35921,31727,29582,27469,25356,
23243,21162,19049,19017,16904,14791,12710,10597,10565,8452,6371,4258,4226,2145,2113,32,
32,32,2113,2145,4226,4258,6371,8452,10565,10597,12710,14823,16904,19017,19049,21162,
23243,25356,27469,29614,31727,35921,40147,44373,46518,50744,54938,57083,59196,61309,63390,63422,
63422,63422,63390,61309,59196,57083,54938,50744,46518,44373,40147,35921,31727,29614,27469,25356,
23243,21162,19049,19017,16904,14823,12710,10597,10565,8452,6371,4258,4226,2145,2113,32,
0,32,2113,2145,4226,4258,6371,8452,10565,10597,12710,14823,16904,19017,19049,21162,
23275,25356,27469,29614,33808,35953,40147,44373,48599,50744,54970,59164,61277,63390,63422,63422,
65503,63422,63422,63390,61277,59164,54970,50744,48599,44373,40147,35953,33808,29614,27469,25356,
23275,21162,19049,19017,16904,14823,12710,10597,10565,8452,6371,4258,4226,2145,2113,32,
32,32,2113,2145,4226,4258,6371,8452,10565,10597,12710,14823,16904,19017,19049,21162,
23275,25356,27469,29614,33808,35953,40147,44373,48599,50744,54970,59164,61277,63390,63422,63422,
65503,63422,63422,63390,61277,59164,54970,50744,48599,44373,40147,35953,33808,29614,27469,25356,
23275,21162,19049,19017,16904,14823,12710,10597,10565,8452,6371,4258,4226,2145,2113,32,
0,32,2113,2145,4226,4258,6371,8452,10565,10597,12710,14823,16904,19017,19049,21162,
23243,25356,27469,29614,31727,35921,40147,44373,46518,50744,54938,57083,59196,61309,63390,63422,
63422,63422,63390,61309,59196,57083,54938,50744,46518,44373,40147,35921,31727,29614,27469,25356,
23243,21162,19049,19017,16904,14823,12710,10597,10565,8452,6371,4258,4226,2145,2113,32,
0,32,2113,2145,4226,4258,6371,8452,10565,10597,12710,14791,16904,19017,19049,21162,
23243,25356,27469,29582,31727,35921,38066,42292,46486,50712,52857,57051,59164,61277,61309,63390,
63390,63390,61309,61277,59164,57051,52857,50712,46486,42292,38066,35921,31727,29582,27469,25356,
23243,21162,19049,19017,16904,14791,12710,10597,10565,8452,6371,4258,4226,2145,2113,32,
0,32,32,2113,4226,4258,6339,8452,10565,10597,12710,14791,16904,16936,19049,21130,
23243,25356,25388,29582,31695,33840,38034,42260,44405,48631,52825,54970,57083,59196,61277,61309,
61309,61309,61277,59196,57083,54970,52825,48631,44405,42260,38034,33840,31695,29582,25388,25356,
23243,21130,19049,16936,16904,14791,12710,10597,10565,8452,6339,4258,4226,2113,2113,32,
0,32,2113,2113,4226,4258,6339,8452,8484,10597,12678,14791,14823,16936,19017,21130,
21162,23275,25388,27501,29614,33808,35953,40147,42292,46518,50712,52825,54970,57083,59164,59196,
59196,59196,59164,57083,54970,52857,50712,46518,42292,40147,35953,33808,29614,27501,25388,23275,
21162,21130,19017,16936,14823,14791,12678,10597,8484,8452,6339,4258,4226,2113,2113,0,
0,32,32,2113,2145,4258,6339,6371,8484,10565,12678,14791,14823,16936,19017,19049,
21162,23243,25356,27469,29582,31727,33840,38034,40179,44373,46518,50712,52825,54938,54970,57051,
57051,57051,54970,54938,52825,50712,46518,44373,40179,38034,33840,31727,29582,27469,25356,23243,
21162,19049,19017,16936,14823,14791,12678,10597,8484,6371,6339,4258,2145,2113,32,0,
0,0,32,2113,2145,4226,6339,6371,8484,10565,12678,12710,14823,16904,16936,19049,
21130,23243,23275,25388,27501,29614,33808,35921,38066,42260,44405,46518,48631,50744,52825,52857,
52857,52857,52825,50744,48631,46518,44405,42260,38066,35921,33808,29614,27501,25388,23275,23243,
21130,19049,16936,16904,14823,12710,12678,10565,8484,6371,6339,4226,2145,2113,32,0,
0,0,32,2113,2145,4226,4258,6371,8452,10565,10597,12710,14791,16904,16936,19017,
21130,21162,23275,25356,27469,29582,31695,33808,35953,38066,42260,44373,46486,48599,48631,50712,
50712,50712,48631,48599,46486,44373,42260,38066,35953,33808,31695,29582,27469,25356,23275,21162,
21130,19017,16936,16904,14791,12710,10597,10565,8452,6371,4258,4226,2145,2113,32,0,
0,0,32,2113,2113,4226,4258,6339,8452,8484,10597,12678,14791,14823,16904,19017,
19049,21130,23243,23275,25388,27501,29582,31695,33840,35953,38066,40179,42292,44373,44405,46486,
46486,46486,44405,44373,42292,40179,38066,35953,33840,31695,29582,27501,25388,23275,23243,21130,
19049,19017,16904,14823,14791,12678,10597,8484,8452,6339,4258,4226,2113,2113,32,0,
0,0,32,32,2113,2145,4226,6339,6371,8452,10565,10597,12710,14791,16904,16936,
19017,21130,21162,23243,25356,25388,27501,29614,31695,33808,35921,38034,38066,40147,40179,42260,
42260,42260,40179,40147,38066,38034,35921,33808,31695,29614,27501,25388,25356,23243,21162,21130,
19017,16936,16904,14791,12710,10597,10565,8484,6371,6339,4226,2145,2113,32,0,0,
0,0,0,32,2113,2145,4226,4258,6339,8452,8484,10597,12678,14791,14823,16904,
19017,19049,21130,21162,23275,25356,25388,27501,29582,31695,31727,33840,35921,35953,38034,38034,
38066,38034,38034,35953,35921,33840,31727,31695,29582,27501,25388,25356,23275,21162,21130,19049,
19017,16904,14823,14791,12678,10597,8484,8452,6371,4258,4226,2145,2113,32,0,0,
0,0,0,32,2113,2113,4226,4258,6339,6371,8484,10565,10597,12710,14791,16904,
16936,19017,19049,21130,23243,23275,25356,25388,27469,29582,29614,31695,31727,33808,33840,33840,
33840,33840,33840,33808,31727,31695,29614,29582,27469,25388,25356,23275,23243,21130,19049,19017,
16936,16904,14791,12710,10597,10565,8484,6371,6339,4258,4226,2113,2113,32,0,0,
0,0,0,0,32,2113,2145,4226,4258,6371,8452,8484,10597,12678,12710,14823,
16904,16936,19017,19049,21130,21162,23243,25356,25388,27469,27501,29582,29582,29614,31695,31695,
31695,31695,31695,29614,29582,29582,27501,27469,25388,25356,23243,21162,21130,19049,19017,16936,
16904,14823,12710,12678,10597,8484,8452,6371,4258,4226,2145,2113,32,0,0,0,
0,0,0,0,32,2113,2113,2145,4258,6339,6371,8452,10565,10597,12678,14791,
14823,16904,16936,19017,19049,21130,21162,23243,23275,25356,25388,27469,27469,27501,27501,27501,
29582,27501,27501,27501,27469,27469,25388,25356,23275,23243,21162,21130,19049,19017,16936,16904,
14823,14791,12678,10597,10565,8452,6371,6339,4258,2145,2113,2113,32,0,0,0,
0,0,0,0,0,32,2113,2145,4226,4258,6339,8452,8484,10565,10597,12710,
14791,14823,16904,16936,19017,19049,21130,21162,23243,23243,23275,25356,25356,25388,25388,25388,
25388,25388,25388,25388,25356,25356,23275,23243,23243,21162,21130,19049,19017,16936,16904,14823,
14791,12710,10597,10565,8484,8452,6339,4258,4226,2145,2113,32,0,0,0,0,
0,0,0,0,0,32,32,2113,2145,4226,4258,6371,8452,8484,10565,12678,
12710,14791,14823,16904,16936,19017,19049,21130,21130,21162,21162,23243,23243,23275,23275,23275,
23275,23275,23275,23275,23243,23243,21162,21162,21130,21130,19049,19017,16936,16904,14823,14791,
12710,12678,10565,8484,8452,6371,4258,4226,2145,2113,32,32,0,0,0,0,
0,0,0,0,0,0,32,2113,2145,4226,4258,6339,6371,8452,8484,10565,
12678,12710,14791,14823,16904,16936,16936,19017,19049,19049,21130,21130,21162,21162,21162,23243,
23243,23243,21162,21162,21162,21130,21130,19049,19049,19017,16936,16936,16904,14823,14791,12710,
12678,10565,8484,8452,6371,6339,4258,4226,2145,2113,32,0,0,0,0,0,
0,0,0,0,0,0,32,32,2113,2145,4226,4258,6339,6371,8452,8484,
10565,10597,12678,12710,14791,14823,16904,16936,16936,19017,19017,19049,19049,21130,21130,21130,
21130,21130,21130,21130,19049,19049,19017,19017,16936,16936,16904,14823,14791,12710,12678,10597,
10565,8484,8452,6371,6339,4258,4226,2145,2113,32,0,0,0,0,0,0,
0,0,0,0,0,0,0,32,32,2113,2145,4226,4258,6339,6371,8452,
8484,10565,10597,12678,12710,14791,14823,14823,16904,16936,16936,16936,19017,19017,19017,19017,
19017,19017,19017,19017,19017,16936,16936,16936,16904,14823,14823,14791,12710,12678,10597,10565,
8484,8452,6371,6339,4258,4226,2145,2113,2113,32,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,32,2113,2113,2145,4226,4258,6339,6371,
8452,8484,10565,10597,12678,12710,12710,14791,14823,14823,16904,16904,16904,16936,16936,16936,
16936,16936,16936,16936,16904,16904,16904,14823,14823,14791,12710,12710,12678,10597,10565,8484,
8452,6371,6339,4258,4226,2145,2113,2113,32,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,32,2113,2113,2145,4226,4258,6339,
6371,8452,8484,10565,10565,10597,12678,12710,12710,14791,14791,14823,14823,14823,14823,14823,
14823,14823,14823,14823,14823,14823,14791,14791,12710,12710,12678,10597,10565,10565,8484,8452,
6371,6339,4258,4226,2145,2113,2113,32,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,32,2113,2113,2145,4226,4258,
6339,6371,6371,8452,8484,10565,10565,10597,12678,12678,12710,12710,12710,14791,14791,14791,
14791,14791,14791,14791,12710,12710,12710,12678,12678,10597,10565,10565,8484,8452,6371,6371,
6339,4258,4226,2145,2113,2113,32,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,32,2113,2113,2145,4226,
4226,4258,6339,6371,8452,8452,8484,10565,10565,10597,10597,10597,12678,12678,12678,12678,
12678,12678,12678,12678,12678,10597,10597,10597,10565,10565,8484,8452,8452,6371,6339,4258,
4226,4226,2145,2113,2113,32,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,32,32,2113,2145,
2145,4226,4258,6339,6339,6371,8452,8452,8484,8484,10565,10565,10565,10565,10597,10597,
10597,10597,10597,10565,10565,10565,8484,8484,8452,8452,6371,6371,6339,6339,4258,4226,
2145,2145,2113,2113,32,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,32,2113,2113,
2113,2145,4226,4226,4258,4258,6339,6371,6371,8452,8452,8452,8484,8484,8484,8484,
8484,8484,8484,8484,8484,8452,8452,6371,6371,6339,6339,4258,4258,4226,4226,2145,
2113,2113,32,32,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,32,
2113,2113,2113,2145,4226,4226,4258,4258,6339,6339,6339,6371,6371,6371,6371,6371,
6371,6371,6371,6371,6371,6371,6339,6339,6339,4258,4258,4226,4226,2145,2113,2113,
2113,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
32,32,2113,2113,2113,2145,4226,4226,4226,4258,4258,4258,6339,6339,6339,6339,
6339,6339,6339,6339,6339,4258,4258,4258,4226,4226,4226,2145,2113,2113,2113,32,
32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,32,32,2113,2113,2145,2145,2145,4226,4226,4226,4226,4226,4258,4258,
4258,4258,4258,4226,4226,4226,4226,2145,2145,2145,2113,2113,2113,32,32,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,32,32,2113,2113,2113,2113,2145,2145,2145,2145,2145,2145,
2145,2145,2145,2145,2145,2145,2145,2113,2113,2113,2113,32,32,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,32,32,32,2113,2113,2113,2113,2113,2113,2113,
2113,2113,2113,2113,2113,2113,2113,2113,32,32,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,32,32,32,32,32,
32,32,32,32,32,32,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

413
generate3d.c Normal file
View File

@ -0,0 +1,413 @@
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "engine3d.h"
#include "generate3d.h"
#include "ZeDemo.h"
object3d object[16];
extern point2d spts[MAXDATA];
unsigned char addtimes[MAXDATA];
extern unsigned short shades[64][256];
extern unsigned short env1[];
extern unsigned short env2[];
extern unsigned short env3[];
extern int fsin4[2048], fsin5[2048], fsin6[2048];
extern int prticks;
void CalcNorms(object3d *obj, int neg)
{
vector3d v1,v2;
obj->normal = (vector3d*)malloc(obj->npls * sizeof(vector3d));
int i;
for (i=0; i<obj->npls; i++)
{
v1.x = obj->point[obj->poly[i].p2].x - obj->point[obj->poly[i].p1].x;
v1.y = obj->point[obj->poly[i].p2].y - obj->point[obj->poly[i].p1].y;
v1.z = obj->point[obj->poly[i].p2].z - obj->point[obj->poly[i].p1].z;
v2.x = obj->point[obj->poly[i].p1].x - obj->point[obj->poly[i].p0].x;
v2.y = obj->point[obj->poly[i].p1].y - obj->point[obj->poly[i].p0].y;
v2.z = obj->point[obj->poly[i].p1].z - obj->point[obj->poly[i].p0].z;
obj->normal[i] = Normalize(CrossProduct(v1,v2));
if (neg==1) obj->normal[i] = NegVec(obj->normal[i]);
}
}
void CalcPtNorms(object3d *obj)
{
obj->pt_normal = (vector3d*)malloc(obj->npts * sizeof(vector3d));
int i;
for (i=0; i<MAXDATA; i++)
addtimes[i] = 0;
for (i=0; i<obj->npts; i++)
{
obj->pt_normal[i].x = 0;
obj->pt_normal[i].y = 0;
obj->pt_normal[i].z = 0;
}
for (i=0; i<obj->npls; i++)
{
obj->pt_normal[obj->poly[i].p0].x += obj->normal[i].x;
obj->pt_normal[obj->poly[i].p0].y += obj->normal[i].y;
obj->pt_normal[obj->poly[i].p0].z += obj->normal[i].z;
obj->pt_normal[obj->poly[i].p1].x += obj->normal[i].x;
obj->pt_normal[obj->poly[i].p1].y += obj->normal[i].y;
obj->pt_normal[obj->poly[i].p1].z += obj->normal[i].z;
obj->pt_normal[obj->poly[i].p2].x += obj->normal[i].x;
obj->pt_normal[obj->poly[i].p2].y += obj->normal[i].y;
obj->pt_normal[obj->poly[i].p2].z += obj->normal[i].z;
addtimes[obj->poly[i].p0]++;
addtimes[obj->poly[i].p1]++;
addtimes[obj->poly[i].p2]++;
}
for (i=0; i<obj->npts; i++)
{
if (addtimes[i]!=0)
{
obj->pt_normal[i].x /= addtimes[i];
obj->pt_normal[i].y /= addtimes[i];
obj->pt_normal[i].z /= addtimes[i];
obj->pt_normal[i] = Normalize(obj->pt_normal[i]);
}
}
}
void ReversePolygonOrder(object3d *obj)
{
int i, a, b, c;
for (i=0; i<obj->npls; i++)
{
a = obj->poly[i].p0;
b = obj->poly[i].p1;
c = obj->poly[i].p2;
obj->poly[i].p0 = c;
obj->poly[i].p1 = b;
obj->poly[i].p2 = a;
}
}
void Load32bit3doFile(char* filename, object3d *obj, int neg, float stdiv)
{
FILE *obj3d;
obj3d=fopen(filename,"rb");
obj->npts=fgetc(obj3d)+(fgetc(obj3d)<<8)+(fgetc(obj3d)<<16)+(fgetc(obj3d)<<24);
obj->nlns=fgetc(obj3d)+(fgetc(obj3d)<<8)+(fgetc(obj3d)<<16)+(fgetc(obj3d)<<24);
obj->npls=fgetc(obj3d)+(fgetc(obj3d)<<8)+(fgetc(obj3d)<<16)+(fgetc(obj3d)<<24);
obj->point = (point3d*)malloc(obj->npts * sizeof(point3d));
obj->line = (line2d*)malloc(obj->nlns * sizeof(line2d));
obj->poly = (poly2d*)malloc(obj->npls * sizeof(poly2d));
int i;
for (i=0; i<obj->npts; i++)
{
obj->point[i].x = (fgetc(obj3d)+(fgetc(obj3d)<<8)+(fgetc(obj3d)<<16)+(fgetc(obj3d)<<24) - 65536)/stdiv;
obj->point[i].y = (fgetc(obj3d)+(fgetc(obj3d)<<8)+(fgetc(obj3d)<<16)+(fgetc(obj3d)<<24) - 65536)/stdiv;
obj->point[i].z = (fgetc(obj3d)+(fgetc(obj3d)<<8)+(fgetc(obj3d)<<16)+(fgetc(obj3d)<<24) - 65536)/stdiv;
obj->point[i].c = 0xFFFF;
}
for (i=0; i<obj->nlns; i++)
{
obj->line[i].p0 = fgetc(obj3d)+(fgetc(obj3d)<<8)+(fgetc(obj3d)<<16)+(fgetc(obj3d)<<24);
obj->line[i].p1 = fgetc(obj3d)+(fgetc(obj3d)<<8)+(fgetc(obj3d)<<16)+(fgetc(obj3d)<<24);
obj->line[i].c = 0xFFFFFF;
}
for (i=0; i<obj->npls; i++)
{
obj->poly[i].p0 = fgetc(obj3d)+(fgetc(obj3d)<<8)+(fgetc(obj3d)<<16)+(fgetc(obj3d)<<24);
obj->poly[i].p1 = fgetc(obj3d)+(fgetc(obj3d)<<8)+(fgetc(obj3d)<<16)+(fgetc(obj3d)<<24);
obj->poly[i].p2 = fgetc(obj3d)+(fgetc(obj3d)<<8)+(fgetc(obj3d)<<16)+(fgetc(obj3d)<<24);
}
fclose(obj3d);
CalcNorms(obj, neg);
CalcPtNorms(obj);
}
void Load16bit3do(object3d *obj, unsigned char* objdata, int neg)
{
obj->npts = *objdata + (*(objdata+1)<<8);
obj->nlns = *(objdata+2) + (*(objdata+3)<<8);
obj->npls = *(objdata+4) + (*(objdata+5)<<8);
obj->point = malloc(obj->npts * sizeof(point3d));
obj->line = malloc(obj->nlns * sizeof(line2d));
obj->poly = malloc(obj->npls * sizeof(poly2d));
objdata+=6;
int i;
for (i=0; i<obj->npts; i++)
{
obj->point[i].x = (*(objdata++) - 128) >> 1;
obj->point[i].y = (*(objdata++) - 128) >> 1;
obj->point[i].z = (*(objdata++) - 128) >> 1;
obj->point[i].c = 0xFFFF;
}
for (i=0; i<obj->nlns; i++)
{
obj->line[i].p0 = *objdata + (*(objdata+1)<<8);
obj->line[i].p1 = *(objdata+2) + (*(objdata+3)<<8);
objdata+=4;
obj->line[i].c = 0xFFFF;
}
for (i=0; i<obj->npls; i++)
{
obj->poly[i].p0 = *objdata + (*(objdata+1)<<8);
obj->poly[i].p1 = *(objdata+2) + (*(objdata+3)<<8);
obj->poly[i].p2 = *(objdata+4) + (*(objdata+5)<<8);
objdata+=6;
}
CalcNorms(obj, neg);
CalcPtNorms(obj);
}
void Wave(object3d *obj)
{
int x, y;
int grid_width = 32;
int grid_height = 32;
int tm1 = (prticks % (75<<5)) >> 5;
int tm2 = (prticks % (50<<4)) >> 4;
int k = 0, l;
for (y=0; y<=grid_height; y++)
{
l = fsin6[y+tm1];
for (x=0; x<=grid_width; x++)
{
// obj->point[k].z = sin((x+(prticks/192.0))/3.0)*12.0 + sin((y+(prticks/128.0))/2.0)*4.0 + sin((x + y+(prticks/96.0))/1.5)*8.0;
obj->point[k].z = fsin4[x+y] + fsin5[x+tm2] + l;
k++;
}
}
}
void InitTestObject(object3d *obj, int objn)
{
int tl = 4, tr = 252;
int i, k;
int adj = 2;
int grid_width = 32;
int grid_height = 32;
int x, y;
printf("DEBUG: InitTestObject() objn case Number = %d\n", objn);
switch(objn)
{
case 0:
obj->npts = (grid_width+1) * (grid_height+1);
obj->npls = grid_width * grid_height * 2;
obj->point = malloc(obj->npts * sizeof(point3d));
obj->poly = malloc(obj->npls * sizeof(poly2d));
k = 0;
for (y=0; y<=grid_height; y++)
{
for (x=0; x<=grid_width; x++)
{
obj->point[k].x = (x - (grid_width>>1))*10;
obj->point[k].y = (y - (grid_height>>1))*10;
obj->point[k].z = sin(x/1)*8 + sin(y/1)*12 + sin((x+y)/2.0)*12 + sin(x/2.0 + y/1.0)*8 + sin(x/4.0 + sin(y/8.0)*4.0)*4;
k++;
}
}
k = 0;
for (y=0; y<grid_height; y++)
{
for (x=0; x<grid_width; x++)
{
obj->poly[k].p0 = x+y*(grid_width+1); obj->poly[k].p1 = x+1+y*(grid_width+1); obj->poly[k].p2 = x+(y+1)*(grid_width+1);
obj->poly[k+1].p0 = x+(y+1)*(grid_width+1); obj->poly[k+1].p1 = x+1+y*(grid_width+1); obj->poly[k+1].p2 = x+1+(y+1)*(grid_width+1);
k+=2;
}
}
obj->pos.x = 0; obj->pos.y = 0; obj->pos.z = 256;
obj->rot.x = 0; obj->rot.y = 0; obj->rot.z = 0;
obj->mtrl = malloc(1 * sizeof(material));
obj->mtrl[0].rmode = GOURAUD;
obj->mtrl[0].nshade = 1;
obj->mtrl[0].shade = malloc(obj->mtrl[0].nshade * sizeof(unsigned short*));
obj->mtrl[0].shade[0] = shades[1];
for (i=0; i<obj->npls; i++)
obj->poly[i].m = 0;
CalcNorms(obj, 1);
CalcPtNorms(obj);
break;
case 1:
obj->npts = (grid_width+1) * (grid_height+1);
obj->npls = grid_width * grid_height * 2;
obj->point = malloc(obj->npts * sizeof(point3d));
obj->poly = malloc(obj->npls * sizeof(poly2d));
k = 0;
for (y=0; y<=grid_height; y++)
{
for (x=0; x<=grid_width; x++)
{
obj->point[k].x = (x - (grid_width>>1))*10;
obj->point[k].y = (y - (grid_height>>1))*10;
obj->point[k].z = sin(x/4.0)*16 + sin(y/4.0)*16;
k++;
}
}
k = 0;
for (y=0; y<grid_height; y++)
{
for (x=0; x<grid_width; x++)
{
obj->poly[k].p0 = x+y*(grid_width+1); obj->poly[k].p1 = x+1+y*(grid_width+1); obj->poly[k].p2 = x+(y+1)*(grid_width+1);
obj->poly[k+1].p0 = x+(y+1)*(grid_width+1); obj->poly[k+1].p1 = x+1+y*(grid_width+1); obj->poly[k+1].p2 = x+1+(y+1)*(grid_width+1);
k+=2;
}
}
obj->pos.x = 0; obj->pos.y = 0; obj->pos.z = 256;
obj->rot.x = 0; obj->rot.y = 0; obj->rot.z = 0;
obj->mtrl = malloc(1 * sizeof(material));
obj->mtrl[0].rmode = ENVMAP;
obj->mtrl[0].ntexture = 1;
obj->mtrl[0].txtr = malloc(obj->mtrl[0].ntexture * sizeof(texture*));
obj->mtrl[0].txtr[0] = malloc(sizeof(texture));
obj->mtrl[0].txtr[0]->tshr = 2;
obj->mtrl[0].txtr[0]->bitmap = env1;
for (i=0; i<obj->npls; i++)
obj->poly[i].m = 0;
CalcNorms(obj, 1);
CalcPtNorms(obj);
break;
case 2:
Load32bit3doFile("app0:magnolia.3do", obj, 1, 1024);
obj->mtrl = malloc(1 * sizeof(material));
obj->mtrl[0].rmode = GOURAUD;
obj->mtrl[0].nshade = 1;
obj->mtrl[0].shade = malloc(obj->mtrl[0].nshade * sizeof(unsigned short*));
obj->mtrl[0].shade[0] = shades[2];
for (i=0; i<obj->npls; i++)
obj->poly[i].m = 0;
obj->pos.x = 0; obj->pos.y = 180; obj->pos.z = 8192;
obj->rot.x = 0; obj->rot.y = 0; obj->rot.z = 0;
break;
case 3:
obj->npts = (grid_width+1) * (grid_height+1);
obj->npls = grid_width * grid_height * 2;
obj->point = malloc(obj->npts * sizeof(point3d));
obj->poly = malloc(obj->npls * sizeof(poly2d));
k = 0;
for (y=0; y<=grid_height; y++)
{
for (x=0; x<=grid_width; x++)
{
obj->point[k].x = (x - (grid_width>>1))*10;
obj->point[k].y = (y - (grid_height>>1))*10;
obj->point[k].z = sin(x/3.0)*16 + sin(y/2.0)*16 + sin((x+y)/1.0)*8;
k++;
}
}
k = 0;
for (y=0; y<grid_height; y++)
{
for (x=0; x<grid_width; x++)
{
obj->poly[k].p0 = x+y*(grid_width+1); obj->poly[k].p1 = x+1+y*(grid_width+1); obj->poly[k].p2 = x+(y+1)*(grid_width+1);
obj->poly[k+1].p0 = x+(y+1)*(grid_width+1); obj->poly[k+1].p1 = x+1+y*(grid_width+1); obj->poly[k+1].p2 = x+1+(y+1)*(grid_width+1);
k+=2;
}
}
obj->pos.x = 0; obj->pos.y = 0; obj->pos.z = 384;
obj->rot.x = 0; obj->rot.y = 0; obj->rot.z = 0;
obj->mtrl = malloc(1 * sizeof(material));
obj->mtrl[0].rmode = ENVMAP;
obj->mtrl[0].ntexture = 1;
obj->mtrl[0].txtr = malloc(obj->mtrl[0].ntexture * sizeof(texture*));
obj->mtrl[0].txtr[0] = malloc(sizeof(texture));
obj->mtrl[0].txtr[0]->tshr = 2;
obj->mtrl[0].txtr[0]->bitmap = env1;
for (i=0; i<obj->npls; i++)
obj->poly[i].m = 0;
ReversePolygonOrder(obj);
CalcNorms(obj, 1);
CalcPtNorms(obj);
break;
case 6:
Load32bit3doFile("app0:gp2x.3do", obj, 1, 256);
obj->mtrl = malloc(2 * sizeof(material));
obj->mtrl[0].rmode = ENVMAP;
obj->mtrl[0].ntexture = 1;
obj->mtrl[0].txtr = malloc(obj->mtrl[0].ntexture * sizeof(texture*));
obj->mtrl[0].txtr[0] = malloc(sizeof(texture));
obj->mtrl[0].txtr[0]->tshr = 2;
obj->mtrl[0].txtr[0]->bitmap = env3;
obj->mtrl[1].rmode = ENVMAP;
obj->mtrl[1].ntexture = 1;
obj->mtrl[1].txtr = malloc(obj->mtrl[1].ntexture * sizeof(texture*));
obj->mtrl[1].txtr[0] = malloc(sizeof(texture));
obj->mtrl[1].txtr[0]->tshr = 2;
obj->mtrl[1].txtr[0]->bitmap = env2;
for (i=0; i<64; i++)
obj->poly[i].m = 1;
for (i=64; i<356; i++)
obj->poly[i].m = 0;
for (i=356; i<494; i++)
obj->poly[i].m = 1;
for (i=494; i<obj->npls; i++)
obj->poly[i].m = 0;
obj->pos.x = 0; obj->pos.y = 0; obj->pos.z = 512;
obj->rot.x = PI/2; obj->rot.y = 0; obj->rot.z = PI/8;
break;
default:
break;
}
}

2
generate3d.h Normal file
View File

@ -0,0 +1,2 @@
void InitTestObject(object3d *obj, int objn);
void Wave(object3d *obj);

4800
loading.c Normal file

File diff suppressed because it is too large Load Diff

384
precalcs.c Normal file
View File

@ -0,0 +1,384 @@
#include <stdio.h>
#include <math.h>
#include <psp2/kernel/clib.h>
#include "precalcs.h"
#include "engine3d.h"
#include "ZeDemo.h"
unsigned short shades[64][256];
int pdiv[4096];
int fsin1[2048], fsin2[2048], fsin3[2048];
int fsin4[2048], fsin5[2048], fsin6[2048];
extern unsigned char bitfonts[];
unsigned char fonts[59*64];
short floorstuff[2*WIDTH*HEIGHT];
unsigned char dist_angle[2*WIDTH*HEIGHT];
unsigned char rbmp[SSIZE];
unsigned char gbmp[SSIZE];
unsigned char bbmp[SSIZE];
unsigned char rbuffer[SSIZE];
unsigned char gbuffer[SSIZE];
unsigned char bbuffer[SSIZE];
short radir0[SSIZE];
short radir1[SSIZE];
short radir2[SSIZE];
short radir3[SSIZE];
short radir4[SSIZE];
short radir5[SSIZE];
extern unsigned short sky1[], sky3[];
void InitRadialBitmap1()
{
int x, y, i = 0;
unsigned short c;
for (y=0; y<HEIGHT; y++)
{
for (x=0; x<WIDTH; x ++)
{
c = sky1[(x&255) + (((HEIGHT-1)-y)<<8)];
rbmp[i] = ((c>>11) & 31) << 3;
gbmp[i] = ((c>>5) & 63) << 2;
bbmp[i] = (c & 31) << 3;
i++;
}
}
}
void InitRadialBitmap2()
{
int x, y, i = 0;
unsigned short c;
for (y=0; y<HEIGHT; y++)
{
for (x=0; x<WIDTH; x ++)
{
c = sky3[x + ((HEIGHT-1)-y)*320];
rbmp[i] = ((c>>11) & 31) << 3;
gbmp[i] = ((c>>5) & 63) << 2;
bbmp[i] = (c & 31) << 3;
i++;
}
}
}
void InitRadial()
{
InitRadialBitmap1();
float rb_shortness = 4.0f;
int xi, yi;
int i=0;
int x, y;
for (y=0; y<HEIGHT; y++)
{
for (x=0; x<WIDTH; x++)
{
xi = -(x/rb_shortness);
yi = -(y/rb_shortness);
radir0[i] = (xi>>1) + (yi>>1)*WIDTH;
radir1[i] = (xi>>2) + (yi>>2)*WIDTH;
radir2[i] = (xi>>3) + (yi>>3)*WIDTH;
i++;
}
}
i=0;
for (y=0; y<HEIGHT; y++)
{
for (x=0; x<WIDTH; x++)
{
xi = -(x/rb_shortness);
yi = y/rb_shortness;
radir3[i] = (xi>>1) + (yi>>1)*WIDTH;
radir4[i] = (xi>>2) + (yi>>2)*WIDTH;
radir5[i] = (xi>>3) + (yi>>3)*WIDTH;
i++;
}
}
}
void InitPolar()
{
int x, y, c;
float w=Twidth/2;
int i=0;
for (y=-HEIGHT/2; y<HEIGHT/2; y++)
{
for (x=-WIDTH/2; x<WIDTH/2; x++)
{
dist_angle[i++]=(int)((w*Twidth)*(1/sqrt(x*x+y*y)));
dist_angle[i++]=((int)(2.0 * Twidth * atan2(y,x)/pi)) & 255;
}
}
}
void InitFloor()
{
float w=128;
int i=0, x, y;
int w0=WIDTH/2;
int h0=HEIGHT/2;
int adj = -WIDTH>>2;
for (y=-h0+adj;y<h0+adj;y++)
{
for (x=-w0;x<w0;x++)
{
floorstuff[i++]=(int)((w*128)*(1/sqrt(y*y))) & 127;
floorstuff[i++]=(1/sqrt(y*y))* x*128;
}
}
}
void InitFonts()
{
int x, y, i =0;
int n, c;
for (n=0; n<59; n++)
{
for (y=0; y<8; y++)
{
c = bitfonts[i++];
for (x=0; x<8; x++)
{
fonts[(n << 6) + x + (y<<3)] = ((c >> (7 - x)) & 1) * 255;
}
}
}
}
void DrawFont(int xp, int yp, int ch, int bpp, unsigned short* vram)
{
unsigned char *vram8;
unsigned short *vram16;
int cp = ch << 6;
int x, y, yc, yi;
switch(bpp)
{
case 8:
vram8 = (unsigned char*)vram + xp + yp* WIDTH;
for (y=0; y<8; y++)
{
yc = yp + y;
if ((yc>=1) && (yc<HEIGHT - 1))
{
yi = y << 3;
for (x=0; x<8; x++)
{
*vram8++ |= fonts[cp + yi + x];
}
vram8-=8;
}
vram8+=WIDTH;
}
break;
case 16:
vram16 = (unsigned short*)vram + xp + yp * WIDTH;
for (y=0; y<8; y++)
{
yc = yp + y;
if ((yc>=1) && (yc<HEIGHT - 1))
{
yi = y << 3;
for (x=0; x<8; x++)
{
*vram16++ |= shades[3][fonts[cp + yi + x]];
}
vram16-=8;
}
vram16+=WIDTH;
}
break;
default:
break;
}
}
void DrawText_(int xtp, int ytp, int cn, char *text, int bpp, unsigned short *vram)
{
int n;
char c;
for (n = 0; n<cn; n++)
{
c = *text++;
if (c>31 && c<92) DrawFont(xtp, ytp, c - 32, bpp, vram);
else if (c==0) n = cn;
xtp+=8; if (xtp>WIDTH - 1) n = cn;
}
}
void MakeColors(unsigned short cols[], ColorRGB c0, ColorRGB c1, int n0, int n1)
{
float dr,dg,db;
float cr,cg,cb;
cr=c0.r; cg=c0.g; cb=c0.b;
dr=((float)c1.r - (float)c0.r)/(float)(n1 - n0 + 1);
dg=((float)c1.g - (float)c0.g)/(float)(n1 - n0 + 1);
db=((float)c1.b - (float)c0.b)/(float)(n1 - n0 + 1);
int i;
for (i=n0; i<=n1; i++)
{
cr+=dr; cg+=dg; cb+=db;
cols[i]= ((int)cr<<11) | ((int)cg<<5) | (int)cb;
}
}
void MakeSines(int sines[], int n, float freq, float hght1, float hght2)
{
int i;
for (i=0; i<n; i++)
sines[i]=sin(i/freq)*hght1+hght2;
}
void SetColors()
{
ColorRGB c0[4] = {15,0,31, 31,31,0, 31,63,0, 31,63,31};
ColorRGB c1[4] = {7,3,0, 15,7,0, 31,15,0, 31,63,31};
ColorRGB c2[4] = {15,7,0, 31,15,7, 31,63,15, 31,63,31};
ColorRGB conc[4] = {7,15,7, 15,31,15, 15,55,31, 31,63,31};
ColorRGB plsm1[3] = {31,31,7, 7,0,15, 15,7,31};
ColorRGB plsm2[3] = {0,0,0, 7,31,7, 0,0,0};
ColorRGB plsm3[3] = {15,31,0, 15,63,0, 31,63,15};
ColorRGB plsm4[3] = {15,0,0, 31,63,15, 15,31,0};
ColorRGB plsm5[3] = {31,0,0, 15,0,31, 31,63,31};
ColorRGB plsm6[3] = {0,0,0, 31,63,31, 0,0,0};
ColorRGB backmask[4] = {15,31,15, 15,0,15, 31,0,15, 31,63,15};
ColorRGB polar[4] = {0,0,15, 7,31,7, 31,31,0, 31,63,31};
ColorRGB plasma[4] = {15,0,31, 15,31,31, 31,63,31, 15,63,31};
ColorRGB blobcol[3] = {0,0,0, 15,15,31, 23,63,31};
MakeColors (shades[32], blobcol[0], blobcol[1], 0, 127);
MakeColors (shades[32], blobcol[1], blobcol[2], 128, 255);
MakeColors(shades[0], c0[0], c0[1], 0, 159);
MakeColors(shades[0], c0[1], c0[2], 160, 191);
MakeColors(shades[0], c0[2], c0[3], 192, 255);
MakeColors(shades[1], c1[0], c1[1], 0, 127);
MakeColors(shades[1], c1[1], c1[2], 128, 191);
MakeColors(shades[1], c1[2], c1[3], 192, 255);
MakeColors(shades[2], c2[0], c2[1], 0, 63);
MakeColors(shades[2], c2[1], c2[2], 64, 191);
MakeColors(shades[2], c2[2], c2[3], 192, 255);
MakeColors(shades[3], conc[0], conc[1], 0, 63);
MakeColors(shades[3], conc[1], conc[2], 64, 191);
MakeColors(shades[3], conc[2], conc[3], 192, 255);
MakeColors(shades[4], plsm1[0], plsm1[1], 0, 63);
MakeColors(shades[4], plsm1[1], plsm1[2], 64, 127);
MakeColors(shades[4], plsm1[2], plsm1[1], 128, 191);
MakeColors(shades[4], plsm1[1], plsm1[0], 192, 255);
MakeColors(shades[5], plsm2[0], plsm2[1], 0, 63);
MakeColors(shades[5], plsm2[1], plsm2[2], 64, 127);
MakeColors(shades[5], plsm2[2], plsm2[1], 128, 191);
MakeColors(shades[5], plsm2[1], plsm2[0], 192, 255);
MakeColors(shades[6], plsm3[0], plsm3[1], 0, 63);
MakeColors(shades[6], plsm3[1], plsm3[2], 64, 127);
MakeColors(shades[6], plsm3[2], plsm3[1], 128, 191);
MakeColors(shades[6], plsm3[1], plsm3[0], 192, 255);
MakeColors(shades[7], plsm4[0], plsm4[1], 0, 63);
MakeColors(shades[7], plsm4[1], plsm4[2], 64, 127);
MakeColors(shades[7], plsm4[2], plsm4[1], 128, 191);
MakeColors(shades[7], plsm4[1], plsm4[0], 192, 255);
MakeColors(shades[8], plsm5[0], plsm5[1], 0, 63);
MakeColors(shades[8], plsm5[1], plsm5[2], 64, 127);
MakeColors(shades[8], plsm5[2], plsm5[1], 128, 191);
MakeColors(shades[8], plsm5[1], plsm5[0], 192, 255);
MakeColors(shades[9], plsm6[0], plsm6[1], 0, 63);
MakeColors(shades[9], plsm6[1], plsm6[2], 64, 127);
MakeColors(shades[9], plsm6[2], plsm6[1], 128, 191);
MakeColors(shades[9], plsm6[1], plsm6[0], 192, 255);
MakeColors(shades[10], backmask[0], backmask[1], 0, 127);
MakeColors(shades[10], backmask[1], backmask[2], 128, 191);
MakeColors(shades[10], backmask[2], backmask[3], 192, 255);
MakeColors(shades[11], polar[0], polar[1], 0, 127);
MakeColors(shades[11], polar[1], polar[2], 128, 191);
MakeColors(shades[11], polar[2], polar[3], 192, 255);
MakeColors(shades[12], plasma[0], plasma[1], 128, 159);
MakeColors(shades[12], plasma[1], plasma[2], 160, 191);
MakeColors(shades[12], plasma[2], plasma[3], 192, 223);
MakeColors(shades[12], plasma[3], plasma[0], 224, 255);
}
void PrecDivs()
{
int fp = 16;
int i;
for (i=0; i<4096; i++)
{
if ((i-2048)!=0)
pdiv[i] = (1<<fp)/(i-2048);
else
pdiv[i] = (1<<fp);
}
}
void SinePrecs()
{
float d = 2.6;
MakeSines(fsin1, 2048, 30, 96/d, 96/d);
MakeSines(fsin2, 2048, 40, 112/d, 112/d);
MakeSines(fsin3, 2048, 70, 128/d, 128/d);
MakeSines(fsin4, 2048, 16, 8, 0);
MakeSines(fsin5, 2048, 8, 16, 0);
MakeSines(fsin6, 2048, 12, 32, 0);
}
void EffectsInit()
{
SinePrecs();
PrecDivs();
InitFloor();
InitPolar();
InitRadial();
}
void precalcs()
{
InitFonts();
SetColors();
EffectsInit();
Init3d();
}

33
precalcs.h Normal file
View File

@ -0,0 +1,33 @@
#define pi 3.14151693
#define rang 128
#define rang2 256
#define d2r 180.0/pi
#define Twidth 128
#define Theight 128
#define shl_theight 7
#define blob_width 128
#define blob_height 128
#define nstars 256
typedef struct ColorRGB
{
unsigned char r;
unsigned char g;
unsigned char b;
} ColorRGB;
void MakeColors(unsigned short cols[], ColorRGB c0, ColorRGB c1, int n0, int n1);
void MakeSines(int sines[], int n, float freq, float hght1, float hght2);
void SetColors();
void precalcs();
void DrawText_(int xtp, int ytp, int cn, char *text, int bpp, unsigned short *vram);
void InitRadialBitmap1();
void InitRadialBitmap2();

1839
render3d.c Normal file

File diff suppressed because it is too large Load Diff

2
render3d.h Normal file
View File

@ -0,0 +1,2 @@
void RenderOld(object3d *obj, int shadenum, unsigned short *vram);
void Render(object3d *obj, unsigned short *vram);

BIN
sce_sys/creeptea.mod Normal file

Binary file not shown.

BIN
sce_sys/gp2x.3do Normal file

Binary file not shown.

BIN
sce_sys/icon0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<livearea style="a1" format-ver="01.00" content-rev="1">
<livearea-background>
<image>bg.png</image>
</livearea-background>
<gate>
<startup-image>startup.png</startup-image>
</gate>
</livearea>

BIN
sce_sys/magnolia.3do Normal file

Binary file not shown.

4096
sky1.c Normal file

File diff suppressed because it is too large Load Diff

1024
sky2.c Normal file

File diff suppressed because it is too large Load Diff

4800
sky3.c Normal file

File diff suppressed because it is too large Load Diff