summaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 95925e0ea0c3cf3d99ae4bbd9b184de896303096 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
#[macro_use]
extern crate simple_error;

use std::process;

mod fmt;

// void printstr(short x, short y, char string[81], char attribute)
// {
//         char character;
//         short i, pos;

//         pos = (y*80+x)<<1;
//         i = 0;
//         while (string[i] != 0)
//         {
//                 character = string[i];
//                 printchrasm(0xb8000+(long)pos,1L,((long)attribute<<8)+(long)character);
//                 i++;
//                 pos+=2;
//         }
// }

// static char todd[] = "Duke Nukem 3D(tm) Copyright 1989, 1996 Todd Replogle and 3D Realms Entertainment";
// static char trees[] = "I want to make a game with trees";
// static char sixteen[] = "16 Possible Dukes";

fn main() {
    // #define VERSION "1.4"
    // #define HEAD2  "Duke Nukem 3D v"VERSION" - Atomic Edition"
    // printstr(40-(strlen(HEAD2)>>1),0,HEAD2,79);

    // ud.multimode = 1;
    // printstr(0,1,"                   Copyright (c) 1996 3D Realms Entertainment                   ",79);

    // initgroupfile("duke3d.grp");

    let filename = "DUKE3D.GRP";
    let mut group_manager = fmt::GroupManager::new();

    if let Err(e) = group_manager.load_file(filename) {
        println!("Couldn't open {}: {}", filename, e);
        process::exit(1);
    }

    println!("DOGWHINE.VOC: {} bytes", group_manager.get("DOGWHINE.VOC").unwrap().len());

    // checkcommandline(argc,argv);

    println!("You don't have enough free memory to run Duke Nukem 3D.");
    println!("The DOS \"mem\" command should report 6,800K (or 6.8 megs)");
    println!("of \"total memory free\".");
    println!("");
    println!("Duke Nukem 3D requires {} more bytes to run.", 3162000 - 350000);
    process::exit(1);

    // Considering that most of this can be implemented with Drop, I
    // don't think it's necessary.

    // RegisterShutdownFunction( ShutDown );
    // void ShutDown( void )
    // {
    //     SoundShutdown();
    //     MusicShutdown();
    //     uninittimer();
    //     uninitengine();
    //     CONTROL_Shutdown();
    //     CONFIG_WriteSetup();
    //     KB_Shutdown();
    // }

    // Startup();


    // if(numplayers > 1)
   //  {
   //      ud.multimode = numplayers;
   //      sendlogon();
   //  }
   //  else if(boardfilename[0] != 0)
   //  {
   //      ud.m_level_number = 7;
   //      ud.m_volume_number = 0;
   //      ud.warp_on = 1;
   //  }

   //  getnames();

   //  if(ud.multimode > 1)
   //  {
   //      playerswhenstarted = ud.multimode;

   //      if(ud.warp_on == 0)
   //      {
   //          ud.m_monsters_off = 1;
   //          ud.m_player_skill = 0;
   //      }
   //  }

   //  ud.last_level = -1;

   // RTS_Init(ud.rtsname);
   // if(numlumps) printf("Using .RTS file:%s\n",ud.rtsname);

    // if( setgamemode(ScreenMode,ScreenWidth,ScreenHeight) < 0 )
    // {
    //     printf("\nVESA driver for ( %i * %i ) not found/supported!\n",xdim,ydim);
    //     ScreenMode = 2;
    //     ScreenWidth = 320;
    //     ScreenHeight = 200;
    //     setgamemode(ScreenMode,ScreenWidth,ScreenHeight);
    // }

    // // CTW END - MODIFICATION

    // genspriteremaps();

// #ifdef VOLUMEONE
//         if(numplayers > 4 || ud.multimode > 4)
//             gameexit(" The full version of Duke Nukem 3D supports 5 or more players.");
// #endif

    // setbrightness(ud.brightness>>2,&ps[myconnectindex].palette[0]);

    // ESCESCAPE;

    // FX_StopAllSounds();
    // clearsoundlocks();

    // if(ud.warp_on > 1 && ud.multimode < 2)
    // {
    //     clearview(0L);
    //     ps[myconnectindex].palette = palette;
    //     palto(0,0,0,0);
    //     rotatesprite(320<<15,200<<15,65536L,0,LOADSCREEN,0,0,2+8+64,0,0,xdim-1,ydim-1);
    //     menutext(160,105,0,0,"LOADING SAVED GAME...");
    //     nextpage();

    //     j = loadplayer(ud.warp_on-2);
    //     if(j)
    //         ud.warp_on = 0;
    // }

    // //    getpackets();

//     MAIN_LOOP_RESTART:

//     if(ud.warp_on == 0)
//         Logo();
//     else if(ud.warp_on == 1)
//     {
//         newgame(ud.m_volume_number,ud.m_level_number,ud.m_player_skill);
//         enterlevel(MODE_GAME);
//     }
//     else vscrn();

//     tempautorun = ud.auto_run;

//     if( ud.warp_on == 0 && playback() )
//     {
//         FX_StopAllSounds();
//         clearsoundlocks();
//         nomorelogohack = 1;
//         goto MAIN_LOOP_RESTART;
//     }

//     ud.auto_run = tempautorun;

//     ud.warp_on = 0;

//     while ( !(ps[myconnectindex].gm&MODE_END) ) //The whole loop!!!!!!!!!!!!!!!!!!
//     {
//         if( ud.recstat == 2 || ud.multimode > 1 || ( ud.show_help == 0 && (ps[myconnectindex].gm&MODE_MENU) != MODE_MENU ) )
//             if( ps[myconnectindex].gm&MODE_GAME )
//                 if( moveloop() ) continue;

//         if( ps[myconnectindex].gm&MODE_EOL || ps[myconnectindex].gm&MODE_RESTART )
//         {
//             if( ps[myconnectindex].gm&MODE_EOL )
//             {
// #ifdef ONELEVELDEMO
//                 gameexit(" ");
// #endif
//                 closedemowrite();

//                 ready2send = 0;

//                 i = ud.screen_size;
//                 ud.screen_size = 0;
//                 vscrn();
//                 ud.screen_size = i;
//                 dobonus(0);

//                 if(ud.eog)
//                 {
//                     ud.eog = 0;
//                     if(ud.multimode < 2)
//                     {
// #ifndef VOLUMEALL
//                         doorders();
// #endif
//                         ps[myconnectindex].gm = MODE_MENU;
//                         cmenu(0);
//                         probey = 0;
//                         goto MAIN_LOOP_RESTART;
//                     }
//                     else
//                     {
//                         ud.m_level_number = 0;
//                         ud.level_number = 0;
//                     }
//                 }
//             }

//             ready2send = 0;
//             if(numplayers > 1) ps[myconnectindex].gm = MODE_GAME;
//             enterlevel(ps[myconnectindex].gm);
//             continue;
//         }

//         cheats();
//         nonsharedkeys();

//         if( (ud.show_help == 0 && ud.multimode < 2 && !(ps[myconnectindex].gm&MODE_MENU) ) || ud.multimode > 1 || ud.recstat == 2)
//             i = min(max((totalclock-ototalclock)*(65536L/TICSPERFRAME),0),65536);
//         else
//             i = 65536;

//         displayrooms(screenpeek,i);
//         displayrest(i);

// //        if( KB_KeyPressed(sc_F) )
// //        {
// //            KB_ClearKeyDown(sc_F);
// //            addplayer();
// //        }

//         if(ps[myconnectindex].gm&MODE_DEMO)
//             goto MAIN_LOOP_RESTART;

//         if(debug_on) caches();

//         checksync();

// #ifdef VOLUMEONE
//         if(ud.show_help == 0 && show_shareware > 0 && (ps[myconnectindex].gm&MODE_MENU) == 0 )
//             rotatesprite((320-50)<<16,9<<16,65536L,0,BETAVERSION,0,0,2+8+16+128,0,0,xdim-1,ydim-1);
// #endif
//         nextpage();
//     }

//     gameexit(" ");
}