cl_bobcycle 0 // how long the cycle of up/down view movement takes (only works if cl_bob is not 0), default is 0.6
cl_bob 0.01 // how much view moves up/down when moving (does not move if cl_bobcycle is 0, but still enables cl_bobmodel), default is 0.02
cl_bobmodel 1 // whether to have gun model move around on screen when moving (only works if cl_bob is not 0), default is 1
+cl_leanmodel 1 // enables weapon leaning effect when looking around
+cl_followmodel 1 // enables weapon pushing / pulling effect when walking
cl_rollangle 0 // amount of view tilt when strafing, default is 2.0
v_kicktime 0 // how long damage kicks of the view last, default is 0 seconds
gl_polyblend 0.5 // whether to use screen tints, default is 1
// improve some minor details
sv_gameplayfix_gravityunaffectedbyticrate 1
sv_gameplayfix_nogravityonground 1
+
+// autodemo deleting
+seta cl_autodemo_delete_keeprecords 0 "when 1, records with a newly made race/cts demo are kept even if cl_autodemo_delete is used to delete demos"
--- /dev/null
+0 0.00048828125 0.00048828125 0.06201171875 0.06201171875
+1 0.06298828125 0.00048828125 0.12451171875 0.06201171875
+2 0.12548828125 0.00048828125 0.18701171875 0.06201171875
+3 0.18798828125 0.00048828125 0.24951171875 0.06201171875
+4 0.25048828125 0.00048828125 0.31201171875 0.06201171875
+5 0.31298828125 0.00048828125 0.37451171875 0.06201171875
+6 0.37548828125 0.00048828125 0.43701171875 0.06201171875
+7 0.43798828125 0.00048828125 0.49951171875 0.06201171875
+8 0.50048828125 0.00048828125 0.56201171875 0.06201171875
+9 0.56298828125 0.00048828125 0.62451171875 0.06201171875
+10 0.62548828125 0.00048828125 0.68701171875 0.06201171875
+11 0.68798828125 0.00048828125 0.74951171875 0.06201171875
+12 0.75048828125 0.00048828125 0.81201171875 0.06201171875
+13 0.81298828125 0.00048828125 0.87451171875 0.06201171875
+14 0.87548828125 0.00048828125 0.93701171875 0.06201171875
+15 0.93798828125 0.00048828125 0.99951171875 0.06201171875
+16 0.00048828125 0.06298828125 0.06201171875 0.12451171875
+17 0.06298828125 0.06298828125 0.12451171875 0.12451171875
+18 0.12548828125 0.06298828125 0.18701171875 0.12451171875
+19 0.18798828125 0.06298828125 0.24951171875 0.12451171875
+20 0.25048828125 0.06298828125 0.31201171875 0.12451171875
+21 0.31298828125 0.06298828125 0.37451171875 0.12451171875
+22 0.37548828125 0.06298828125 0.43701171875 0.12451171875
+23 0.43798828125 0.06298828125 0.49951171875 0.12451171875
+24 0.50048828125 0.06298828125 0.56201171875 0.12451171875
+25 0.56298828125 0.06298828125 0.62451171875 0.12451171875
+26 0.62548828125 0.06298828125 0.68701171875 0.12451171875
+27 0.68798828125 0.06298828125 0.74951171875 0.12451171875
+28 0.75048828125 0.06298828125 0.81201171875 0.12451171875
+29 0.81298828125 0.06298828125 0.87451171875 0.12451171875
+30 0.87548828125 0.06298828125 0.93701171875 0.12451171875
+31 0.93798828125 0.06298828125 0.99951171875 0.12451171875
+32 0.00048828125 0.12548828125 0.06201171875 0.18701171875
+33 0.06298828125 0.12548828125 0.12451171875 0.18701171875
+34 0.12548828125 0.12548828125 0.18701171875 0.18701171875
+35 0.18798828125 0.12548828125 0.24951171875 0.18701171875
+36 0.25048828125 0.12548828125 0.31201171875 0.18701171875
+37 0.31298828125 0.12548828125 0.37451171875 0.18701171875
+38 0.37548828125 0.12548828125 0.43701171875 0.18701171875
+39 0.43798828125 0.12548828125 0.49951171875 0.18701171875
+40 0.50048828125 0.12548828125 0.56201171875 0.18701171875
+41 0.56298828125 0.12548828125 0.62451171875 0.18701171875
+42 0.62548828125 0.12548828125 0.68701171875 0.18701171875
+43 0.68798828125 0.12548828125 0.74951171875 0.18701171875
+44 0.75048828125 0.12548828125 0.81201171875 0.18701171875
+45 0.81298828125 0.12548828125 0.87451171875 0.18701171875
+46 0.87548828125 0.12548828125 0.93701171875 0.18701171875
+47 0.93798828125 0.12548828125 0.99951171875 0.18701171875
+48 0.00048828125 0.18798828125 0.06201171875 0.24951171875
+49 0.06298828125 0.18798828125 0.12451171875 0.24951171875
+50 0.12548828125 0.18798828125 0.18701171875 0.24951171875
+51 0.18798828125 0.18798828125 0.24951171875 0.24951171875
+52 0.25048828125 0.18798828125 0.31201171875 0.24951171875
+53 0.31298828125 0.18798828125 0.37451171875 0.24951171875
+54 0.37548828125 0.18798828125 0.43701171875 0.24951171875
+55 0.43798828125 0.18798828125 0.49951171875 0.24951171875
+56 0.50048828125 0.18798828125 0.56201171875 0.24951171875
+57 0.56298828125 0.18798828125 0.62451171875 0.24951171875
+58 0.62548828125 0.18798828125 0.68701171875 0.24951171875
+59 0.68798828125 0.18798828125 0.74951171875 0.24951171875
+60 0.75048828125 0.18798828125 0.81201171875 0.24951171875
+61 0.81298828125 0.18798828125 0.87451171875 0.24951171875
+62 0.87548828125 0.18798828125 0.93701171875 0.24951171875
+63 0.93798828125 0.18798828125 0.99951171875 0.24951171875
+64 0.00048828125 0.25048828125 0.06201171875 0.31201171875
+65 0.06298828125 0.25048828125 0.12451171875 0.31201171875
+66 0.12548828125 0.25048828125 0.18701171875 0.31201171875
+67 0.18798828125 0.25048828125 0.24951171875 0.31201171875
+68 0.25048828125 0.25048828125 0.31201171875 0.31201171875
+69 0.31298828125 0.25048828125 0.37451171875 0.31201171875
+70 0.37548828125 0.25048828125 0.43701171875 0.31201171875
+71 0.43798828125 0.25048828125 0.49951171875 0.31201171875
+72 0.50048828125 0.25048828125 0.56201171875 0.31201171875
+73 0.56298828125 0.25048828125 0.62451171875 0.31201171875
+74 0.62548828125 0.25048828125 0.68701171875 0.31201171875
+75 0.68798828125 0.25048828125 0.74951171875 0.31201171875
+76 0.75048828125 0.25048828125 0.81201171875 0.31201171875
+77 0.81298828125 0.25048828125 0.87451171875 0.31201171875
+78 0.87548828125 0.25048828125 0.93701171875 0.31201171875
+79 0.93798828125 0.25048828125 0.99951171875 0.31201171875
+80 0.00048828125 0.31298828125 0.06201171875 0.37451171875
+81 0.06298828125 0.31298828125 0.12451171875 0.37451171875
+82 0.12548828125 0.31298828125 0.18701171875 0.37451171875
+83 0.18798828125 0.31298828125 0.24951171875 0.37451171875
+84 0.25048828125 0.31298828125 0.31201171875 0.37451171875
+85 0.31298828125 0.31298828125 0.37451171875 0.37451171875
+86 0.37548828125 0.31298828125 0.43701171875 0.37451171875
+87 0.43798828125 0.31298828125 0.49951171875 0.37451171875
+88 0.50048828125 0.31298828125 0.56201171875 0.37451171875
+89 0.56298828125 0.31298828125 0.62451171875 0.37451171875
+90 0.62548828125 0.31298828125 0.68701171875 0.37451171875
+91 0.68798828125 0.31298828125 0.74951171875 0.37451171875
+92 0.75048828125 0.31298828125 0.81201171875 0.37451171875
+93 0.81298828125 0.31298828125 0.87451171875 0.37451171875
+94 0.87548828125 0.31298828125 0.93701171875 0.37451171875
+95 0.93798828125 0.31298828125 0.99951171875 0.37451171875
+96 0.00048828125 0.37548828125 0.06201171875 0.43701171875
+97 0.06298828125 0.37548828125 0.12451171875 0.43701171875
+98 0.12548828125 0.37548828125 0.18701171875 0.43701171875
+99 0.18798828125 0.37548828125 0.24951171875 0.43701171875
+100 0.25048828125 0.37548828125 0.31201171875 0.43701171875
+101 0.31298828125 0.37548828125 0.37451171875 0.43701171875
+102 0.37548828125 0.37548828125 0.43701171875 0.43701171875
+103 0.43798828125 0.37548828125 0.49951171875 0.43701171875
+104 0.50048828125 0.37548828125 0.56201171875 0.43701171875
+105 0.56298828125 0.37548828125 0.62451171875 0.43701171875
+106 0.62548828125 0.37548828125 0.68701171875 0.43701171875
+107 0.68798828125 0.37548828125 0.74951171875 0.43701171875
+108 0.75048828125 0.37548828125 0.81201171875 0.43701171875
+109 0.81298828125 0.37548828125 0.87451171875 0.43701171875
+110 0.87548828125 0.37548828125 0.93701171875 0.43701171875
+111 0.93798828125 0.37548828125 0.99951171875 0.43701171875
+112 0.00048828125 0.43798828125 0.06201171875 0.49951171875
+113 0.06298828125 0.43798828125 0.12451171875 0.49951171875
+114 0.12548828125 0.43798828125 0.18701171875 0.49951171875
+115 0.18798828125 0.43798828125 0.24951171875 0.49951171875
+116 0.25048828125 0.43798828125 0.31201171875 0.49951171875
+117 0.31298828125 0.43798828125 0.37451171875 0.49951171875
+118 0.37548828125 0.43798828125 0.43701171875 0.49951171875
+119 0.43798828125 0.43798828125 0.49951171875 0.49951171875
+120 0.50048828125 0.43798828125 0.56201171875 0.49951171875
+121 0.56298828125 0.43798828125 0.62451171875 0.49951171875
+122 0.62548828125 0.43798828125 0.68701171875 0.49951171875
+123 0.68798828125 0.43798828125 0.74951171875 0.49951171875
+124 0.75048828125 0.43798828125 0.81201171875 0.49951171875
+125 0.81298828125 0.43798828125 0.87451171875 0.49951171875
+126 0.87548828125 0.43798828125 0.93701171875 0.49951171875
+127 0.93798828125 0.43798828125 0.99951171875 0.49951171875
+128 0.00048828125 0.50048828125 0.06201171875 0.56201171875
+129 0.06298828125 0.50048828125 0.12451171875 0.56201171875
+130 0.12548828125 0.50048828125 0.18701171875 0.56201171875
+131 0.18798828125 0.50048828125 0.24951171875 0.56201171875
+132 0.25048828125 0.50048828125 0.31201171875 0.56201171875
+133 0.31298828125 0.50048828125 0.37451171875 0.56201171875
+134 0.37548828125 0.50048828125 0.43701171875 0.56201171875
+135 0.43798828125 0.50048828125 0.49951171875 0.56201171875
+136 0.50048828125 0.50048828125 0.56201171875 0.56201171875
+137 0.56298828125 0.50048828125 0.62451171875 0.56201171875
+138 0.62548828125 0.50048828125 0.68701171875 0.56201171875
+139 0.68798828125 0.50048828125 0.74951171875 0.56201171875
+140 0.75048828125 0.50048828125 0.81201171875 0.56201171875
+141 0.81298828125 0.50048828125 0.87451171875 0.56201171875
+142 0.87548828125 0.50048828125 0.93701171875 0.56201171875
+143 0.93798828125 0.50048828125 0.99951171875 0.56201171875
+144 0.00048828125 0.56298828125 0.06201171875 0.62451171875
+145 0.06298828125 0.56298828125 0.12451171875 0.62451171875
+146 0.12548828125 0.56298828125 0.18701171875 0.62451171875
+147 0.18798828125 0.56298828125 0.24951171875 0.62451171875
+148 0.25048828125 0.56298828125 0.31201171875 0.62451171875
+149 0.31298828125 0.56298828125 0.37451171875 0.62451171875
+150 0.37548828125 0.56298828125 0.43701171875 0.62451171875
+151 0.43798828125 0.56298828125 0.49951171875 0.62451171875
+152 0.50048828125 0.56298828125 0.56201171875 0.62451171875
+153 0.56298828125 0.56298828125 0.62451171875 0.62451171875
+154 0.62548828125 0.56298828125 0.68701171875 0.62451171875
+155 0.68798828125 0.56298828125 0.74951171875 0.62451171875
+156 0.75048828125 0.56298828125 0.81201171875 0.62451171875
+157 0.81298828125 0.56298828125 0.87451171875 0.62451171875
+158 0.87548828125 0.56298828125 0.93701171875 0.62451171875
+159 0.93798828125 0.56298828125 0.99951171875 0.62451171875
+1000 0 0.62548828125 1 0.68701171875
+1001 0 0.68798828125 1 0.74951171875
+1002 0 0.75048828125 1 0.81201171875
+1003 0 0.81298828125 1 0.87451171875
+1004 0 0.87548828125 1 0.93701171875
+1005 0 0.93798828125 1 0.99951171875
sv_airstrafeaccelerate 0
sv_maxairstrafespeed 0
sv_aircontrol 0
+sv_aircontrol_power 2
sv_warsowbunny_turnaccel 0
sv_warsowbunny_accel 0.1593
sv_warsowbunny_topspeed 925
sv_airstrafeaccelerate 0
sv_maxairstrafespeed 0
sv_aircontrol 0
+sv_aircontrol_power 2
sv_warsowbunny_turnaccel 0
sv_warsowbunny_accel 0.1593
sv_warsowbunny_topspeed 925
sv_airstrafeaccelerate 0
sv_maxairstrafespeed 0
sv_aircontrol 0
+sv_aircontrol_power 2
sv_warsowbunny_turnaccel 0
sv_warsowbunny_accel 0.1593
sv_warsowbunny_topspeed 925
sv_airstrafeaccelerate 0
sv_maxairstrafespeed 0
sv_aircontrol 0
+sv_aircontrol_power 2
sv_warsowbunny_turnaccel 0
sv_warsowbunny_accel 0.1593
sv_warsowbunny_topspeed 925
sv_airstrafeaccelerate 0
sv_maxairstrafespeed 0
sv_aircontrol 0
+sv_aircontrol_power 2
sv_warsowbunny_turnaccel 0
sv_warsowbunny_accel 0.1593
sv_warsowbunny_topspeed 925
sv_airstrafeaccelerate 0
sv_maxairstrafespeed 0
sv_aircontrol 0
+sv_aircontrol_power 2
sv_warsowbunny_turnaccel 0
sv_warsowbunny_accel 0.1593
sv_warsowbunny_topspeed 925
sv_airstrafeaccelerate 0
sv_maxairstrafespeed 0
sv_aircontrol 0
+sv_aircontrol_power 2
sv_warsowbunny_turnaccel 0
sv_warsowbunny_accel 0.1593
sv_warsowbunny_topspeed 925
sv_airstrafeaccelerate 0
sv_maxairstrafespeed 0
sv_aircontrol 0
+sv_aircontrol_power 2
sv_warsowbunny_turnaccel 0
sv_warsowbunny_accel 0.1593
sv_warsowbunny_topspeed 925
sv_airstrafeaccelerate 70
sv_maxairstrafespeed 30
sv_aircontrol 150
+sv_aircontrol_power 2
sv_warsowbunny_turnaccel 0
sv_warsowbunny_accel 0.1593
sv_warsowbunny_topspeed 925
sv_airstrafeaccelerate 0
sv_maxairstrafespeed 0
sv_aircontrol 0
+sv_aircontrol_power 2
sv_warsowbunny_turnaccel 0
sv_warsowbunny_accel 0.1593
sv_warsowbunny_topspeed 925
--- /dev/null
+// These have been modified from Nexuiz 2.4.2's physicsQBR.cfg file
+sv_gravity 800
+sv_gravity 802
+sv_maxspeed 417
+sv_maxairspeed 202
+sv_stopspeed 100
+sv_accelerate 5.8
+sv_airaccelerate 5.5
+sv_friction 4.1
+edgefriction 1
+sv_stepheight 34
+sv_jumpvelocity 307
+sv_wateraccelerate -1
+sv_waterfriction -1
+sv_airaccel_sideways_friction 0.207
+sv_airaccel_qw -0.93
+sv_airstopaccelerate 0
+sv_airstrafeaccelerate 0
+sv_maxairstrafespeed 0
+sv_aircontrol 0
+sv_aircontrol_power 2
+sv_warsowbunny_turnaccel 0
+sv_warsowbunny_accel 0.1593
+sv_warsowbunny_topspeed 925
+sv_warsowbunny_backtosideratio 0.8
+sv_friction_on_land 0
+sv_doublejump 0
+sv_jumpspeedcap_min ""
+sv_jumpspeedcap_max ""
+sv_jumpspeedcap_max_disable_on_ramps 0
sv_airstrafeaccelerate 0
sv_maxairstrafespeed 0
sv_aircontrol 0
+sv_aircontrol_power 2
sv_warsowbunny_turnaccel 0
sv_warsowbunny_accel 0.1593
sv_warsowbunny_topspeed 925
sv_airstrafeaccelerate 70
sv_maxairstrafespeed 30
sv_aircontrol 150
+sv_aircontrol_power 2
sv_warsowbunny_turnaccel 0
sv_warsowbunny_accel 0.1593
sv_warsowbunny_topspeed 925
sv_airstrafeaccelerate 70
sv_maxairstrafespeed 30
sv_aircontrol 150
+sv_aircontrol_power 2
sv_warsowbunny_turnaccel 0
sv_warsowbunny_accel 0.1593
sv_warsowbunny_topspeed 925
-// Xonotic 2.0-2.4.2 physics minus QW-bunnyhopping-bug, faster onground accel, CPMA air control
+// 2.0-2.4.2 physics minus QW-bunnyhopping-bug, faster onground accel, CPMA air control
sv_gravity 800
-sv_maxspeed 320
-sv_maxairspeed 320
+sv_maxspeed 400
+sv_maxairspeed 220
sv_stopspeed 100
-sv_accelerate 15
-sv_airaccelerate 5.5
-sv_friction 5
+sv_accelerate 12
+sv_airaccelerate 8
+sv_friction 7
edgefriction 1
sv_stepheight 34
sv_jumpvelocity 300
sv_wateraccelerate -1
sv_waterfriction -1
-sv_airaccel_sideways_friction -1
+sv_airaccel_sideways_friction -0.125
sv_airaccel_qw -0.95
sv_airstopaccelerate 0
sv_airstrafeaccelerate 0
sv_maxairstrafespeed 0
sv_aircontrol 70
+sv_aircontrol_power 100 // air control kicks in at about -6 degrees
sv_warsowbunny_turnaccel 0
sv_warsowbunny_accel 0.1593
sv_warsowbunny_topspeed 925
sv_airstrafeaccelerate 0
sv_maxairstrafespeed 0
sv_aircontrol 0
+sv_aircontrol_power 2
sv_warsowbunny_turnaccel 0
sv_warsowbunny_accel 0.1593
sv_warsowbunny_topspeed 925
sv_airstrafeaccelerate 0
sv_maxairstrafespeed 0
sv_aircontrol 0
+sv_aircontrol_power 2
sv_warsowbunny_turnaccel 0
sv_warsowbunny_accel 0.1593
sv_warsowbunny_topspeed 925
sv_airstrafeaccelerate 0
sv_maxairstrafespeed 0
sv_aircontrol 0
+sv_aircontrol_power 2
sv_warsowbunny_turnaccel 0
sv_warsowbunny_accel 0.1593
sv_warsowbunny_topspeed 925
sv_airstrafeaccelerate 0
sv_maxairstrafespeed 0
sv_aircontrol 0
+sv_aircontrol_power 2
sv_warsowbunny_turnaccel 0
sv_warsowbunny_accel 0.1593
sv_warsowbunny_topspeed 925
sv_airstrafeaccelerate 0
sv_maxairstrafespeed 0
sv_aircontrol 0
+sv_aircontrol_power 2
sv_warsowbunny_turnaccel 0
sv_warsowbunny_accel 0.1593
sv_warsowbunny_topspeed 925
sv_airstrafeaccelerate 0
sv_maxairstrafespeed 0
sv_aircontrol 0
+sv_aircontrol_power 2
sv_warsowbunny_turnaccel 0
sv_warsowbunny_accel 0.1593
sv_warsowbunny_topspeed 925
sv_airstrafeaccelerate 0
sv_maxairstrafespeed 0
sv_aircontrol 0
+sv_aircontrol_power 2
sv_warsowbunny_turnaccel 0
sv_warsowbunny_accel 0.1593
sv_warsowbunny_topspeed 925
sv_airstrafeaccelerate 70
sv_maxairstrafespeed 30
sv_aircontrol 0
+sv_aircontrol_power 2
sv_warsowbunny_turnaccel 9 // activates warsow movement mode
sv_warsowbunny_accel 0.1593
sv_warsowbunny_topspeed 925
sv_airstrafeaccelerate 70
sv_maxairstrafespeed 30
sv_aircontrol 150
+sv_aircontrol_power 2
sv_warsowbunny_turnaccel 0
sv_warsowbunny_accel 0.1593
sv_warsowbunny_topspeed 925
sv_airstrafeaccelerate 70
sv_maxairstrafespeed 30
sv_aircontrol 0
+sv_aircontrol_power 2
sv_warsowbunny_turnaccel 6 // activates warsow movement mode
sv_warsowbunny_accel 0.1585
sv_warsowbunny_topspeed 900
rr = RACE_RECORD;
t = stof(db_get(ClientProgsDB, strcat(shortmapname, rr, "time")));
- if(score && score < t || !t)
+ if(score && (score < t || !t)) {
db_put(ClientProgsDB, strcat(shortmapname, rr, "time"), ftos(score));
+ if(cvar("cl_autodemo_delete_keeprecords"))
+ {
+ f = cvar("cl_autodemo_delete");
+ f &~= 1;
+ cvar_set("cl_autodemo_delete", ftos(f)); // don't delete demo with new record!
+ }
+ }
if(t != crecordtime_prev) {
crecordtime_prev = t;
float sv_airstrafeaccelerate;
float sv_maxairstrafespeed;
float sv_aircontrol;
+float sv_aircontrol_power;
float sv_warsowbunny_airforwardaccel;
float sv_warsowbunny_accel;
float sv_warsowbunny_topspeed;
xyspeed = vlen(self.velocity); self.velocity = normalize(self.velocity);
dot = self.velocity * wishdir;
- k *= sv_aircontrol*dot*dot*frametime;
if(dot > 0) // we can't change direction while slowing down
{
+ k *= fabs(sv_aircontrol)*pow(dot, sv_aircontrol_power)*frametime;
self.velocity = normalize(self.velocity * xyspeed + wishdir * k);
}
//implementation notes:
//entity customization is done before per-client culling (visibility for instance) because the entity may be doing setorigin to display itself in different locations on different clients, may be altering its .modelindex, .effects and other fields important to culling, so customized entities increase cpu usage (non-customized entities can use all the early culling they want however, as they are not changing on a per client basis).
+//DP_SV_DISCARDABLEDEMO
+//idea: parasti
+//darkplaces implementation: parasti
+//field definitions:
+.float discardabledemo;
+//description:
+//when this field is set to a non-zero value on a player entity, a possibly recorded server-side demo for the player is discarded
+//Note that this extension only works if:
+// auto demos are enabled (the cvar sv_autodemo_perclient is set)
+// discarding demos is enabled (the cvar sv_autodemo_perclient_discardable is set)
+
//DP_SV_DRAWONLYTOCLIENT
//idea: LordHavoc
//darkplaces implementation: LordHavoc
#ifdef TETRIS
+float autocvar_g_bastet;
.vector tet_org;
float tet_vs_current_id;
var float tet_high_score = 0;
-float TET_LINES = 20;
+vector TET_START_PIECE_POS = '5 1 0';
+float TET_LINES = 22;
+float TET_DISPLAY_LINES = 20;
float TET_WIDTH = 10;
+string TET_EMPTY_LINE = "0000000000"; // must match TET_WIDTH
//character values
float TET_BORDER = 139;
float TET_BLOCK = 133;
float PIECES = 7;
-.float line1, line2, line3, line4, line5, line6, line7,
-line8, line9, line10, line11, line12, line13, line14, line15,
-line16, line17, line18, line19, line20;
-
+float tet_line_buf;
float SVC_CENTERPRINTa = 26;
*********************************
*/
-void SetLine(float ln, float vl)
+void SetLine(float ln, string vl)
{
- if (ln == 1)
- self.line1 = vl;
- else if (ln == 2)
- self.line2 = vl;
- else if (ln == 3)
- self.line3 = vl;
- else if (ln == 4)
- self.line4 = vl;
- else if (ln == 5)
- self.line5 = vl;
- else if (ln == 6)
- self.line6 = vl;
- else if (ln == 7)
- self.line7 = vl;
- else if (ln == 8)
- self.line8 = vl;
- else if (ln == 9)
- self.line9 = vl;
- else if (ln == 10)
- self.line10 = vl;
- else if (ln == 11)
- self.line11 = vl;
- else if (ln == 12)
- self.line12 = vl;
- else if (ln == 13)
- self.line13 = vl;
- else if (ln == 14)
- self.line14 = vl;
- else if (ln == 15)
- self.line15 = vl;
- else if (ln == 16)
- self.line16 = vl;
- else if (ln == 17)
- self.line17 = vl;
- else if (ln == 18)
- self.line18 = vl;
- else if (ln == 19)
- self.line19 = vl;
- else if (ln == 20)
- self.line20 = vl;
+ if(ln < 1 || ln > TET_LINES)
+ error("WTF");
+ bufstr_set(tet_line_buf, ln + TET_LINES * num_for_edict(self), vl);
};
-float GetLine(float ln)
+string GetLine(float ln)
{
- if (ln == 1)
- return self.line1;
- else if (ln == 2)
- return self.line2;
- else if (ln == 3)
- return self.line3;
- else if (ln == 4)
- return self.line4;
- else if (ln == 5)
- return self.line5;
- else if (ln == 6)
- return self.line6;
- else if (ln == 7)
- return self.line7;
- else if (ln == 8)
- return self.line8;
- else if (ln == 9)
- return self.line9;
- else if (ln == 10)
- return self.line10;
- else if (ln == 11)
- return self.line11;
- else if (ln == 12)
- return self.line12;
- else if (ln == 13)
- return self.line13;
- else if (ln == 14)
- return self.line14;
- else if (ln == 15)
- return self.line15;
- else if (ln == 16)
- return self.line16;
- else if (ln == 17)
- return self.line17;
- else if (ln == 18)
- return self.line18;
- else if (ln == 19)
- return self.line19;
- else if (ln == 20)
- return self.line20;
- else
- return 0;
+ if(ln < 1 || ln > TET_LINES)
+ error("WTF");
+ if(ln < 1 || ln > TET_LINES)
+ return TET_EMPTY_LINE;
+ return bufstr_get(tet_line_buf, ln + TET_LINES * num_for_edict(self));
};
-float GetXBlock(float x, float dat)
-{
- if (x == 1)
- return dat & 3;
- else if (x == 2)
- return (dat & 12) / 4;
- else if (x == 3)
- return (dat & 48) / 16;
- else if (x == 4)
- return (dat & 192) / 64;
- else if (x == 5)
- return (dat & 768) / 256;
- else if (x == 6)
- return (dat & 3072) / 1024;
- else if (x == 7)
- return (dat & 12288) / 4096;
- else if (x == 8)
- return (dat & 49152) / 16384;
- else if (x == 9)
- return (dat & 196608) / 65536;
- else if (x == 10)
- return (dat & 786432) / 262144;
- else
- return 0;
+float GetXBlock(float x, string dat)
+{
+ if(x < 1 || x > TET_WIDTH)
+ error("WTF");
+ return stof(substring(dat, x-1, 1));
};
-float SetXBlock(float x, float dat, float new)
-{
- if (x == 1)
- return (dat - (dat & 3)) | new;
- else if (x == 2)
- return (dat - (dat & 12)) | (new*4);
- else if (x == 3)
- return (dat - (dat & 48)) | (new*16);
- else if (x == 4)
- return (dat - (dat & 192)) | (new*64);
- else if (x == 5)
- return (dat - (dat & 768)) | (new*256);
- else if (x == 6)
- return (dat - (dat & 3072)) | (new*1024);
- else if (x == 7)
- return (dat - (dat & 12288)) | (new*4096);
- else if (x == 8)
- return (dat - (dat & 49152)) | (new*16384);
- else if (x == 9)
- return (dat - (dat & 196608)) | (new*65536);
- else if (x == 10)
- return (dat - (dat & 786432)) | (new*262144);
- else
- return dat;
+string SetXBlock(float x, string dat, float new)
+{
+ return strcat(
+ substring(dat, 0, x-1),
+ ftos(new),
+ substring(dat, x, -1)
+ );
};
void SetSquare(float x, float y, float val)
{
- float dat;
-
+ string dat;
dat = GetLine(y);
- dat = SetXBlock(x, dat, val & 3);
+ dat = SetXBlock(x, dat, val);
SetLine(y, dat);
};
+float PieceColor(float pc)
+{
+ if (pc == 1)
+ return 3; // O
+ else if (pc == 2)
+ return 4; // J
+ else if (pc == 3)
+ return 7; // L // we don't have orange, let's use white instead!
+ else if (pc == 4)
+ return 5; // I
+ else if (pc == 5)
+ return 1; // Z
+ else if (pc == 6)
+ return 2; // S
+ else if (pc == 7)
+ return 6; // T
+ else
+ return 0;
+}
vector PieceShape(float pc)
{
if (pc == 1)
- return '5 5 0'; // O
+ return '20 20 0'; // O
else if (pc == 2)
return '1 21 0'; // J
else if (pc == 3)
- return '21 1 0'; // L
+ return '16 21 0'; // L
else if (pc == 4)
- return '85 0 0'; // I
+ return '0 85 0'; // I
else if (pc == 5)
return '5 20 0'; // Z
else if (pc == 6)
else
return '0 0 0';
}
-
+vector PieceSize(float pc)
+{
+ if (pc == 1)
+ return '2 2 0'; // O
+ else if (pc == 2)
+ return '3 2 0'; // J
+ else if (pc == 3)
+ return '3 2 0'; // L
+ else if (pc == 4)
+ return '4 1 0'; // I
+ else if (pc == 5)
+ return '3 2 0'; // Z
+ else if (pc == 6)
+ return '3 2 0'; // S
+ else if (pc == 7)
+ return '3 2 0'; // T
+ else
+ return '0 0 0';
+}
vector PieceCenter(float pc)
{
if(pc == 1)
- return '1.5 1.5 0'; // O
+ return '2.5 1.5 0'; // O
else if (pc == 2)
return '2 2 0'; // J
else if (pc == 3)
- return '2 1 0'; // L
+ return '2 2 0'; // L
else if (pc == 4)
- return '2.5 1.5 0'; // I
+ return '2.5 2.5 0'; // I
else if (pc == 5)
return '2 2 0'; // Z
else if (pc == 6)
float PieceMetric(float x, float y, float rot, float pc)
{
float t;
- vector piece_dat;
- float wid;
+ vector ce;
// return bits of a piece
- wid = piece_dat_z + 1;
- piece_dat = PieceCenter(pc);
+ ce = PieceCenter(pc);
if (rot == 1) // 90 degrees
{
// x+cx, y+cy -> -y+cx, x+cy
// x = X-cx
// y = Y-cy
t = y;
- y = x - piece_dat_x + piece_dat_y;
- x = -t + piece_dat_x + piece_dat_y;
+ y = x - ce_x + ce_y;
+ x = -t + ce_x + ce_y;
}
else if (rot == 2)//180
{
- x = 2 * piece_dat_x - x;
- y = 2 * piece_dat_y - y;
+ x = 2 * ce_x - x;
+ y = 2 * ce_y - y;
}
else if (rot == 3) // 270
{
// x = X-cx
// y = Y-cy
t = y;
- y = -x + piece_dat_y + piece_dat_x;
- x = t - piece_dat_y + piece_dat_x;
+ y = -x + ce_y + ce_x;
+ x = t - ce_y + ce_x;
}
if (x < 1 || y < 1 || x > 4 || y > 2)
return 0;
- piece_dat = PieceShape(pc);
+ ce = PieceShape(pc);
if (y == 1)
- return GetXBlock(x, piece_dat_x); // first row
+ return !!(ce_x & pow(4, x-1)); // first row
else if (y == 2)
- return GetXBlock(x, piece_dat_y); // second row
+ return !!(ce_y & pow(4, x-1)); // second row
else
return 0; // illegal parms
};
+vector tet_piecemins;
+vector tet_piecemaxs;
+void PieceMinsMaxs(float rot, float pc)
+{
+ vector sz, ce;
+ float t;
+ vector v;
+
+ sz = PieceSize(pc);
+ ce = PieceCenter(pc);
+ // 1 = 2..2
+ // 2 = 2..3
+ // 3 = 1..3
+ // 4 = 1..4
+ tet_piecemins_x = floor(3.0 - sz_x * 0.5);
+ tet_piecemaxs_x = floor(2.0 + sz_x * 0.5);
+ if(sz_y == 1)
+ {
+ // special case for "I"
+ tet_piecemins_y = tet_piecemaxs_y = 2;
+ }
+ else
+ {
+ tet_piecemins_y = 1;
+ tet_piecemaxs_y = sz_y;
+ }
+ //print(sprintf("ce%v sz%v mi%v ma%v\n", ce, sz, tet_piecemins, tet_piecemaxs));
+ if (rot == 1) // 90 degrees
+ {
+ t = tet_piecemins_y;
+ tet_piecemins_y = -tet_piecemins_x + ce_y + ce_x;
+ tet_piecemins_x = t - ce_y + ce_x;
+ t = tet_piecemaxs_y;
+ tet_piecemaxs_y = -tet_piecemaxs_x + ce_y + ce_x;
+ tet_piecemaxs_x = t - ce_y + ce_x;
+ // swap mins_y, maxs_y
+ t = tet_piecemins_y;
+ tet_piecemins_y = tet_piecemaxs_y;
+ tet_piecemaxs_y = t;
+ // TODO OPTIMIZE
+ }
+ else if (rot == 2)//180
+ {
+ v = tet_piecemins;
+ tet_piecemins = 2 * ce - tet_piecemaxs;
+ tet_piecemaxs = 2 * ce - v;
+ }
+ else if (rot == 3) // 270
+ {
+ t = tet_piecemins_y;
+ tet_piecemins_y = tet_piecemins_x - ce_x + ce_y;
+ tet_piecemins_x = -t + ce_x + ce_y;
+ t = tet_piecemaxs_y;
+ tet_piecemaxs_y = tet_piecemaxs_x - ce_x + ce_y;
+ tet_piecemaxs_x = -t + ce_x + ce_y;
+ // swap mins_x, maxs_x
+ t = tet_piecemins_x;
+ tet_piecemins_x = tet_piecemaxs_x;
+ tet_piecemaxs_x = t;
+ // TODO OPTIMIZE
+ }
+#ifdef VERIFY
+ print(vtos(tet_piecemins), "-");
+ print(vtos(tet_piecemaxs), "\n");
+ if(tet_piecemins_x > tet_piecemaxs_x)
+ error("inconsistent mins/maxs");
+ if(tet_piecemins_y > tet_piecemaxs_y)
+ error("inconsistent mins/maxs");
+ float i, j;
+ vector realmins, realmaxs;
+ realmins = '4 4 0';
+ realmaxs = '1 1 0';
+ for(i = 1; i <= 4; ++i)
+ for(j = 1; j <= 4; ++j)
+ if(PieceMetric(i, j, rot, pc))
+ {
+ realmins_x = min(realmins_x, i);
+ realmins_y = min(realmins_y, j);
+ realmaxs_x = max(realmaxs_x, i);
+ realmaxs_y = max(realmaxs_y, j);
+ }
+ if(realmins != tet_piecemins || realmaxs != tet_piecemaxs)
+ error(sprintf("incorrect mins/maxs: %v %v in %d rot %d mins %v maxs %v\n", realmins, realmaxs, rot, pc, tet_piecemins, tet_piecemaxs));
+#endif
+}
/*
*********************************
for (x = 1; x <= TET_WIDTH; x = x + 1)
{
- d = GetSquare(x, ln);
+ d = GetSquare(x, ln + TET_LINES - TET_DISPLAY_LINES);
if (d)
{
WriteChar(MSG_ONE, '^');
- WriteChar(MSG_ONE, d * d - 2 * d + 50); // 1, 2, 5
+ WriteChar(MSG_ONE, d + '0');
WriteChar(MSG_ONE, TET_BLOCK);
}
else
{
float x, d, piece_ln, pcolor;
vector piece_dat;
- pcolor = mod(pc, 3) + 1;
+ pcolor = PieceColor(pc);
WriteChar(MSG_ONE, TET_SPACE); // pad to 6
piece_dat = PieceShape(pc);
piece_ln = piece_dat_y;
for (x = 1; x <= 4; x = x + 1)
{
- d = GetXBlock(x, piece_ln) * pcolor;
- if (d)
+ if (piece_ln & pow(4, x-1))
{
WriteChar(MSG_ONE, '^');
- WriteChar(MSG_ONE, d * d - 2 * d + 50); // 1, 2, 5
+ WriteChar(MSG_ONE, pcolor + '0');
WriteChar(MSG_ONE, TET_BLOCK);
}
else
entity head;
msg_entity = self;
WriteChar(MSG_ONE, SVC_CENTERPRINTa);
+ if(autocvar_g_bastet)
+ {
+ WriteTetrisString("NEVER GONNA GIVE YOU");
+ WriteChar(MSG_ONE, 10);
+ }
// decoration
for (i = 1; i <= (TET_WIDTH + 2); i = i + 1)
WriteChar(MSG_ONE, TET_BORDER);
WriteTetrisString(" ");
WriteUnterminatedString(MSG_ONE, TET_PADDING_RIGHT);
WriteChar(MSG_ONE, 10);
- for (i = 1; i <= TET_LINES; i = i + 1)
+ for (i = 1; i <= TET_DISPLAY_LINES; i = i + 1)
{
if(self.tetris_on == 2)
WriteTetrisString(" GAME OVER ");
else
DrawLine(i);
if (i == 1)
- WriteTetrisString(" NEXT ");
+ WriteTetrisString(autocvar_g_bastet ? " THAT " : " NEXT ");
else if (i == 3)
DrawPiece(self.next_piece, 1);
else if (i == 4)
{
float i;
+ if(!tet_line_buf)
+ tet_line_buf = buf_create();
+
for (i=1; i<=TET_LINES; i = i + 1)
- SetLine(i, 0);
+ SetLine(i, TET_EMPTY_LINE);
self.piece_pos = '0 0 0';
self.piece_type = 0;
self.next_piece = self.tet_lines = self.tet_score = 0;
self.movetype = MOVETYPE_WALK;
};
+void PrintField()
+{
+ string l;
+ float r, c;
+ for(r = 1; r <= TET_LINES; ++r)
+ {
+ l = GetLine(r);
+ print(">");
+ for(c = 1; c <= TET_WIDTH; ++c)
+ {
+ print(ftos(GetXBlock(c, l)));
+ }
+ print("\n");
+ }
+}
+
+float BastetEvaluate()
+{
+ float height;
+ string l;
+ float lines;
+ float score, score_save;
+ string occupied, occupied_save;
+ float occupied_count, occupied_count_save;
+ float i, j, line;
+
+ score = 0;
+
+ // adds a bonus for each free dot above the occupied blocks profile
+ occupied = TET_EMPTY_LINE;
+ occupied_count = TET_WIDTH;
+ height = 0;
+ lines = 0;
+ for(i = 1; i <= TET_LINES; ++i)
+ {
+ l = GetLine(i);
+ if(l == TET_EMPTY_LINE)
+ {
+ height = i;
+ continue;
+ }
+ line = 1;
+ occupied_save = occupied;
+ occupied_count_save = occupied_count;
+ score_save = score;
+ for(j = 1; j <= TET_WIDTH; ++j)
+ {
+ if(GetXBlock(j, l))
+ {
+ if(!GetXBlock(j, occupied))
+ {
+ occupied = SetXBlock(j, occupied, 1);
+ --occupied_count;
+ }
+ }
+ else
+ line = 0;
+ score += 10000 * occupied_count;
+ }
+ if(line)
+ {
+ occupied = occupied_save;
+ occupied_count = occupied_count_save;
+ score = score_save + 100000000 + 10000 * TET_WIDTH + 1000;
+ ++lines;
+ }
+ }
+
+ score += 1000 * height;
+
+ return score;
+}
+
+float CheckMetrics(float piece, float orgx, float orgy, float rot);
+void ClearPiece(float piece, float orgx, float orgy, float rot);
+void CementPiece(float piece, float orgx, float orgy, float rot);
+float bastet_profile_evaluate_time;
+float bastet_profile_checkmetrics_time;
+float BastetSearch(float buf, float pc, float x, float y, float rot, float move_bias)
+// returns best score, or -1 if position is impossible
+{
+ string r;
+ float b;
+ float s, sm;
+ float t1, t2;
+
+ if(move_bias < 0)
+ return 0; // DO NOT WANT
+
+ if(x < 1 || x > TET_WIDTH || y < 1 || y > TET_LINES)
+ return -1; // impossible
+ if(rot < 0) rot = 3;
+ if(rot > 3) rot = 0;
+
+ // did we already try?
+ b = x + (TET_WIDTH+2) * (y + (TET_LINES+2) * rot);
+ r = bufstr_get(buf, b);
+ if(r != "") // already tried
+ return stof(r);
+
+ bufstr_set(buf, b, "0"); // in case we READ that, not that bad - we already got that value in another branch then anyway
+
+
+
+ t1 = gettime(GETTIME_HIRES);
+ if(CheckMetrics(pc, x, y, rot))
+ {
+ t2 = gettime(GETTIME_HIRES);
+ bastet_profile_checkmetrics_time += (t2 - t1);
+ // try all moves
+ sm = 1;
+ s = BastetSearch(buf, pc, x-1, y, rot, move_bias - 1); if(s > sm) sm = s;
+ s = BastetSearch(buf, pc, x+1, y, rot, move_bias - 1); if(s > sm) sm = s;
+ s = BastetSearch(buf, pc, x, y, rot+1, move_bias - 1); if(s > sm) sm = s;
+ s = BastetSearch(buf, pc, x, y, rot-1, move_bias - 1); if(s > sm) sm = s;
+
+ s = BastetSearch(buf, pc, x, y+1, rot, move_bias + 2); if(s > sm) sm = s;
+ if(s < 0)
+ {
+ //print(sprintf("MAY CEMENT AT: %d %d %d\n", x, y, rot));
+ // moving down did not work - that means we can fixate the block here
+ t1 = gettime(GETTIME_HIRES);
+
+ CementPiece(pc, x, y, rot);
+ s = BastetEvaluate();
+ ClearPiece(pc, x, y, rot);
+
+ t2 = gettime(GETTIME_HIRES);
+ bastet_profile_evaluate_time += (t2 - t1);
+
+ if(s > sm) sm = s;
+ }
+ }
+ else
+ {
+ t2 = gettime(GETTIME_HIRES);
+ bastet_profile_checkmetrics_time += (t2 - t1);
+ sm = -1; // impassible
+ }
+
+ bufstr_set(buf, b, ftos(sm));
+
+ return sm;
+}
+
+float bastet_piece[7];
+float bastet_score[7];
+float bastet_piecetime[7];
+float BastetPiece()
+{
+ float b;
+
+ bastet_profile_evaluate_time = 0;
+ bastet_profile_checkmetrics_time = 0;
+ var float t1 = gettime(GETTIME_HIRES);
+
+ b = buf_create(); bastet_piece[0] = 1; bastet_score[0] = BastetSearch(b, 1, TET_START_PIECE_POS_x, 1+TET_START_PIECE_POS_y, TET_START_PIECE_POS_y, TET_WIDTH) + 100 * random() + bastet_piecetime[0]; buf_del(b);
+ b = buf_create(); bastet_piece[1] = 2; bastet_score[1] = BastetSearch(b, 2, TET_START_PIECE_POS_x, 1+TET_START_PIECE_POS_y, TET_START_PIECE_POS_y, TET_WIDTH) + 100 * random() + bastet_piecetime[1]; buf_del(b);
+ b = buf_create(); bastet_piece[2] = 3; bastet_score[2] = BastetSearch(b, 3, TET_START_PIECE_POS_x, 1+TET_START_PIECE_POS_y, TET_START_PIECE_POS_y, TET_WIDTH) + 100 * random() + bastet_piecetime[2]; buf_del(b);
+ b = buf_create(); bastet_piece[3] = 4; bastet_score[3] = BastetSearch(b, 4, TET_START_PIECE_POS_x, 1+TET_START_PIECE_POS_y, TET_START_PIECE_POS_y, TET_WIDTH) + 100 * random() + bastet_piecetime[3]; buf_del(b);
+ b = buf_create(); bastet_piece[4] = 5; bastet_score[4] = BastetSearch(b, 5, TET_START_PIECE_POS_x, 1+TET_START_PIECE_POS_y, TET_START_PIECE_POS_y, TET_WIDTH) + 100 * random() + bastet_piecetime[4]; buf_del(b);
+ b = buf_create(); bastet_piece[5] = 6; bastet_score[5] = BastetSearch(b, 6, TET_START_PIECE_POS_x, 1+TET_START_PIECE_POS_y, TET_START_PIECE_POS_y, TET_WIDTH) + 100 * random() + bastet_piecetime[5]; buf_del(b);
+ b = buf_create(); bastet_piece[6] = 7; bastet_score[6] = BastetSearch(b, 7, TET_START_PIECE_POS_x, 1+TET_START_PIECE_POS_y, TET_START_PIECE_POS_y, TET_WIDTH) + 100 * random() + bastet_piecetime[6]; buf_del(b);
+
+ var float t2 = gettime(GETTIME_HIRES);
+ dprint(sprintf("Time taken: %.6f seconds (of this, ev = %.2f%%, cm = %.2f%%)\n", t2 - t1, 100 * bastet_profile_evaluate_time / (t2 - t1), 100 * bastet_profile_checkmetrics_time / (t2 - t1)));
+
+ // sort
+ float i, j, k, p, s;
+
+/*
+ for(i = 0; i < 7; ++i)
+ {
+ print(sprintf("piece %s value = %d\n", substring("OJLIZST", bastet_piece[i]-1, 1), bastet_score[i]));
+ }
+*/
+
+ for(i = 0; i < 7; ++i)
+ {
+ k = i;
+ p = bastet_piece[k];
+ s = bastet_score[k];
+ for(j = i + 1; j < 7; ++j)
+ {
+ if(bastet_score[j] < s)
+ {
+ k = j;
+ s = bastet_score[k];
+ p = bastet_piece[k];
+ }
+ }
+ if(k != i)
+ {
+ bastet_score[k] = bastet_score[i];
+ bastet_piece[k] = bastet_piece[i];
+ bastet_score[i] = s;
+ bastet_piece[i] = p;
+ }
+ }
+
+ b = random();
+ if(b < 0.8)
+ j = 0;
+ else if(b < 0.92)
+ j = 1;
+ else if(b < 0.98)
+ j = 2;
+ else
+ j = 3;
+ j = bastet_piece[j];
+
+ for(i = 0; i < 7; ++i)
+ {
+ if(i == j-1)
+ bastet_piecetime[i] = 0.2 * bastet_piecetime[i];
+ else
+ bastet_piecetime[i] = 1.8 * bastet_piecetime[i] + 1000;
+ }
+
+ return j;
+}
/*
float p, q;
float b;
float seen;
+
if(self.tet_piece_bucket > 1)
{
p = mod(self.tet_piece_bucket, 7);
// check to see if the piece, if moved to the locations will overlap
float x, y;
+ string l;
// why did I start counting from 1, damnit
orgx = orgx - 1;
orgy = orgy - 1;
- for (y = 0; y < 5; y = y + 1)
+ PieceMinsMaxs(rot, piece);
+ if (tet_piecemins_x+orgx<1 || tet_piecemaxs_x+orgx > TET_WIDTH || tet_piecemins_y+orgy<1 || tet_piecemaxs_y+orgy> TET_LINES)
+ return FALSE; // ouside the level
+ for (y = tet_piecemins_y; y <= tet_piecemaxs_y; y = y + 1)
{
- for (x = 0; x < 5; x = x + 1)
- {
+ l = GetLine(y + orgy);
+ if(l != TET_EMPTY_LINE)
+ for (x = tet_piecemins_x; x <= tet_piecemaxs_x; x = x + 1)
if (PieceMetric(x, y, rot, piece))
- {
- if (GetSquare(x + orgx, y + orgy))
+ if (GetXBlock(x + orgx, l))
return FALSE; // uhoh, gonna hit something.
- if (x+orgx<1 || x+orgx > TET_WIDTH || y+orgy<1 || y+orgy> TET_LINES)
- return FALSE; // ouside the level
- }
- }
}
return TRUE;
}
void ClearPiece(float piece, float orgx, float orgy, float rot) /*FIXDECL*/
{
-
float x, y;
// why did I start counting from 1, damnit
orgx = orgx - 1;
orgy = orgy - 1;
- for (y = 0; y < 5; y = y + 1)
+ PieceMinsMaxs(rot, piece);
+ for (y = tet_piecemins_y; y <= tet_piecemaxs_y; y = y + 1)
{
- for (x = 0; x < 5; x = x + 1)
+ for (x = tet_piecemins_x; x <= tet_piecemaxs_x; x = x + 1)
{
if (PieceMetric(x, y, rot, piece))
{
orgx = orgx - 1;
orgy = orgy - 1;
- pcolor = mod(piece, 3) + 1;
+ pcolor = PieceColor(piece);
- for (y = 0; y < 5; y = y + 1)
+ PieceMinsMaxs(rot, piece);
+ for (y = tet_piecemins_y; y <= tet_piecemaxs_y; y = y + 1)
{
- for (x = 0; x < 5; x = x + 1)
+ for (x = tet_piecemins_x; x <= tet_piecemaxs_x; x = x + 1)
{
if (PieceMetric(x, y, rot, piece))
{
void CompletedLines()
{
- float y, cleared, ln, added, pos, i;
+ float y, cleared, added, pos, i;
+ string ln;
cleared = 0;
y = TET_LINES;
- while(y >= 1)
+ for(;;)
{
ln = GetLine(y);
- if (((ln & LINE_LOW) | ((ln & LINE_HIGH)/2)) == LINE_LOW)
+ if(strstrofs(ln, "0", 0) < 0)
cleared = cleared + 1;
else
y = y - 1;
- ln = GetLine(y - cleared);
+ if(y < 1)
+ break;
+ if(y - cleared < 1)
+ ln = TET_EMPTY_LINE;
+ else
+ ln = GetLine(y - cleared);
SetLine(y, ln);
}
for(y = max(1, TET_LINES - added + 1); y <= TET_LINES; ++y)
{
pos = floor(random() * TET_WIDTH);
- ln = 0;
+ ln = TET_EMPTY_LINE;
for(i = 1; i <= TET_WIDTH; ++i)
if(i != pos)
- ln = SetXBlock(i, ln, floor(random() * 3 + 1));
+ ln = SetXBlock(i, ln, floor(random() * 7 + 1));
SetLine(y, ln);
}
}
self.tet_highest_line = 0;
for(y = 1; y <= TET_LINES; ++y)
- if(GetLine(y) != 0)
+ if(GetLine(y) != TET_EMPTY_LINE)
{
self.tet_highest_line = TET_LINES + 1 - y;
break;
if (self.piece_type == 0)
{
- self.piece_pos = '5 1 0'; // that's about middle top, we count from 1 ARGH
- if (self.next_piece)
- self.piece_type = self.next_piece;
+ self.piece_pos = TET_START_PIECE_POS; // that's about middle top, we count from 1 ARGH
+
+ if(autocvar_g_bastet)
+ {
+ self.piece_type = BastetPiece();
+ self.next_piece = bastet_piece[6];
+ }
else
- self.piece_type = RandomPiece();
- self.next_piece = RandomPiece();
+ {
+ if (self.next_piece)
+ self.piece_type = self.next_piece;
+ else
+ self.piece_type = RandomPiece();
+ self.next_piece = RandomPiece();
+ }
keyss = 0; // no movement first frame
self.tet_autodown = time + 0.2;
brand_new = 1;
sv_airstrafeaccelerate = cvar("sv_airstrafeaccelerate");
sv_maxairstrafespeed = cvar("sv_maxairstrafespeed");
sv_aircontrol = cvar("sv_aircontrol");
+ sv_aircontrol_power = cvar("sv_aircontrol_power");
sv_warsowbunny_airforwardaccel = cvar("sv_warsowbunny_airforwardaccel");
sv_warsowbunny_accel = cvar("sv_warsowbunny_accel");
sv_warsowbunny_topspeed = cvar("sv_warsowbunny_topspeed");
target_spawn_useon(e);
e.target_spawn_id = self.target_spawn_id;
}
+ else if(self.target == "*activator")
+ {
+ // edit entity
+ if(activator)
+ target_spawn_useon(activator);
+ }
else
{
// edit entity
void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end, float nomonsters, entity forent, entity zone, WarpZone_trace_callback_t cb)
{
- float frac, sol;
+ float frac, sol, i;
vector o0, e0;
entity wz;
vector vf, vr, vu;
WarpZone_MakeAllSolid();
sol = -1;
frac = 0;
+ i = 16;
for(;;)
{
+ if(--i < 1)
+ {
+ dprint("Too many warpzones in sequence, aborting trace.\n");
+ break;
+ }
tracebox(org, mi, ma, end, nomonsters, forent);
if(cb)
cb(org, trace_endpos, end);
void WarpZone_TraceToss_ThroughZone(entity e, entity forent, entity zone, WarpZone_trace_callback_t cb)
{
- float g, dt;
+ float g, dt, i;
vector vf, vr, vu, v0, o0;
entity wz;
WarpZone_MakeAllSolid();
g = cvar("sv_gravity") * e.gravity;
WarpZone_tracetoss_time = 0;
+ i = 16;
for(;;)
{
+ if(--i < 1)
+ {
+ dprint("Too many warpzones in sequence, aborting trace.\n");
+ break;
+ }
tracetoss(e, forent);
if(cb)
cb(e.origin, trace_endpos, trace_endpos);
--- /dev/null
+textures/electro_plasma
+{
+ {
+ map textures/electro_plasma.tga
+ tcMod scroll 0.03 0.001
+ }
+}
+
+textures/electro_plasma_hull
+{
+ {
+ map textures/electro_plasma_hull.tga
+ alphaFunc GT0
+ rgbGen Vertex
+ }
+}
--- /dev/null
+textures/fireball
+{
+ {
+ map textures/fireball
+ tcgen environment
+ }
+ {
+ map $lightmap
+ }
+}
--- /dev/null
+textures/flags/flag_red_cloth {
+ cull none
+ deformVertexes wave 100 sin 0 0.4 0 2.5
+ {
+ map textures/flags/flag_red_cloth.tga
+ }
+}
+
+textures/flags/flag_red_laser {
+ {
+ map textures/flags/flag_red_laser.tga
+ tcMod scroll 0.2 -1
+ blendfunc add
+ }
+}
+
+
+textures/flags/flag_blue_cloth {
+ cull none
+ deformVertexes wave 100 sin 0 0.4 0 2.5
+ {
+ map textures/flags/flag_blue_cloth.tga
+ }
+}
+
+textures/flags/flag_blue_laser {
+ {
+ map textures/flags/flag_blue_laser.tga
+ tcMod scroll 0.2 -1
+ blendfunc add
+ }
+}
+
--- /dev/null
+hlac_plasma
+{
+ {
+ map textures/hlac_plasma.tga
+ tcMod scroll 22.5 0.2
+ tcmod scale 0.01 0.01
+ }
+}
+
+hlac_metal
+{
+ cull none
+ {
+ map textures/hlac_metal.tga
+ rgbgen vertex
+ }
+}
+hlac_glass
+{
+ qer_editorimage textures/hlac_glass.tga
+ surfaceparm trans
+ cull disable
+ qer_trans 0.5
+ {
+ map textures/hlac_glass.tga
+ blendfunc add
+ //rgbGen vertex
+ tcgen environment
+ tcmod scale 4 4
+ }
+}
+hlac_bullet
+{
+ cull disable
+ deformVertexes autosprite
+ {
+ map models/hlac_bullet.tga
+ blendfunc add
+ }
+}
--- /dev/null
+ons_shield
+{
+ {
+ map textures/ons_shield.tga
+ tcMod rotate 15
+ tcMod scale 0.3 0.3
+ tcMod scroll 0.03 0.001
+ tcGen environment
+ }
+}
+
+ons_pad_text
+{
+ cull none
+ {
+ map textures/ons_text.tga
+ tcMod scroll 0.1 0
+ blendfunc add
+
+ }
+}
+
+ons_icon_text
+{
+ {
+ map textures/ons_text.tga
+ tcMod scroll 0.1 0
+ }
+}
+
+ons_icon_thrust
+{
+ {
+ map textures/ons_icon_thrust.tga
+ tcMod scroll 3 0
+ tcMod rotate 10
+ }
+}
+ons_gen_spark
+{
+ cull none
+ {
+ animmap 9 textures/generator_lightning.tga textures/generator_lightning2.tga
+ tcMod scroll 0.5 0
+ blendfunc add
+
+ }
+}
+ons_fire
+{
+ {
+ map textures/ons_boom1.tga
+ tcMod scroll 0.05 0.1
+ tcMod rotate 0.01
+ blendfunc add
+
+ }
+}
+ons_smoke
+{
+ deformVertexes wave sin 1 3 2 0.2
+ {
+ map textures/ons_smoke1.tga
+ tcMod scroll 0.01 0.04
+ tcMod rotate 0.01
+ alphaFunc GE128
+
+ }
+}
+ons_shockwave
+{
+ cull none
+ {
+ map textures/ons_shockwave1.tga
+ tcMod scroll 0.2 0
+ blendfunc add
+
+ }
+}
+ons_shockwave2
+{
+ {
+ map textures/ons_shockwave2.tga
+ tcMod rotate 85
+ tcMod scroll 0.03 0.6
+ tcGen environment
+ blendfunc add
+ }
+}
+
+ons_ray
+{
+cull none
+ {
+ map textures/ons_ray.tga
+ tcMod rotate 85
+ blendfunc add
+ }
+}
\ No newline at end of file
--- /dev/null
+portals_red_vortex
+{
+ cull none
+ deformVertexes wave 100 sin 1.5 0.6 0 1.5
+ {
+ map textures/portals/portals_red_vortex.tga
+ tcMod rotate 10
+ blendfunc blend
+ }
+}
+
+portals_blue_vortex
+{
+ cull none
+ deformVertexes wave 100 sin 1.5 0.6 0 1.5
+ {
+ map textures/portals/portals_blue_vortex.tga
+ tcMod rotate 10
+ blendfunc blend
+ }
+}
+
+portals_inactive_vortex
+{
+ cull none
+ deformVertexes wave 100 sin 1.5 0.6 0 1.5
+ {
+ map textures/portals/portals_inactive_vortex.tga
+ tcMod rotate 10
+ blendfunc blend
+ }
+}
+
+textures/portals/portals_red
+{
+ surfaceparm nonsolid
+ {
+ map textures/portals/portals_red.tga
+ }
+ {
+ map $lightmap
+ blendfunc filter
+ }
+}
+
+textures/portals/portals_blue
+{
+ surfaceparm nonsolid
+ {
+ map textures/portals/portals_blue.tga
+ }
+ {
+ map $lightmap
+ blendfunc filter
+ }
+}
+
+textures/portals/portals_inactive
+{
+ surfaceparm nonsolid
+ {
+ map textures/portals/portals_inactive.tga
+ }
+ {
+ map $lightmap
+ blendfunc filter
+ }
+}
--- /dev/null
+textures/shotgun_sight
+{
+ surfaceparm trans
+
+ {
+ map textures/shotgun_sight.tga
+ blendfunc add
+ //rgbGen vertex
+ }
+}
--- /dev/null
+darkvisor
+{
+ qer_editorimage darkvisor.tga
+ {
+ map darkvisor.tga
+ rgbGen vertex
+ tcgen environment
+ tcmod scale 4 4
+ }
+}
\ No newline at end of file
--- /dev/null
+teamfx/blobblue
+{
+surfaceparm trans
+deformVertexes autosprite
+{
+ map models/teamfx/blobblue.tga
+ blendfunc add
+}
+}
+
+teamfx/blobred
+{
+surfaceparm trans
+deformVertexes autosprite
+{
+ map models/teamfx/blobred.tga
+ blendfunc add
+}
+
+}
+
+teamfx/blobyellow
+{
+surfaceparm trans
+deformVertexes autosprite
+{
+ map models/teamfx/blobyellow.tga
+ blendfunc add
+}
+
+}
+
+teamfx/blobpink
+{
+surfaceparm trans
+deformVertexes autosprite
+{
+ map models/teamfx/blobpink.tga
+ blendfunc add
+}
+
+}
+
+teamfx/bluering
+{
+surfaceparm trans
+{
+ map models/teamfx/blobblue.tga
+ blendfunc add
+}
+}
+teamfx/redring
+{
+surfaceparm trans
+{
+ map models/teamfx/blobyellow.tga
+ blendfunc add
+}
+}
+teamfx/yellowring
+{
+surfaceparm trans
+{
+ map models/teamfx/blobpink.tga
+ blendfunc add
+}
+}
+teamfx/pinkring
+{
+surfaceparm trans
+{
+ map models/teamfx/blobpink.tga
+ blendfunc add
+}
+}
+teamfx/flare
+{
+surfaceparm trans
+deformVertexes autosprite
+{
+ map models/teamfx/flare.tga
+ blendfunc add
+}
+}
+teamfx/rayblue
+{
+surfaceparm trans
+deformVertexes autosprite
+{
+ map models/teamfx/rayblue.tga
+ blendfunc add
+}
+}
+teamfx/rayred
+{
+surfaceparm trans
+deformVertexes autosprite
+{
+ map models/teamfx/rayred.tga
+ blendfunc add
+}
+}
+teamfx/rayyellow
+{
+surfaceparm trans
+deformVertexes autosprite
+{
+ map models/teamfx/rayyellow.tga
+ blendfunc add
+}
+}
+teamfx/raypink
+{
+surfaceparm trans
+deformVertexes autosprite
+{
+ map models/teamfx/raypink.tga
+ blendfunc add
+}
+}
--- /dev/null
+textures/tuba
+{
+ {
+ map textures/tuba
+ tcgen environment
+ }
+ {
+ map $lightmap
+ }
+}
+textures/tuba_misc
+{
+ {
+ map textures/tuba
+ }
+ {
+ map $lightmap
+ }
+}