triplane-1.0.8/ 0000755 0001753 0001753 00000000000 12112434442 012321 5 ustar lindi lindi triplane-1.0.8/tools/ 0000755 0001753 0001753 00000000000 12112433132 013454 5 ustar lindi lindi triplane-1.0.8/tools/build-data-from-source 0000755 0001753 0001753 00000001136 11463352370 017664 0 ustar lindi lindi #!/bin/bash
set -e
cat data_src/pcx.lst | while read pgd pcx name end width height; do
echo "pgd $pgd pcx $pcx name $name end $end width $width height $height"
tools/pcx2pgd $(echo $pcx | sed 's/.pcx$//') dummy $width $height > /dev/null
printf "$name" | dd bs=1 seek=8 count=7 of=$(echo $pcx | sed 's/.pcx$/.pgd/') conv=notrunc 2> /dev/null
printf "$end" | dd bs=1 seek=$(expr $(find $(echo $pcx | sed 's/.pcx$/.pgd/') -printf %s) - 1) count=1 of=$(echo $pcx | sed 's/.pcx$/.pgd/') conv=notrunc 2> /dev/null
mkdir -p $(dirname $pgd)
mv $(echo $pcx | sed 's/.pcx$/.pgd/') $pgd
done
triplane-1.0.8/tools/run-all-tests 0000644 0001753 0001753 00000000346 12112432727 016125 0 ustar lindi lindi #!/bin/bash
set -e
tester="$1"
triplane="$2"
testdir="$3"
for test in `find "$testdir" -mindepth 1 -type d | grep -v _darcs`; do
echo "Running test $test"
bash "$tester" "$triplane" "$test"
done
echo "All tests passed."
triplane-1.0.8/tools/run-one-test 0000644 0001753 0001753 00000000632 12112432725 015747 0 ustar lindi lindi #!/bin/bash
set -e
triplane="$1"
testdir="$2"
tmptestdir="`mktemp -d --tmpdir triplane-testsuite.XXXXXXXXXX`"
(cd "$testdir"; cp -R . "$tmptestdir")
TRIPLANE_HOME="$tmptestdir" "$triplane" `cat "$tmptestdir/args"` > "$tmptestdir/output" || true
if ! cmp --quiet "$testdir/output.reference" "$tmptestdir/output"; then
echo "Test failed. Please investigate $tmptestdir"
exit 1
fi
rm -r "$tmptestdir"
triplane-1.0.8/src/ 0000755 0001753 0001753 00000000000 12112433132 013103 5 ustar lindi lindi triplane-1.0.8/src/tools/ 0000755 0001753 0001753 00000000000 11627240654 014262 5 ustar lindi lindi triplane-1.0.8/src/tools/dat2c/ 0000755 0001753 0001753 00000000000 11627154073 015256 5 ustar lindi lindi triplane-1.0.8/src/tools/dat2c/dat2c.cpp 0000644 0001753 0001753 00000004156 11463305035 016757 0 ustar lindi lindi /*
* Triplane Classic - a side-scrolling dogfighting game.
* Copyright (C) 1996,1997,2009 Dodekaedron Software Creations Oy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* tjt@users.sourceforge.net
*/
/*******************************************************************************
Purpose: Converts files to unsigned char strings in c
*******************************************************************************/
#include
#include
#include
int main(int argc, char **argv) {
unsigned char *data;
FILE *faili;
int c;
int size;
printf("\nDat2C (c) 1996 Wraith/DKS\n\n");
if (argc != 3) {
printf("Usage: DAT2C inputfile outputfile\n");
exit(0);
}
if ((faili = fopen(argv[1], "rb")) == NULL) {
printf("Unable to open file %s\n", argv[1]);
exit(1);
}
size = filelength(fileno(faili));
data = (unsigned char *) malloc(size);
if (data == NULL) {
printf("Out of memory\n");
fclose(faili);
exit(1);
}
fread(data, size, 1, faili);
fclose(faili);
faili = fopen(argv[2], "wt");
fprintf(faili, "/* Dat2C converted data begins here*/\n\n");
fprintf(faili, "unsigned char converted_data[%d] = {\n", size);
for (c = 0; c < (size - 1); c++) {
fprintf(faili, "%d,", data[c]);
if (c && (!(c % 32)))
fprintf(faili, "\n");
}
fprintf(faili, "%d };", data[c]);
fprintf(faili, "\n\n/* Dat2C converted data ends here */\n");
fclose(faili);
}
triplane-1.0.8/src/tools/dat2c/pgd2c.cpp 0000644 0001753 0001753 00000003722 11627154073 016765 0 ustar lindi lindi /*
* Triplane Classic - a side-scrolling dogfighting game.
* Copyright (C) 1996,1997,2009 Dodekaedron Software Creations Oy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* tjt@users.sourceforge.net
*/
/*******************************************************************************
Purpose: Converts files to unsigned char strings in c
*******************************************************************************/
#include
#include
#include
#include "../wsystem.h"
int main(int argc, char **argv) {
unsigned char *data;
FILE *faili;
int c;
int size;
Bitmap *pict;
int x, y;
printf("\nDat2C (c) 1996 Wraith/DKS\n\n");
if (argc != 3) {
printf("Usage: PGD2C inputfile outputfile\nNo extension in inputfile\n\n");
exit(0);
}
pict = new Bitmap(argv[1]);
data = pict->info(&x, &y);
size = x * y;
faili = fopen(argv[2], "wt");
fprintf(faili, "/* Pgd2C converted data begins here*/\n /* %dx%d picture*/\n\n", x, y);
fprintf(faili, "unsigned char converted_data[%d] = {\n", size);
for (c = 0; c < (size - 1); c++) {
fprintf(faili, "%d,", data[c]);
if (c && (!(c % 32)))
fprintf(faili, "\n");
}
fprintf(faili, "%d };", data[c]);
fprintf(faili, "\n\n/* Pgd2C converted data ends here */\n");
fclose(faili);
delete pict;
}
triplane-1.0.8/src/tools/lvledit/ 0000755 0001753 0001753 00000000000 12112433132 015706 5 ustar lindi lindi triplane-1.0.8/src/tools/lvledit/lvledit.cpp 0000644 0001753 0001753 00000041512 11324624322 020067 0 ustar lindi lindi /*
* Triplane Classic - a side-scrolling dogfighting game.
* Copyright (C) 1996,1997,2009 Dodekaedron Software Creations Oy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* tjt@users.sourceforge.net
*/
#include "gfx/gfx.h"
#include "io/trip_io.h"
#include
#include "io/sdl_compat.h"
#include
#include
#include
#define MAX_STRUCTURES 100
#define MAX_TYPES 3
#define AIRFIELD_LENGHT 110
#define MIN_AIRFIELD_LENGHT 40
#define MAX_AIRFIELD_LENGHT 200
struct level_struct {
char pb_name[8];
char pd_name[MAX_STRUCTURES][8];
int32_t struct_x[MAX_STRUCTURES];
int32_t struct_y[MAX_STRUCTURES];
int32_t struct_hit[MAX_STRUCTURES];
int32_t struct_owner[MAX_STRUCTURES];
int32_t struct_type[MAX_STRUCTURES];
int32_t airfield_x[4];
int32_t airfield_y[4];
int32_t airfield_lenght[4];
int32_t plane_direction[4];
} leveldata;
Bitmap *pb_picture;
Bitmap *struct_picture[MAX_STRUCTURES];
Bitmap *hiirikursori = NULL;
Bitmap *hiirik;
Bitmap *lappu1;
Bitmap *lappu2;
//Bitmap *plane[4];
int picture_width[MAX_STRUCTURES];
int picture_height[MAX_STRUCTURES];
Font *fontti;
const char hitting_names[2][16] = {
"UNHITTABLE", "HITTABLE"
};
const char owner_names[5][12] = {
"GERMAN", "FINNISH", "ENGLISH", "JAPANESE", "NEUTRAL"
};
char filename[80];
const char type_names[MAX_TYPES][16] = {
"Decoration",
"Dest",
"Survi"
};
void swap_byte_order(void) {
int i;
for (i = 0; i < MAX_STRUCTURES; i++) {
leveldata.struct_x[i] = SDL_SwapLE32(leveldata.struct_x[i]);
leveldata.struct_y[i] = SDL_SwapLE32(leveldata.struct_y[i]);
leveldata.struct_hit[i] = SDL_SwapLE32(leveldata.struct_hit[i]);
leveldata.struct_owner[i] = SDL_SwapLE32(leveldata.struct_owner[i]);
leveldata.struct_type[i] = SDL_SwapLE32(leveldata.struct_type[i]);
}
for (i = 0; i < 4; i++) {
leveldata.airfield_x[i] = SDL_SwapLE32(leveldata.airfield_x[i]);
leveldata.airfield_y[i] = SDL_SwapLE32(leveldata.airfield_y[i]);
leveldata.airfield_lenght[i] = SDL_SwapLE32(leveldata.airfield_lenght[i]);
leveldata.plane_direction[i] = SDL_SwapLE32(leveldata.plane_direction[i]);
}
}
void omaline(int x1, int y1, int x2, int y2, unsigned char c) {
if (x1 >= 320 || x2 < 0)
return;
if (y1 >= 320 || y2 < 0)
return;
if (x1 < 0)
x1 = 0;
if (x2 >= 320)
x2 = 319;
if (y1 < 0)
y1 = 0;
if (y2 >= 200)
y2 = 199;
draw_line(x1, y1, x2, y2, c);
}
void edit_level(void) {
int ch = 0;
int kohta = 0;
int c;
int x, y, n1, n2;
int current = -1;
int active = -1;
int airfield_set = -1;
unsigned char colori = 0;
FILE *faili;
Bitmap *pointti;
pointti = new Bitmap(1, 1, &colori);
while (!(ch == SDLK_ESCAPE)) {
colori++;
pb_picture->blit(-kohta, 0);
for (c = 0; c < MAX_STRUCTURES; c++) {
if (leveldata.struct_x[c]) {
struct_picture[c]->blit(leveldata.struct_x[c] - kohta, leveldata.struct_y[c]);
}
}
if (active != -1) {
if (leveldata.struct_x[active] >= kohta && leveldata.struct_x[active] <= (kohta + 300))
boxi(leveldata.struct_x[active] - kohta,
leveldata.struct_y[active],
leveldata.struct_x[active] - kohta + picture_width[active], leveldata.struct_y[active] + picture_height[active], 1);
}
for (c = 0; c < 4; c++)
if (leveldata.airfield_x[c])
omaline(leveldata.airfield_x[c] - kohta, leveldata.airfield_y[c],
leveldata.airfield_x[c] - kohta + leveldata.airfield_lenght[c], leveldata.airfield_y[c], colori);
if (active != -1) {
lappu1->blit(220, 0);
fontti->printf(235, 4, "%s", leveldata.pd_name[active]);
fontti->printf(235, 14, "X:%d Y:%d", leveldata.struct_x[active], leveldata.struct_y[active]);
fontti->printf(235, 23, "%s", owner_names[leveldata.struct_owner[active]]);
fontti->printf(235, 32, "%s", hitting_names[leveldata.struct_hit[active]]);
fontti->printf(235, 41, "%s", type_names[leveldata.struct_type[active]]);
}
lappu2->blit(262, 184);
fontti->printf(265, 188, "%s", leveldata.pb_name);
koords(&x, &y, &n1, &n2);
hiirikursori->blit(x, y);
if (airfield_set != -1 && (n1 || n2)) {
hiirikursori = hiirik;
leveldata.airfield_x[airfield_set] = x + kohta;
leveldata.airfield_y[airfield_set] = y;
if (n1)
leveldata.plane_direction[airfield_set] = 0;
else
leveldata.plane_direction[airfield_set] = 1;
airfield_set = -1;
}
if (n1 && (current != -1)) {
leveldata.struct_x[current] = x + kohta;
leveldata.struct_y[current] = y;
hiirikursori = hiirik;
current = -1;
} else if (n1 && (active == -1)) {
for (c = 0; c < MAX_STRUCTURES; c++) {
if ((x + kohta) >= leveldata.struct_x[c] &&
(x + kohta) <= (leveldata.struct_x[c] + picture_width[c]) && y >= leveldata.struct_y[c] && y <= (leveldata.struct_y[c] + picture_height[c]))
break;
}
if (c != MAX_STRUCTURES) {
active = c;
}
}
if (n2 && (active != -1)) {
active = -1;
}
do_all();
//while(!kbhit());
if (kbhit()) {
ch = getch();
switch (ch) {
case SDLK_F2:
swap_byte_order();
faili = fopen(filename, "wb");
fwrite(&leveldata, sizeof(leveldata), 1, faili);
fclose(faili);
swap_byte_order();
break;
case SDLK_INSERT:
if (active != -1)
break;
for (c = 0; c < MAX_STRUCTURES; c++)
if (!leveldata.struct_x[c])
break;
if (c == MAX_STRUCTURES)
break;
fontti->printf(10, 10, "StructureNAME");
fontti->scanf(10, 20, leveldata.pd_name[c], 6);
if (!leveldata.pd_name[c][0])
break;
if (!bitmap_exists(leveldata.pd_name[c]))
break;
struct_picture[c] = new Bitmap(leveldata.pd_name[c]);
hiirikursori = struct_picture[c];
hiirikursori->info(&picture_width[c], &picture_height[c]);
current = c;
break;
case SDLK_F5:
if (active != -1)
break;
for (c = 0; c < MAX_STRUCTURES; c++)
if (!leveldata.struct_x[c])
break;
if (c == MAX_STRUCTURES)
break;
strcpy(leveldata.pd_name[c], "INFAN");
if (!bitmap_exists(leveldata.pd_name[c]))
break;
leveldata.struct_owner[c] = 0;
leveldata.struct_type[c] = 0;
struct_picture[c] = new Bitmap(leveldata.pd_name[c]);
hiirikursori = struct_picture[c];
hiirikursori->info(&picture_width[c], &picture_height[c]);
current = c;
break;
case SDLK_F6:
if (active != -1)
break;
for (c = 0; c < MAX_STRUCTURES; c++)
if (!leveldata.struct_x[c])
break;
if (c == MAX_STRUCTURES)
break;
strcpy(leveldata.pd_name[c], "INFAN");
if (!bitmap_exists(leveldata.pd_name[c]))
break;
leveldata.struct_owner[c] = 1;
leveldata.struct_type[c] = 0;
struct_picture[c] = new Bitmap(leveldata.pd_name[c]);
hiirikursori = struct_picture[c];
hiirikursori->info(&picture_width[c], &picture_height[c]);
current = c;
break;
case SDLK_F7:
if (active != -1)
break;
for (c = 0; c < MAX_STRUCTURES; c++)
if (!leveldata.struct_x[c])
break;
if (c == MAX_STRUCTURES)
break;
strcpy(leveldata.pd_name[c], "INFAN");
if (!bitmap_exists(leveldata.pd_name[c]))
break;
leveldata.struct_owner[c] = 2;
leveldata.struct_type[c] = 0;
struct_picture[c] = new Bitmap(leveldata.pd_name[c]);
hiirikursori = struct_picture[c];
hiirikursori->info(&picture_width[c], &picture_height[c]);
current = c;
break;
case SDLK_F8:
if (active != -1)
break;
for (c = 0; c < MAX_STRUCTURES; c++)
if (!leveldata.struct_x[c])
break;
if (c == MAX_STRUCTURES)
break;
strcpy(leveldata.pd_name[c], "INFAN");
if (!bitmap_exists(leveldata.pd_name[c]))
break;
leveldata.struct_owner[c] = 3;
leveldata.struct_type[c] = 0;
struct_picture[c] = new Bitmap(leveldata.pd_name[c]);
hiirikursori = struct_picture[c];
hiirikursori->info(&picture_width[c], &picture_height[c]);
current = c;
break;
case SDLK_DELETE:
if (active != -1) {
leveldata.struct_x[active] = 0;
delete struct_picture[active];
active = -1;
}
break;
case SDLK_HOME:
if (active != -1) {
leveldata.struct_owner[active]++;
if (leveldata.struct_owner[active] >= 5)
leveldata.struct_owner[active] = 0;
}
break;
case SDLK_END:
if (active != -1) {
leveldata.struct_hit[active]++;
if (leveldata.struct_hit[active] >= 2)
leveldata.struct_hit[active] = 0;
}
break;
case SDLK_RIGHT:
kohta += 106;
if (kohta > 2080)
kohta = 2080;
break;
case SDLK_LEFT:
kohta -= 106;
if (kohta < 0)
kohta = 0;
break;
case SDLK_PAGEUP:
char temp_stringi[10];
temp_stringi[0] = 0;
fontti->scanf(265, 178, temp_stringi, 6);
if (!bitmap_exists(temp_stringi))
break;
strcpy(leveldata.pb_name, temp_stringi);
delete pb_picture;
pb_picture = new Bitmap(temp_stringi);
break;
case SDLK_PAGEDOWN:
if (active != -1) {
leveldata.struct_type[active]++;
if (leveldata.struct_type[active] >= MAX_TYPES)
leveldata.struct_type[active] = 0;
}
break;
case SDLK_q:
leveldata.airfield_lenght[0]++;
if (leveldata.airfield_lenght[0] > MAX_AIRFIELD_LENGHT)
leveldata.airfield_lenght[0] = MAX_AIRFIELD_LENGHT;
break;
case SDLK_w:
leveldata.airfield_lenght[1]++;
if (leveldata.airfield_lenght[1] > MAX_AIRFIELD_LENGHT)
leveldata.airfield_lenght[1] = MAX_AIRFIELD_LENGHT;
break;
case SDLK_e:
leveldata.airfield_lenght[2]++;
if (leveldata.airfield_lenght[2] > MAX_AIRFIELD_LENGHT)
leveldata.airfield_lenght[2] = MAX_AIRFIELD_LENGHT;
break;
case SDLK_r:
leveldata.airfield_lenght[3]++;
if (leveldata.airfield_lenght[3] > MAX_AIRFIELD_LENGHT)
leveldata.airfield_lenght[3] = MAX_AIRFIELD_LENGHT;
break;
case SDLK_a:
leveldata.airfield_lenght[0]--;
if (leveldata.airfield_lenght[0] < MIN_AIRFIELD_LENGHT)
leveldata.airfield_lenght[0] = MIN_AIRFIELD_LENGHT;
break;
case SDLK_s:
leveldata.airfield_lenght[1]--;
if (leveldata.airfield_lenght[1] < MIN_AIRFIELD_LENGHT)
leveldata.airfield_lenght[1] = MIN_AIRFIELD_LENGHT;
break;
case SDLK_d:
leveldata.airfield_lenght[2]--;
if (leveldata.airfield_lenght[2] < MIN_AIRFIELD_LENGHT)
leveldata.airfield_lenght[2] = MIN_AIRFIELD_LENGHT;
break;
case SDLK_f:
leveldata.airfield_lenght[3]--;
if (leveldata.airfield_lenght[3] < MIN_AIRFIELD_LENGHT)
leveldata.airfield_lenght[3] = MIN_AIRFIELD_LENGHT;
break;
case SDLK_PLUS:
if (active == -1 || active == 99)
break;
if (leveldata.struct_x[active + 1]);
active++;
break;
case SDLK_MINUS:
if (active < 1)
break;
if (leveldata.struct_x[active - 1]);
active--;
break;
default:
if ((ch >= SDLK_1) && (ch <= SDLK_4)) {
airfield_set = ch - SDLK_1;
hiirikursori = pointti;
}
break;
}
}
}
delete pointti;
}
int main(int argc, char **argv) {
FILE *faili;
int c;
printf("\n");
printf(" Lvledit for Triplane Copyright (c) 1996 Dodekaedron Software Creations, Inc.");
printf("\n\r\n\r");
if (argc != 2) {
printf("Usage: LVLEDIT level_filename\n");
exit(1);
}
printf("Loading directory structure\n\r");
dksinit("fokker.dks");
strcpy(filename, argv[1]);
if ((faili = fopen(filename, "rb")) == NULL) {
printf("Creating new level.\n\r");
strcpy(leveldata.pb_name, "MAISDT");
for (c = 0; c < MAX_STRUCTURES; c++) {
leveldata.struct_x[c] = 0;
leveldata.struct_y[c] = 0;
leveldata.struct_hit[c] = 0;
leveldata.pd_name[c][0] = 0;
leveldata.struct_owner[c] = 4;
leveldata.struct_type[c] = 0;
}
for (c = 0; c < 4; c++) {
leveldata.airfield_x[c] = 0;
leveldata.airfield_y[c] = 0;
leveldata.airfield_lenght[c] = 110;
leveldata.plane_direction[c] = 0;
}
} else {
printf("Loading existing level.\n\r");
fread(&leveldata, sizeof(leveldata), 1, faili);
fclose(faili);
for (c = 0; c < MAX_STRUCTURES; c++) {
if (leveldata.struct_x[c]) {
struct_picture[c] = new Bitmap(leveldata.pd_name[c]);
struct_picture[c]->info(&picture_width[c], &picture_height[c]);
}
}
}
printf("Loading font \"FROST\"\n\r");
fontti = new Font("G2FONT");
printf("Loading cursor\n\r");
hiirik = new Bitmap("FONTT1");
hiirikursori = hiirik;
if (leveldata.pb_name[0]) {
printf("Loading background picture\n\r");
pb_picture = new Bitmap(leveldata.pb_name);
}
printf("Loading background papers\n\r");
lappu1 = new Bitmap("LAPPU1");
lappu2 = new Bitmap("LAPPU2");
init_vga("PALET5");
edit_level();
swap_byte_order();
faili = fopen(filename, "wb");
fwrite(&leveldata, sizeof(leveldata), 1, faili);
fclose(faili);
swap_byte_order();
delete pb_picture;
delete lappu1;
delete lappu2;
delete hiirik;
delete fontti;
for (c = 0; c < MAX_STRUCTURES; c++)
if (leveldata.struct_x[c])
delete struct_picture[c];
return 0;
}
triplane-1.0.8/src/tools/pcx2pgd/ 0000755 0001753 0001753 00000000000 11627246166 015635 5 ustar lindi lindi triplane-1.0.8/src/tools/pcx2pgd/pcx2pgd.cpp 0000644 0001753 0001753 00000022652 11463347012 017705 0 ustar lindi lindi /*
* Triplane Classic - a side-scrolling dogfighting game.
* Copyright (C) 1996,1997,2009 Dodekaedron Software Creations Oy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* tjt@users.sourceforge.net
*/
/*******************************************************************************
Purpose:
.PCX to .PGD graphics converter for Wsystem 2.0 for DJGPP v.2.0á5
*******************************************************************************/
#include
#include
#include
#include
#include
#include
/* Dummy relics from DOS age. */
void gotoxy(int x, int y) {
}
int wherey(void) {
return 0;
}
#define RAJA 192
unsigned char getpixel(int x, int y);
unsigned char *vkuva;
unsigned char *kuvadata;
char paletti[256][3];
void talleta_paletti() {
FILE *out;
if ((out = fopen("paletdta.000", "wb")) == NULL) {
printf("\nError opening file: paletdta.000 \n");
exit(1);
}
fwrite(paletti, sizeof(paletti), 1, out);
fclose(out);
}
void pakit(int dx, int dy, char inputfile[], char picturename[]) {
FILE *in, *out;
long int xx, yy;
short int x, y;
char inf[FILENAME_MAX], outf[FILENAME_MAX];
unsigned char vali;
unsigned int lippu, lask, lask2, lask3;
unsigned char *pointteri, *pointteri2;
char kuvan_nimi[7];
//int prossa,vprossa;
double p;
long int koko;
int debug = 0;
strcpy(inf, inputfile);
strcpy(outf, inputfile);
strcat(inf, ".gra");
strcat(outf, ".pgd");
strcpy(kuvan_nimi, picturename);
x = dx;
y = dy;
xx = x;
yy = y;
koko = xx * yy;
pointteri2 = (unsigned char *) malloc(800000);
if (pointteri2 == NULL) {
printf("Error in memory allocation -- %u bytes\n", x * y);
exit(1);
}
pointteri = vkuva;
if ((out = fopen(outf, "wb")) == NULL) {
printf("Error opening file %s", outf);
exit(1);
}
lippu = 1;
lask = 0;
lask2 = 0;
// vprossa=prossa=0;
if (debug) {
printf("Picturename: %6s Size: %lu bytes.\n", kuvan_nimi, koko);
}
while (lippu) {
if (pointteri[lask] == pointteri[lask + 1]) {
if (debug) {
gotoxy(60, wherey());
printf("Match found\n");
}
for (lask3 = lask; ((*(pointteri + lask3) == *(pointteri + lask)) && (lask3 < (koko - 1)) && (lask3 - lask) < (255 - RAJA)); lask3++);
if ((lask3 - lask) >= 2) {
vali = RAJA;
vali += (lask3 - lask);
*(pointteri2 + lask2) = vali;
*(pointteri2 + lask2 + 1) = *(pointteri + lask);
if (debug) {
printf("%2x ", vali);
printf("%2x ", *(pointteri + lask));
}
lask += (lask3 - lask);
lask2 += 2;
} else {
if (debug) {
gotoxy(60, wherey());
printf("in 3rd round now\n");
}
if (*(pointteri + lask) <= RAJA) {
*(pointteri2 + lask2) = *(pointteri + lask);
//printf("%2x ",*(pointteri+lask));
} else {
*(pointteri2 + lask2) = RAJA + 1;
*(pointteri2 + lask2 + 1) = *(pointteri + lask);
lask2++;
if (debug) {
printf("%2x ", RAJA + 1);
printf("%2x ", *(pointteri + lask));
}
}
lask++;
lask2++;
if (lask >= (int) koko) {
lippu = 0;
gotoxy(60, wherey());
if (debug)
printf("Normal brake\n");
break;
}
}
} else {
if (*(pointteri + lask) <= RAJA) {
*(pointteri2 + lask2) = *(pointteri + lask);
if (debug)
printf("%2x ", *(pointteri + lask));
} else {
*(pointteri2 + lask2) = RAJA + 1;
*(pointteri2 + lask2 + 1) = *(pointteri + lask);
lask2++;
if (debug) {
printf("%2x ", RAJA + 1);
printf("%2x ", *(pointteri + lask));
}
}
lask++;
lask2++;
if (lask >= (int) koko) {
lask += 2;
lippu = 0;
gotoxy(60, wherey());
if (debug)
printf("Normal brake (1-part)\n");
break;
}
}
}
printf("\nNew Size: %u (+13 bytes) Ratio : %5.2f", lask2 + 1, (100.0 - ((lask2 * 1.0 + 1.0) * 100L) / (koko * 1.0)));
fwrite(&x, sizeof(x), 1, out);
fwrite(&y, sizeof(y), 1, out);
lask2++; /* Why? Last byte is always uninitialized according to valgrind. */
fwrite(&lask2, sizeof(lask2), 1, out);
fwrite(kuvan_nimi, sizeof(kuvan_nimi), 1, out);
fwrite(pointteri2, lask2, 1, out);
fclose(out);
free(pointteri2);
}
void pcx_load(char *file_name, short int *xl, short int *yl) {
unsigned char a, b;
int l, loop;
FILE *fp;
fp = fopen(file_name, "rb");
if (fp == NULL) {
printf("Error opening file\n");
exit(1);
}
fseek(fp, 8, SEEK_SET);
fread(xl, 2, 1, fp);
fread(yl, 2, 1, fp);
(*xl)++;
(*yl)++;
fseek(fp, 128, SEEK_SET);
l = 0;
while (l < (*xl) * (*yl)) {
a = fgetc(fp);
if (a >= 0xc0) {
b = fgetc(fp);
for (loop = 0; loop < (a & 0x3f); loop++) {
kuvadata[l] = b;
l++;
}
} else {
kuvadata[l] = a;
l++;
}
}
fseek(fp, -768, SEEK_END);
for (loop = 0; loop < 256; loop++) {
paletti[loop][0] = fgetc(fp) >> 2;
paletti[loop][1] = fgetc(fp) >> 2;
paletti[loop][2] = fgetc(fp) >> 2;
}
fclose(fp);
}
int main(int argc, char *argv[]) {
char infile[FILENAME_MAX], outfile[FILENAME_MAX];
char dxs[5], dys[5];
int dx, dy;
char ch;
short int leveys, korkeus;
int laskx, lasky, lask;
char stringi1[FILENAME_MAX], stringi2[FILENAME_MAX];
FILE *out;
printf("\nPcx2pgd v. 1.14 For Wsystem 2.0 (c) 1996 Dodekaedron Software Creations, Inc.\n");
printf(" This program is registered to Dodekaedron Squad. All rights reserved.\n\n");
if (!(argc == 5 || argc == 3 || argc == 2)) {
printf("\nUsage: PCX2PGD inputfile picturename [delta-x delta-y]\n");
printf("Or: PCX2PGD inputfile (creates palet)\n");
printf(" NOTE: Filenames are given without extension!\n");
exit(1);
}
vkuva = (unsigned char *) malloc(800000);
if (vkuva == NULL) {
printf("Error in memory allocation -- 800000 bytes\n");
exit(1);
}
kuvadata = (unsigned char *) malloc(800000);
if (kuvadata == NULL) {
printf("Error in memory allocation -- 800000 bytes\n");
exit(1);
}
strcpy(infile, argv[1]);
strcpy(stringi1, argv[1]);
strcpy(outfile, argv[1]);
if (argc >= 3)
strcpy(stringi2, argv[2]);
if (argc == 5) {
strcpy(dxs, argv[3]);
strcpy(dys, argv[4]);
dx = atoi(dxs);
dy = atoi(dys);
if (dx == 0)
argc = 3;
}
printf("Loading pcx image %s.pcx...\n", infile);
strcat(infile, ".pcx");
pcx_load(infile, &leveys, &korkeus);
if (argc == 2) {
printf("Saving palet.\n");
talleta_paletti();
exit(0);
}
if (argc != 5) {
dx = leveys;
dy = korkeus;
}
printf("Loading complete.\n");
printf("Imagesize %dx%d.\n", leveys, korkeus);
/* leveys=dx;
korkeus=dy;
*/
if (argc == 3) {
for (laskx = 0; laskx < leveys; laskx++)
for (lasky = 0; lasky < korkeus; lasky++) {
lask = kuvadata[laskx + lasky * leveys];
if (lask == 254) {
/*dx=leveys=laskx;
dy=korkeus=lasky; */
dx = laskx;
dy = lasky;
}
}
}
printf("Sizedata dX:%d dY:%d\n", dx, dy);
printf("Converting to new size...\n");
for (int lx = 0; lx < dx; lx++)
for (int ly = 0; ly < dy; ly++)
vkuva[lx + dx * ly] = kuvadata[lx + ly * leveys];
printf("Conversion complete.\n");
/*
fwrite(&leveys,sizeof(leveys),1,out);
fwrite(&korkeus,sizeof(korkeus),1,out);
fwrite(&vkuva,(dx*dy),1,out);
fclose(out); // suljetaan file
*/
printf("Packing data...\n");
pakit(dx, dy, stringi1, stringi2);
if (argc == 3)
printf("\nNote: autocoordinates were used. Size is : ( %d , %d )", dx, dy);
free(kuvadata);
free(vkuva);
return (0);
}
triplane-1.0.8/src/tools/pgdview/ 0000755 0001753 0001753 00000000000 12112433132 015710 5 ustar lindi lindi triplane-1.0.8/src/tools/pgdview/pgdview.cpp 0000644 0001753 0001753 00000004511 11627142122 020070 0 ustar lindi lindi /*
* Triplane Classic - a side-scrolling dogfighting game.
* Copyright (C) 1996,1997,2009 Dodekaedron Software Creations Oy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* tjt@users.sourceforge.net
*/
/*******************************************************************************
Purpose:
DKS-datafile viewer for Wsystem 2.0 for DJGPP v.2.0á5
*******************************************************************************/
#include "io/trip_io.h"
#include "gfx/gfx.h"
#include
#include
#include
#define MAX_ENTRIES 8192
/* XXXX */
#pragma pack(1)
struct main_directory_entry {
char nimi[7];
unsigned long int offset __attribute__ ((packed));
unsigned long int koko __attribute__ ((packed));
};
#pragma pack()
extern main_directory_entry *dirri;
int main(int argv, char *argc[]) {
char nimi[30];
int lask, lask2 = 0;
wantfullscreen = 0;
printf("PGDView 1.1 for Wsystem. (c) 1996 Dodekaedron Software Creations, Inc.\n\n");
if ((argv != 3) && (argv != 2)) {
printf("Usage: PGDVIEW dks-datafilename [picturename] (no extension)\n");
exit(1);
}
strcpy(nimi, argc[1]);
strcat(nimi, ".dks");
dksinit(nimi);
if (argv == 3) {
init_vga("PALET1");
tyhjaa_vircr();
Bitmap kuva(argc[2]);
kuva.blit(0, 0);
do_all_clear();
getch();
} else {
printf("\n");
for (lask = 0; lask < MAX_ENTRIES; lask++) {
if (!dirri[lask].nimi[0])
break;
printf("%-6s ", dirri[lask].nimi);
lask2++;
if (lask2 == 10) {
lask2 = 0;
printf("\n");
}
}
}
printf("\n");
return 0;
}
triplane-1.0.8/src/tools/dksbuild/ 0000755 0001753 0001753 00000000000 11463305035 016054 5 ustar lindi lindi triplane-1.0.8/src/tools/dksbuild/dksbuild.cc 0000644 0001753 0001753 00000014167 11463305035 020175 0 ustar lindi lindi /*
* Triplane Classic - a side-scrolling dogfighting game.
* Copyright (C) 1996,1997,2009 Dodekaedron Software Creations Oy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* tjt@users.sourceforge.net
*/
/*******************************************************************************
Purpose:
Wsystem 2.0 Databuilder.
*******************************************************************************/
#include
#include
#include
#include
#define MAX_ENTRIES 8192
#pragma pack(1)
struct main_directory_entry {
char nimi[7];
unsigned long int offset;
unsigned long int koko;
};
#pragma pack()
struct buildaus_info {
char nimi[7];
char tiedosto[80];
unsigned long int koko;
};
int filelength(FILE *faili)
{
int position;
int size;
position=ftell(faili);
fseek(faili,0,SEEK_END);
size=ftell(faili);
fseek(faili,position,SEEK_SET);
return size;
}
int main(int argc,char **argv)
{
FILE *in,*out;
char tekstia[20];
int kohtien_lukumaara=0;
char ch;
char file_to_be[80];
int monesko_merkki;
int vaihe;
buildaus_info *info;
main_directory_entry *dirri;
unsigned char *tila;
unsigned long koko;
unsigned long offset;
char crypt_key[80]="";
int crypt_length;
int c_counter;
unsigned char *crypt_pointer;
int key_counter;
int reg_number=5324434;
if( (info=(buildaus_info *) malloc (MAX_ENTRIES*sizeof(buildaus_info))) ==NULL)
{
printf("Out of memory");
exit(1);
}
if( (dirri=(main_directory_entry *) malloc (MAX_ENTRIES*sizeof(main_directory_entry))) ==NULL)
{
printf("Out of memory");
exit(1);
}
if( (tila=(unsigned char* ) malloc(8000000))==NULL)
{
printf("Out of memory");
exit(1);
}
printf("\nDKS Databuilder 2.1 for Wsystem Copyright (C) 1996 Wraith\n");
if(argc<2)
{
printf("\nUSAGE: DKSBUILD indexfilename\n");
exit(1);
}
for(vaihe=0;vaihe