~ubuntu-branches/ubuntu/trusty/triplane/trusty

« back to all changes in this revision

Viewing changes to src/tools/pgdview/pgdview.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Timo Juhani Lindfors
  • Date: 2011-06-04 01:05:46 UTC
  • Revision ID: james.westby@ubuntu.com-20110604010546-isnqom254v96pugx
Tags: upstream-1.0.6
Import upstream version 1.0.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
 * Triplane Classic - a side-scrolling dogfighting game.
 
3
 * Copyright (C) 1996,1997,2009  Dodekaedron Software Creations Oy
 
4
 * 
 
5
 * This program is free software: you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License as published by
 
7
 * the Free Software Foundation, either version 3 of the License, or
 
8
 * (at your option) any later version.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
 *
 
18
 * tjt@users.sourceforge.net
 
19
 */
 
20
 
 
21
/*******************************************************************************
 
22
 
 
23
   Purpose: 
 
24
        DKS-datafile viewer for Wsystem 2.0 for DJGPP v.2.0�5
 
25
 
 
26
*******************************************************************************/
 
27
 
 
28
 
 
29
#include "io/trip_io.h"
 
30
#include "gfx/gfx.h"
 
31
#include <stdio.h>
 
32
#include <string.h>
 
33
#include <stdlib.h>
 
34
 
 
35
#define MAX_ENTRIES 8192
 
36
 
 
37
/* XXXX */
 
38
#pragma pack(1)
 
39
struct main_directory_entry {
 
40
    char nimi[7];
 
41
    unsigned long int offset __attribute__ ((packed));
 
42
    unsigned long int koko __attribute__ ((packed));
 
43
};
 
44
 
 
45
#pragma pack()
 
46
 
 
47
extern main_directory_entry *dirri;
 
48
 
 
49
int main(int argv, char *argc[]) {
 
50
    char nimi[30];
 
51
    int lask, lask2 = 0;
 
52
 
 
53
    printf("PGDView 1.1 for Wsystem.  (c) 1996 Dodekaedron Software Creations, Inc.\n\n");
 
54
 
 
55
    if ((argv != 3) && (argv != 2)) {
 
56
        printf("Usage: PGDVIEW dks-datafilename [picturename] (no extension)\n");
 
57
        exit(1);
 
58
 
 
59
    }
 
60
    strcpy(nimi, argc[1]);
 
61
    strcat(nimi, ".dks");
 
62
 
 
63
    dksinit(nimi);
 
64
 
 
65
 
 
66
    if (argv == 3) {
 
67
        init_vga("PALET1");
 
68
        tyhjaa_vircr();
 
69
        Bitmap kuva(argc[2]);
 
70
        kuva.blit(0, 0);
 
71
        do_all_clear();
 
72
        getch();
 
73
    } else {
 
74
        printf("\n");
 
75
        for (lask = 0; lask < MAX_ENTRIES; lask++) {
 
76
            if (!dirri[lask].nimi[0])
 
77
                break;
 
78
            printf("%-6s ", dirri[lask].nimi);
 
79
            lask2++;
 
80
            if (lask2 == 10) {
 
81
                lask2 = 0;
 
82
                printf("\n");
 
83
            }
 
84
 
 
85
        }
 
86
    }
 
87
    printf("\n");
 
88
    return 0;
 
89
}