- Timestamp:
- May 14, 2011, 3:06:27 AM (12 years ago)
- Location:
- abuse/trunk
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/configure.ac
r640 r651 21 21 22 22 AC_ARG_ENABLE(debug, 23 [ --enable-debug build debug versions of the game (default no)])23 [ --enable-debug build debug versions of the game (default disabled)]) 24 24 AC_ARG_ENABLE(release, 25 [ --enable-release build final release of the game (default no)])25 [ --enable-release build final release of the game (default disabled)]) 26 26 AC_ARG_ENABLE(nonfree, 27 [ --disable-nonfree disable non-free data (default no)]) 27 [ --disable-nonfree disable non-free data (default enabled)]) 28 AC_ARG_ENABLE(network, 29 [ --disable-network disable networking (default enabled)]) 28 30 29 31 AC_ARG_WITH(assetdir, … … 86 88 ac_cv_have_nonfree="yes" 87 89 fi 88 if test " ${enable_nonfree}" = "no"; then90 if test "x${enable_nonfree}" = xno; then 89 91 ac_cv_have_nonfree="no" 90 92 fi … … 95 97 fi 96 98 AC_SUBST(distdir) 97 AM_CONDITIONAL(HAVE_NONFREE, test "${ac_cv_have_nonfree}" = "yes") 99 AM_CONDITIONAL(HAVE_NONFREE, test "x${ac_cv_have_nonfree}" = xyes) 100 101 dnl Is networking enabled? 102 if test "x${enable_network}" != xno; then 103 AC_DEFINE(HAVE_NETWORK, 1, Define to 1 to enable networking) 104 fi 105 AM_CONDITIONAL(HAVE_NETWORK, test "x${enable_network}" != xno) 98 106 99 107 # Optimizations -
abuse/trunk/src/Makefile.am
r605 r651 75 75 abuse_tool_DEPENDENCIES = $(abuse_tool_LDADD) 76 76 77 INCLUDES = -I$(srcdir) -I 77 INCLUDES = -I$(srcdir) -I$(srcdir)/lisp -I$(srcdir)/imlib \ 78 78 -I$(srcdir)/net $(SDL_CFLAGS) 79 79 80 80 CPPFLAGS = @CPPFLAGS@ -DNO_CHECK 81 -
abuse/trunk/src/clisp.cpp
r650 r651 2188 2188 case 276 : 2189 2189 { 2190 #if defined __CELLOS_LV2__2191 return 0;2192 #else2193 2190 if (!main_net_cfg) return 0; 2194 2191 return become_server(game_name); 2195 #endif2196 2192 } break; 2197 2193 case 277 : -
abuse/trunk/src/game.cpp
r650 r651 84 84 extern uint8_t chatting_enabled; 85 85 86 // Enable d TCPIP driver87 #if !defined __CELLOS_LV2__86 // Enable TCP/IP driver 87 #if HAVE_NETWORK 88 88 #include "tcpip.h" 89 89 tcpip_protocol tcpip; … … 548 548 } 549 549 550 #if !defined __CELLOS_LV2__551 550 base->current_tick=(current_level->tick_counter()&0xff); 552 #endif553 551 554 552 current_level->level_loaded_notify(); … … 1389 1387 calc_light_table(pal); 1390 1388 1391 #if !defined __CELLOS_LV2__1392 1389 if(current_level == NULL && net_start()) // if we joined a net game get level from server 1393 1390 { … … 1399 1396 // load_level(NET_STARTFILE); 1400 1397 } 1401 #endif1402 1398 1403 1399 set_mode(19, argc, argv); … … 1466 1462 gamma_correct(pal); 1467 1463 1468 #if defined __CELLOS_LV2__1469 if(!start_edit)1470 do_title();1471 #else1472 1464 if(main_net_cfg == NULL || (main_net_cfg->state != net_configuration::SERVER && 1473 1465 main_net_cfg->state != net_configuration::CLIENT)) … … 1480 1472 start_running = 1; 1481 1473 } 1482 #endif1483 1474 1484 1475 … … 1662 1653 if(ev.type != EV_KEY || !key_down(ev.key) || ev.window || (dev & EDIT_MODE)) 1663 1654 { 1664 #if !defined __CELLOS_LV2__1665 1655 if(ev.type == EV_KEY) 1666 1656 { … … 1700 1690 } 1701 1691 } 1702 #endif1703 1692 1704 1693 if((dev & EDIT_MODE) || start_edit || ev.type == EV_MESSAGE) … … 1915 1904 void net_send(int force = 0) 1916 1905 { 1917 #if !defined __CELLOS_LV2__1918 1906 if((!(dev & EDIT_MODE)) || force) 1919 1907 { … … 1950 1938 } 1951 1939 } 1952 #endif1953 1940 } 1954 1941 1955 1942 void net_receive() 1956 1943 { 1957 #if !defined __CELLOS_LV2__1958 1944 if(!(dev & EDIT_MODE) && current_level) 1959 1945 { … … 1976 1962 process_packet_commands(buf, size); 1977 1963 } 1978 #endif1979 1964 } 1980 1965 … … 2344 2329 void game_net_init(int argc, char **argv) 2345 2330 { 2346 #if !defined __CELLOS_LV2__2347 2331 int nonet=!net_init(argc, argv); 2348 2332 if(nonet) … … 2369 2353 } 2370 2354 } 2371 #endif2372 2355 } 2373 2356 … … 2466 2449 g->get_input(); // prime the net 2467 2450 2468 #if !defined __CELLOS_LV2__2469 2451 for (int i = 1; i + 1 < argc; i++) 2470 2452 { … … 2490 2472 g->update_screen(); // redraw the screen with any changes 2491 2473 } 2492 #endif2493 2474 2494 2475 while (!g->done()) … … 2525 2506 demo_man.do_inputs(); 2526 2507 2527 #if !defined __CELLOS_LV2__2528 2508 service_net_request(); 2529 #endif2530 2509 2531 2510 // process all the objects in the world 2532 2511 g->step(); 2533 #if !defined __CELLOS_LV2__2534 2512 server_check(); 2535 #endif2536 2513 g->calc_speed(); 2537 2514 … … 2541 2518 } 2542 2519 2543 #if !defined __CELLOS_LV2__2544 2520 net_uninit(); 2545 2521 … … 2547 2523 net_crcs->clean_up(); 2548 2524 delete net_crcs; net_crcs = NULL; 2549 #endif2550 2525 2551 2526 delete chat; … … 2586 2561 Lisp::Uninit(); 2587 2562 2588 #if !defined __CELLOS_LV2__2589 2563 base->packet.packet_reset(); 2590 #endif2591 2564 } 2592 2565 while (main_net_cfg && main_net_cfg->restart_state()); -
abuse/trunk/src/innet.cpp
r645 r651 23 23 #include "dev.h" 24 24 #include "timing.h" 25 #include "fileman.h"26 25 #include "netface.h" 27 26 28 #include "gserver.h" 29 #include "gclient.h" 27 #if HAVE_NETWORK 28 # include "fileman.h" 29 #endif 30 #include "net/sock.h" 31 #include "net/ghandler.h" 32 #include "net/gserver.h" 33 #include "net/gclient.h" 30 34 #include "dprint.h" 31 35 #include "netcfg.h" … … 45 49 base_memory_struct *base; // points to shm_addr 46 50 base_memory_struct local_base; 47 net_address *net_server=NULL; 48 net_protocol *prot=NULL; 49 net_socket *comm_sock=NULL,*game_sock=NULL; 51 net_address *net_server = NULL; 52 net_protocol *prot = NULL; 53 net_socket *comm_sock = NULL, *game_sock = NULL; 54 game_handler *game_face = NULL; 50 55 extern char lsf[256]; 51 game_handler *game_face=NULL;52 56 int local_client_number=0; // 0 is the server 53 57 join_struct *join_array=NULL; // points to an array of possible joining clients … … 58 62 int net_init(int argc, char **argv) 59 63 { 60 #if defined __CELLOS_LV2__61 return 0;62 #else63 64 int i,x,db_level=0; 64 65 base=&local_base; … … 150 151 prot=usable; 151 152 prot->set_debug_printing((net_protocol::debug_type)db_level); 153 152 154 if (main_net_cfg->state==net_configuration::SERVER) 153 155 set_login(main_net_cfg->name); … … 167 169 } 168 170 169 fman=new file_manager(argc,argv,prot); // manages remote file access 170 game_face=new game_handler; 171 #if HAVE_NETWORK 172 fman = new file_manager(argc,argv,prot); // manages remote file access 173 #endif 174 game_face = new game_handler; 171 175 join_array=(join_struct *)malloc(sizeof(join_struct)*MAX_JOINERS); 172 176 base->join_list=NULL; … … 181 185 182 186 return 1; 183 #endif 184 } 185 186 187 187 } 188 188 189 189 int net_start() // is the game starting up off the net? (i.e. -net hostname) 190 { return (main_net_cfg && main_net_cfg->state==net_configuration::CLIENT); }191 192 190 { 191 return main_net_cfg && main_net_cfg->state == net_configuration::CLIENT; 192 } 193 193 194 194 int kill_net() 195 195 { 196 #if defined __CELLOS_LV2__197 return 0;198 #else199 196 if (game_face) delete game_face; game_face=NULL; 200 197 if (join_array) free(join_array); join_array=NULL; 201 198 if (game_sock) { delete game_sock; game_sock=NULL; } 202 199 if (comm_sock) { delete comm_sock; comm_sock=NULL; } 200 #if HAVE_NETWORK 203 201 delete fman; fman=NULL; 202 #endif 204 203 if (net_server) { delete net_server; net_server=NULL; } 205 204 if (prot) 206 205 { 207 208 206 prot->cleanup(); 209 207 prot=NULL; 210 208 return 1; 211 } else return 0;212 #endif 209 } 210 return 0; 213 211 } 214 212 … … 219 217 220 218 219 #if HAVE_NETWORK 221 220 int NF_set_file_server(net_address *addr) 222 221 { 223 #if defined __CELLOS_LV2__224 return 0;225 #else226 222 if (prot) 227 223 { … … 237 233 return cmd; 238 234 } else return 0; 239 #endif240 235 } 241 236 242 237 int NF_set_file_server(char const *name) 243 238 { 244 #if !defined __CELLOS_LV2__245 239 if (prot) 246 240 { … … 253 247 } else return 0; 254 248 } 255 #endif256 249 return 0; 257 250 } … … 260 253 int NF_open_file(char const *filename, char const *mode) 261 254 { 262 #if !defined __CELLOS_LV2__263 255 if (prot) 264 256 return fman->rf_open_file(filename,mode); 257 return -2; 258 } 259 260 261 long NF_close(int fd) 262 { 263 if (prot) 264 return fman->rf_close(fd); 265 return 0; 266 } 267 268 long NF_read(int fd, void *buf, long size) 269 { 270 if (prot) 271 return fman->rf_read(fd,buf,size); 272 return 0; 273 } 274 275 long NF_filelength(int fd) 276 { 277 if (prot) 278 return fman->rf_file_size(fd); 279 return 0; 280 } 281 282 long NF_seek(int fd, long offset) 283 { 284 if (prot) 285 return fman->rf_seek(fd,offset); 286 return 0; 287 } 288 289 long NF_tell(int fd) 290 { 291 if (prot) 292 return fman->rf_tell(fd); 293 return 0; 294 } 265 295 #endif 266 return -2;267 }268 269 270 long NF_close(int fd)271 {272 #if !defined __CELLOS_LV2__273 if (prot)274 return fman->rf_close(fd);275 #endif276 return 0;277 }278 279 long NF_read(int fd, void *buf, long size)280 {281 #if !defined __CELLOS_LV2__282 if (prot)283 return fman->rf_read(fd,buf,size);284 #endif285 return 0;286 }287 288 long NF_filelength(int fd)289 {290 #if !defined __CELLOS_LV2__291 if (prot)292 return fman->rf_file_size(fd);293 #endif294 return 0;295 }296 297 long NF_seek(int fd, long offset)298 {299 #if !defined __CELLOS_LV2__300 if (prot)301 return fman->rf_seek(fd,offset);302 #endif303 return 0;304 }305 306 long NF_tell(int fd)307 {308 #if !defined __CELLOS_LV2__309 if (prot)310 return fman->rf_tell(fd);311 #endif312 return 0;313 }314 296 315 297 316 298 void service_net_request() 317 299 { 318 #if !defined __CELLOS_LV2__300 #if HAVE_NETWORK 319 301 if (prot) 320 302 { … … 379 361 } 380 362 } 381 #endif 363 #endif // HAVE_NETWORK 382 364 } 383 365 … … 385 367 int get_remote_lsf(net_address *addr, char *filename) // filename should be 256 bytes 386 368 { 387 #if !defined __CELLOS_LV2__388 369 if (prot) 389 370 { … … 406 387 407 388 } 408 #endif409 389 return 0; 410 390 } … … 414 394 int request_server_entry() 415 395 { 416 #if !defined __CELLOS_LV2__417 396 if (prot && main_net_cfg) 418 397 { … … 487 466 return cnum; 488 467 } 489 #endif490 468 return 0; 491 469 } … … 493 471 int reload_start() 494 472 { 495 #if !defined __CELLOS_LV2__496 473 if (prot) 497 474 return game_face->start_reload(); 498 #endif499 475 return 0; 500 476 } … … 502 478 int reload_end() 503 479 { 504 #if !defined __CELLOS_LV2__505 480 if (prot) 506 481 return game_face->end_reload(); 507 #endif508 482 return 0; 509 483 } … … 512 486 void net_reload() 513 487 { 514 #if !defined __CELLOS_LV2__515 488 if (prot) 516 489 { … … 632 605 } 633 606 } 634 #endif635 607 } 636 608 … … 641 613 void send_local_request() 642 614 { 643 644 615 if (prot) 645 616 { … … 745 716 int become_server(char *name) 746 717 { 747 #if !defined __CELLOS_LV2__748 718 if (prot && main_net_cfg) 749 719 { … … 765 735 return 1; 766 736 } 767 #endif768 737 return 0; 769 738 } … … 771 740 void read_new_views() { ; } 772 741 773 774 742 void wait_min_players() 775 743 { 776 if (game_face) game_face->game_start_wait(); 777 } 778 744 if (game_face) 745 game_face->game_start_wait(); 746 } 747 -
abuse/trunk/src/loader2.cpp
r635 r651 315 315 #endif 316 316 317 #if defined __CELLOS_LV2__318 if (1)319 #else320 317 // don't let them specify a startup file we are connect elsewhere 321 318 if (!net_start()) 322 #endif323 319 { 324 320 for (int i=1; i<argc; i++) … … 336 332 } 337 333 } 338 #if !defined __CELLOS_LV2__339 334 else if (!get_remote_lsf(net_server,lsf)) 340 335 { … … 342 337 exit(0); 343 338 } 344 #endif345 339 char prog[100]; 346 340 char const *cs; -
abuse/trunk/src/menu.cpp
r650 r651 38 38 #include "netcfg.h" 39 39 40 #i f !defined __CELLOS_LV2__41 # include "net/sock.h" 40 #include "net/sock.h" 41 42 42 extern net_protocol *prot; 43 #else44 static int const prot = 0;45 #endif46 43 47 44 static VolumeWindow *volume_window; -
abuse/trunk/src/net/Makefile.am
r524 r651 1 ## Process this file with automake to produce Makefile.in 1 2 2 noinst_LIBRARIES = libnet.a 3 3 … … 14 14 15 15 CPPFLAGS = @CPPFLAGS@ -DNO_CHECK 16 -
abuse/trunk/src/net/engine.cpp
r643 r651 13 13 #endif 14 14 15 #if HAVE_NETWORK 15 16 #include "common.h" 16 17 … … 1250 1251 } 1251 1252 1252 1253 1254 1255 1256 1253 #endif // HAVE_NETWORK 1254 -
abuse/trunk/src/net/fileman.cpp
r555 r651 13 13 #endif 14 14 15 #if HAVE_NETWORK 16 15 17 #include <stdio.h> 16 18 #include <stdlib.h> … … 518 520 else return 0; 519 521 } 522 523 #endif // HAVE_NETWORK 524 -
abuse/trunk/src/net/gclient.cpp
r555 r651 20 20 #include <sys/types.h> 21 21 #include <string.h> 22 #include <signal.h>23 22 24 23 #include "common.h" -
abuse/trunk/src/net/gserver.cpp
r646 r651 20 20 #include <sys/types.h> 21 21 #include <string.h> 22 #include <signal.h>23 22 24 23 #include "common.h" -
abuse/trunk/src/net/netdrv.cpp
r555 r651 12 12 # include "config.h" 13 13 #endif 14 15 #if HAVE_NETWORK 14 16 15 17 #include <stdio.h> … … 599 601 return 0; 600 602 } 603 604 #endif // HAVE_NETWORK 605 -
abuse/trunk/src/net/netfile.cpp
r555 r651 13 13 #endif 14 14 15 #if HAVE_NETWORK 16 15 17 #include "common.h" 16 18 … … 18 20 #include "../inc/netface.h" 19 21 #include "engine.h" 20 21 22 22 23 nfs_client *first_nfs_client=NULL; … … 473 474 } 474 475 475 476 #endif // HAVE_NETWORK 477 -
abuse/trunk/src/net/sock.cpp
r555 r651 22 22 net_protocol *net_protocol::first=0; 23 23 24 #if HAVE_NETWORK 24 25 // connect to an explictedly named address 25 26 // first try to get the address and then try to connect 26 27 // return NULL if either fail. This method does not need to be implemented 27 28 // in sub-classes 28 29 29 net_socket *net_protocol::connect_to_server(char const *&server_name, int port, int force_port, net_socket::socket_type sock_type) 30 30 { … … 35 35 return s; 36 36 } 37 #endif 37 38 -
abuse/trunk/src/net/tcpip.cpp
r555 r651 12 12 # include "config.h" 13 13 #endif 14 15 #if HAVE_NETWORK 14 16 15 17 #ifdef _AIX … … 683 685 //}}} 684 686 687 #endif 688 -
abuse/trunk/src/net/undrv.cpp
r643 r651 12 12 # include "config.h" 13 13 #endif 14 15 #if HAVE_NETWORK 14 16 15 17 #include <stdio.h> … … 200 202 fman->process_net(); 201 203 } 202 203 204 } 205 204 } 205 206 #endif // HAVE_NETWORK 207 -
abuse/trunk/src/netcfg.cpp
r650 r651 25 25 #include "dev.h" 26 26 27 #if !defined __CELLOS_LV2__ 28 # include "net/sock.h" 29 #endif 27 #include "net/sock.h" 30 28 31 29 extern char *get_login(); … … 33 31 extern char lsf[256]; 34 32 35 #if !defined __CELLOS_LV2__36 33 extern net_protocol *prot; 37 #endif38 34 39 35 net_configuration::net_configuration() 40 36 { 41 #if !defined __CELLOS_LV2__42 37 strcpy(name,get_login()); 43 38 44 39 strcpy(server_name,"My Netgame"); 45 46 40 47 41 min_players=2; … … 51 45 server_port=20202; 52 46 state=SINGLE_PLAYER; 53 #endif54 47 } 55 48 … … 454 447 { 455 448 int ret=0; 456 #if !defined __CELLOS_LV2__457 449 main_screen->clear(); 458 450 … … 599 591 } 600 592 } 601 #endif602 593 603 594 return ret; -
abuse/trunk/src/nfclient.cpp
r555 r651 30 30 #include "cache.h" 31 31 32 #include "gserver.h" 33 34 #if !defined __CELLOS_LV2__ 32 #include "net/gserver.h" 35 33 36 34 void remove_client(int client_number) { ; } … … 115 113 } 116 114 117 115 #if HAVE_NETWORK 118 116 if (local_only) 119 117 { 118 #endif 120 119 local=new jFILE(filename,mode); 121 120 if (local->open_failure()) { delete local; local=NULL; } 121 #if HAVE_NETWORK 122 122 } 123 123 else 124 124 { 125 126 127 125 char nm[256]; 128 126 strcpy(nm,filename); … … 135 133 } 136 134 } 135 #endif 137 136 } 138 137 … … 149 148 if (local) 150 149 return local->read(buf,count); 150 #if HAVE_NETWORK 151 151 else if (nfs_fd>=0) 152 152 { … … 158 158 return a; 159 159 } 160 #endif 160 161 else return 0; 161 162 } … … 165 166 if (local) 166 167 return local->write(buf,count); 168 #if HAVE_NETWORK 167 169 else 168 170 { … … 170 172 exit(0); 171 173 } 174 #endif 172 175 return 0; 173 176 } … … 178 181 if (local) 179 182 return local->seek(off,whence); 183 #if HAVE_NETWORK 180 184 else if (nfs_fd>=0) 181 185 { … … 185 189 return NF_seek(nfs_fd,off); 186 190 } 191 #endif 187 192 return 0; 188 193 } … … 191 196 { 192 197 if (local) return local->tell(); 198 #if HAVE_NETWORK 193 199 else if (nfs_fd>=0) return NF_tell(nfs_fd); 200 #endif 194 201 else return 0; 195 202 } … … 199 206 { 200 207 if (local) return local->file_size(); 208 #if HAVE_NETWORK 201 209 else if (nfs_fd>=0) return NF_filelength(nfs_fd); 210 #endif 202 211 else return 0; 203 212 } … … 207 216 flush_writes(); 208 217 if (local) delete local; 218 #if HAVE_NETWORK 209 219 else if (nfs_fd>=0) NF_close(nfs_fd); 220 #endif 210 221 } 211 222 212 223 int set_file_server(net_address *addr) 213 224 { 225 #if HAVE_NETWORK 214 226 if (NF_set_file_server(addr)) 215 227 { … … 229 241 return 1; 230 242 } 243 #endif 231 244 return 0; 232 245 } … … 247 260 } 248 261 249 #endif250 -
abuse/trunk/src/nfserver.h
r555 r651 12 12 #define __NFSERVER_HPP_ 13 13 14 #if !defined __CELLOS_LV2__15 16 14 #include "specs.h" 17 15 #include "netface.h" 18 #include " sock.h"16 #include "net/sock.h" 19 17 20 18 int net_init(int argc, char **argv); … … 57 55 58 56 #endif 59 #endif 57 -
abuse/trunk/src/view.cpp
r643 r651 394 394 } 395 395 396 #if !defined __CELLOS_LV2__397 396 if( view_changed() ) 398 397 { … … 443 442 base->packet.write_uint16((uint16_t)((int16_t)sug_px)); 444 443 base->packet.write_uint16((uint16_t)((int16_t)sug_py)); 445 #endif446 444 } 447 445 … … 494 492 int view::process_input(char cmd, uint8_t *&pk) // return 0 if something went wrong 495 493 { 496 #if !defined __CELLOS_LV2__497 494 switch (cmd) 498 495 { … … 566 563 case SCMD_EXT_KEYRELEASE : set_key_down(*(pk++)+256,0); break; 567 564 } 568 #endif569 565 return 1; 570 566 } … … 572 568 int view::local_player() 573 569 { 574 #if defined __CELLOS_LV2__575 return 1;576 #else577 570 return player_number==client_number(); 578 #endif579 571 } 580 572 … … 1178 1170 void process_packet_commands(uint8_t *pk, int size) 1179 1171 { 1180 #if !defined __CELLOS_LV2__1181 1172 int32_t sync_uint16=-1; 1182 1173 … … 1278 1269 } 1279 1270 } while (cmd!=SCMD_END_OF_PACKET); 1280 #endif1281 1271 } 1282 1272
Note: See TracChangeset
for help on using the changeset viewer.