Vognsen 0 Posted December 19, 2003 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">// program name: ofp2 engine // release date: 20xx // comment: it's not ready yet, but it supports all the features the ofp 1 does // made by Marek Srapnel (supporting two guiness and 21 cognac) func mainprogram cpu_load=100% // it's necessary because the lame users buy always weak machines initilaize random_generate_desktop_crash 3Dengine() AI() player_controls() netcode() end func mainprogram goto mainprogram() // ************************************** // * 3D engine * // ************************************** func 3Dengine // detecting processor if cpu_freq < 4000 MHz then goto exit // detecting 3Dgraphics card if 3Dgraphics_card=true { if videocard texture memory < 256 then print "3D card memory to small, please go and buy a better one" elseif videocard texture memory > 256 and videocard texture memory > 512 then graph_setup=low elseif videocard texture memory > 512 and videocard texture memory > 1024 then graph_setup=normal } elseif 3Dgraphics_card=false { windows_desktop_flashing hdd_scratching blue screen of death print "Cannot initialize 3d device, please contact for program distributor!!!" } system_RAM_used=1024 MB pagefile_RAM_used=2048 MB print "Counting..." load_DVD_disk(1)_to_all_textures load_DVD_disk(2)_to_all_islands load_DVD_disk(3)_to_all_3d_models // motion capture of human and non humen objects from czech folk dancers create 3D_polygon_scene { for n=0 to 3000000000 create polygons send_to_video_card=1000L if video_card.cant_handle=true then lagging.enabled=true print "please wait, loading menu..." next n } if garaph_setup=low then { draw_object=128 // starting_ fog=50m // expected_fps=50 } if garaph_setup=normal then { draw_object=256 // starting_ fog=100m // expected_fps=25 } initialize 3D EAX sound if soundcard=SBLive then loading.scratching_sound_bank end func 3Dengine // ************************************** // * AI * // ************************************** func AI // diverse independently behaving AI if soldier.see_enemy=true then soldier.AI=shoot.enemy if soldier.see_enemy=true then soldier.AI=suicide_through_enemy // diverse independently behaving AI if soldier.order.get.in.vehicle=true then soldier.AI=go.around.city if soldier.order.get.in.vehicle2=true then soldier.AI=go.around.forest if soldier.order.get.in.vehicle3=true then soldier.AI=go.around.island if civil.order.sit.down=true then civil.AI=imaginary_weapon_put_on_back // diverse independently speaking AI if soldier.in.group.dies=true then { for n=0 to lemniscate soldier.AI.speak="Oh no 2 is down..." or soldier.AI.speak="Oh no 3 is down..." or soldier.AI.speak="Oh no 4 is down..." or soldier.AI.speak="Oh no 5 is down..." or soldier.AI.speak="Oh no 6 is down..." or soldier.AI.speak="Oh no 7 is down..." or soldier.AI.speak="Oh no 8 is down..." or soldier.AI.speak="Oh no 9 is down..." or soldier.AI.speak="Oh no 10 is down..." or soldier.AI.speak="Oh no 11 is down..." or soldier.AI.speak="Oh no 12 is down..." next n } end func AI // ************************************** // * player controls * // ************************************** func player_controls if player.use.binocular=true then player.moves=false if player.bump_into_house_from_outside=true then player.position=house.inside if player.bump_into_house_from_inside=true then player.position=house.outside if player.go_house_through_door=true then player.position=house.outside if player.go_out_house_through_door=true then player.position=house.inside if player.bumb_into_vehicle=true then player.hit_by_vehicle=true if player.get_out_vehicle_near_building=true then player.position=building_roof end func player_controls // ************************************** // * netcode * // ************************************** func netcode if server.protocol=directplay then deleting partition if client.player.shooting=true then { server.waiting=true create.lag=true if lag.end=true then count.shooting=true if client.player.target.shooting=true then { client.player.killed=true wait 10 sec client.player.target.killed=true } print "player killed by player target" print "player target killed by player" } if client.player.driving_vehicle=true then client.else.lag=true if client.player.modem=true then client.player.lag.enabled=true end func netcode Share this post Link to post Share on other sites
blackdog~ 0 Posted December 19, 2003 heh, kinda funny. but marek spanel isn't a programmer ;)... and they would probably comment it out in czech, not english Share this post Link to post Share on other sites
ozanzac 0 Posted December 19, 2003 Yeah.......................mayby. April first is still 4 and a bit months away. Share this post Link to post Share on other sites
hellfish6 7 Posted December 19, 2003 Closed before, closed now. Share this post Link to post Share on other sites