Last active
August 29, 2015 14:01
-
-
Save ZaSpai/54c02c2b43c55a39dc30 to your computer and use it in GitHub Desktop.
Tentative page for QC Wep Plugin until I decide to split things off into separate pages for Weapons/Bullets and Pickups/Networking. Refer to other pages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //argument0 and argument1 definitions | |
| globalvar QCResource, zsQC; | |
| QCResource = directory; | |
| zsQC = packetID; | |
| //initialize the plugin options | |
| ini_open("gg2.ini"); | |
| global.inputDropWep = ini_read_real("Plugins","qcwep_drop",ord('G')); | |
| global.showWepChgToggle = ini_read_real("Plugins","qcwep_notif",1); | |
| //byte initialization | |
| globalvar QCWEP_CLJOIN, QCWEP_JOINSV, QCWEP_CREATE, QCWEP_DELETE, QCWEP_POSYNC, QCWEP_GETWEP, QCWEP_CLDROP, QCWEP_DROPSV, QCWEP_WEPCHG, QCWEP_MAPCHG; | |
| QCWEP_CLJOIN = 127; //client informs the server that they have joined so they can receive info on pickups | |
| QCWEP_JOINSV = 128; //server informs the recently joined client of all existing pickups and info | |
| QCWEP_CREATE = 129; //syncs pickup creation | |
| QCWEP_DELETE = 130; //syncs pickup destruction (called along with WEPCHG when a weaopn was picked up) | |
| QCWEP_POSYNC = 131; //syncs pickup position | |
| QCWEP_GETWEP = 132; //client notifies server of a weapon picked up (followed by server WEPCHG + DELETE events) | |
| QCWEP_CLDROP = 133; //client notifies server of a dropped weapon | |
| QCWEP_DROPSV = 134; //server responds to CLDROP (followed by server WEPCHG + CREATE events) | |
| QCWEP_WEPCHG = 135; //syncs the change of subtype of weapons (weapon subtypes are normally synced in the weapon's ev_user12/13) | |
| QCWEP_MAPCHG = 136; //syncs the reset of wep pickups for the next map by clearing ds_list and destroying qcweps | |
| //QCWEP_?????? = 137; //may or may not sync weapon attributes for Spectrum (laser split angle and position), Nebula (time to detonation), | |
| //Erinys (power level) and Eclipse (charge power/type) | |
| //Stuff | |
| //plugin options menu (ported from Lorgan plugins) | |
| global.qcWepOptions = object_add(); | |
| object_set_parent(global.wcWepOptions,MenuController); | |
| object_set_depth(global.qcWepOptions,-130000); | |
| object_event_add(global.qcWepOptions,ev_create,0,' | |
| menu_create(48, 172, 500, 260, 32, 40, 104, 6); | |
| menumode = true; | |
| if room != Options { | |
| menu_setdimmed(); | |
| } | |
| menu_background(512, 24, 8, 12, 4); | |
| bgtabs = false; | |
| menu_addedit_key("Drop QC Weapon:", "global.inputDropWep"); | |
| menu_addedit_select("Weapon Change Notifications:", "global.showWepChgToggle", ' | |
| gg2_write_ini("Settings", "qcwep_changelog", argument0); | |
| '); | |
| menu_add_option(0, "Off"); | |
| menu_add_option(1, "In Kill Log"); | |
| menu_add_option(2, "Under Kill Log"); | |
| menu_addback("Back", ' | |
| instance_destroy(); | |
| if(room == Options) | |
| room_goto_fix(Menu); | |
| else | |
| instance_create(0,0,InGameMenuController); | |
| '); | |
| '); | |
| object_event_add(global.qcWepOptions,ev_destroy,0,' | |
| ini_open("gg2.ini"); | |
| ini_write_real("Plugins","qcwep_dropwep",global.inputDropWep); | |
| ini_close(); | |
| '); | |
| object_event_add(InGameMenuController,ev_create,0,' | |
| menu_addlink("QC Weapon Plugin Options", " | |
| instance_destroy(); | |
| instance_create(0,0,global.qcWepOptions); | |
| "); | |
| '); | |
| //QC Wep plugin Network Controller | |
| global.QCNetwork = object_create; | |
| object_set_persistent(global.QCNetwork,true); | |
| object_event_add(global.QCNetwork,ev_create,0," | |
| global.qcWepList = ds_list_create(); | |
| if (!global.isHost) { | |
| global.qcWepBuffer = buffer_create(); | |
| write_ubyte(global.qcWepBuffer, QCWEP_CLJOIN); | |
| PluginPacketSend(zsQC, global.qcWepBuffer, false); | |
| buffer_destroy(global.qcWepBuffer); | |
| } | |
| alarm[0] = 12; //picked this number and I assume 30 and 60fps won't desync...? not yet tested in game | |
| "); | |
| object_event_add(global.QCNetwork,ev_alarm,0," | |
| if ((global.isHost) && ds_list_size(global.qcWepList) > 0) { | |
| global.qcWepBuffer = buffer_create(); | |
| write_ubyte(global.qcWepBuffer, QCWEP_POSYNC); | |
| write_ubyte(global.qcWepBuffer, ds_list_size(global.qcWepList)); | |
| for(i=0; i<ds_list_size(global.qcWepList); i+=1) { | |
| pickup = ds_list_find_value(global.Weps, i); | |
| with (pickup) { | |
| event_user(12); | |
| } | |
| } | |
| PluginPacketSend(zsQC, global.qcWepBuffer, false); | |
| buffer_destroy(global.qcWepBuffer); | |
| alarm[0]=6; | |
| } | |
| "); | |
| object_event_add(global.QCNetwork,ev_step,0," | |
| while(PluginPacketGetBuffer(zsQC) != -1) { | |
| global.qcRecBuffer = PluginPacketGetBuffer(zsQC); | |
| switch(read_ubyte(global.qcRecBuffer)): | |
| case QCWEP_CLJOIN: | |
| if !(global.isHost) { | |
| buffer_destroy(global.qcWepBuffer); | |
| } else { | |
| var joiningPlayer; | |
| joiningPlayer = PluginPacketGetPlayer(zsQC); | |
| PluginPacketPop(zsQC); | |
| global.qcWepBuffer = buffer_create(); | |
| write_ubyte(global.qcWepBuffer, QCWEP_JOINSV); | |
| write_ubyte(global.qcWepBuffer, ds_list_size(global.qcWepList)); | |
| for(i=0; i<ds_list_size(global.qcWepList); i+=1) { | |
| var pickup; | |
| pickup = ds_list_find_value(global.Weps, i); | |
| with (pickup) { | |
| write_ushort(global.qcWepBuffer, round(x*5)); | |
| write_ushort(global.qcWepBuffer, round(y*5)); | |
| write_ubyte(global.qcWepBuffer, wepID); | |
| write_byte(global.qcWepBuffer, round(hspeed*8.5/global.delta_factor)); | |
| write_byte(global.qcWepBuffer, round(vspeed*8.5/global.delta_factor)); | |
| write_ubyte(global.qcWepBuffer, subtype+1); | |
| write_ushort(global.qcWepBuffer, round(alarm[0]*5*global.delta_factor); | |
| write_ushort(global.qcWepBuffer, round(alarm[1]*5*global.delta_factor); | |
| } | |
| } | |
| PluginPacketSendTo(zsQC, global.qcWepBuffer, joiningPlayer); | |
| buffer_destroy(global.qcWepBuffer); | |
| } | |
| break; | |
| case QCWEP_JOINSV: | |
| var wepCount, pickup; | |
| wepCount = read_ubyte(global.qcRecBuffer); | |
| for(i=0; i<ds_list_sizewepCount; i+=1) { | |
| var pickup, xx, yy; | |
| xx = read_ushort(global.qcRecBuffer)/5; | |
| yy = read_ushort(global.qcRecBuffer)/5; | |
| pickup = instance_create(xx,yy,global.QCWep); | |
| ds_list_add(global.qcWepList, pickup); | |
| with (pickup) { | |
| var wepID; | |
| wepID = read_ubyte(global.qcRecBuffer); | |
| hspeed = read_byte(global.qcRecBuffer)*global.delta_factor/8.5; | |
| vspeed = read_byte(global.qcRecBuffer)*global.delta_factor/8.5; | |
| subtype = (read_ubyte(global.qcRecBuffer))-1; | |
| alarm[0] = read_ushort(global.qcRecBuffer)*global.delta_factor; | |
| alarm[1] = read_ushort(global.qcRecBuffer)*global.delta_factor; | |
| } | |
| } | |
| PluginPacketPop(zsQC); | |
| break; | |
| case QCWEP_CREATE: | |
| var subtype, rangle, xx, yy; | |
| subtype = read_ubyte(global.qcRecBuffer)-1; | |
| rangle = read_ubyte(global.qcRecBuffer); | |
| xx = read_ushort(global.qcRecBuffer)/5; | |
| yy = read_ushort(global.qcRecBuffer)/5; | |
| PluginPacketPop(zsQC); | |
| doEventCreateQCWep(subtype, rangle, xx, yy); | |
| break; | |
| case QCWEP_DELETE: | |
| var wepDelID; | |
| wepDelID = read_ubyte(global.qcRecBuffer); | |
| PluginPacketPop(zsQC); | |
| doEventDeleteQCWep(wepDelID); | |
| break; | |
| case QCWEP_POSYNC: | |
| var wepCount, pickup; | |
| wepCount = read_ubyte(global.qcRecBuffer); | |
| for(i=0; i<ds_list_size(global.qcWepList); i+=1) { | |
| pickup = ds_list_find_value(global.Weps, i); | |
| with (pickup) { | |
| event_user(13); | |
| } | |
| } | |
| PluginPacketPop(zsQC); | |
| break; | |
| case QCWEP_GETWEP: | |
| var pickupID, playerID, wepPlayer, wepObject, weptype; | |
| pickupID = read_ubyte(global.qcRecBuffer); | |
| weptype = (read_ubyte(global.qcRecBuffer))-1; | |
| playerID = read_ubyte(global.qcRecBuffer); | |
| PluginPacketPop(zsQC); | |
| wepPlayer = ds_list_find_value(global.players, playerID); | |
| doEventChangeQCWep(wepPlayer,weptype); | |
| doEventDeleteQCWep(pickupID); | |
| break; | |
| case QCWEP_CLDROP: | |
| var playerID, dropPlayer, droptype, rangle, xx, yy; | |
| playerID = read_ubyte(global.qcRecBuffer); | |
| droptype = (read_ubyte(global.qcWepBuffer)-1); | |
| PluginPacketPop(zsQC); | |
| dropPlayer = ds_list_find_value(global.players, playerID); | |
| xx = dropPlayer.object.x; | |
| yy = dropPlayer.object.y; | |
| rangle = irandom(20); | |
| global.qcWepBuffer = buffer_create(); | |
| write_ubyte(global.qcWepBuffer, QCWEP_DROPSV); | |
| write_ubyte(global.qcWepBuffer, playerID)); | |
| write_ubyte(global.qcWepBuffer, (droptype+1)); | |
| write_ubyte(global.qcWepBuffer, rangle); | |
| write_ushort(global.qcWepBuffer, round(xx * 5)); | |
| write_ushort(global.qcWepBuffer, round(yy * 5)); | |
| PluginPacketSend(zsQC, global.qcWepBuffer, false); | |
| buffer_destroy(global.qcWepBuffer); | |
| doEventChangeQCWep(dropPlayer, -1); | |
| doEventCreateQCWep(droptype, rangle, xx, yy); | |
| break; | |
| case QCWEP_DROPSV: | |
| var playerID, droptype, rangle, xx, yy, dropPlayer; | |
| playerID = read_ubyte(global.qcRecBuffer); | |
| droptype = (read_ubyte(global.qcRecBuffer))-1; | |
| rangle = read_ubyte(global.qcRecBuffer); | |
| xx = (read_ushort(global.qcRecBuffer))/5; | |
| yy = (read_ushort(global.qcRecBuffer))/5; | |
| dropPlayer = ds_list_find_value(global.players, playerID); | |
| PluginPacketPop(zsQC); | |
| doEventChangeQCWep(dropPlayer, -1); | |
| doEventCreateQCWep(droptype, rangle, xx, yy); | |
| break; | |
| case QCWEP_MAPCHG: | |
| ds_list_clear(global.qcWepList); | |
| with (global.QCWep) { | |
| instance_destroy(); | |
| } | |
| break; | |
| default: | |
| promptRestartOrQuit("Unexpected server-sent data was produced by the QC Weapons plugin. Please report this in the plugin's topic."); | |
| exit; | |
| } | |
| if ((global.isHost) && (GameServer.impendingMapChange == 0)) { | |
| global.qcWepBuffer = buffer_create(); | |
| write_ubyte(global.qcWepBuffer, QCWEP_MAPCHG); | |
| PluginPacketSend(zsQC, global.qcWepBuffer, false); | |
| buffer_destroy(global.qcWepBuffer); | |
| ds_list_clear(global.qcWepList); | |
| with (global.QCWep) { | |
| instance_destroy(); | |
| } | |
| } | |
| "); | |
| //Input crap for global.inputDropWep | |
| object_event_add(PlayerControl,ev_step,ev_step_normal,' | |
| if(global.myself.object != -1) | |
| { | |
| if(!menuOpen) | |
| { | |
| if(keyboard_check(global.inputDropWep) and (global.myself.class == CLASS_QUOTE) and (global.myself.object.subtype != -1)) { | |
| if (!global.isHost) { | |
| var playerID; | |
| playerID = ds_list_find_index(global.players,global.myself); | |
| global.qcWepBuffer = buffer_create(); | |
| write_ubyte(global.qcWepBuffer, QCWEP_CLDROP); | |
| write_ubyte(global.qcWepBuffer, playerID); | |
| write_ubyte(global.qcWepBuffer, (global.myself.object.subtype)+1); | |
| PluginPacketSend(zsQC, global.qcWepBuffer, false); | |
| buffer_destroy(global.qcWepBuffer); | |
| } else if (global.isHost) { | |
| var playerID, droptype, rangle, xx, yy, dropPlayer; | |
| xx = global.myself.object.x; | |
| yy = global.myself.object.y; | |
| rangle = irandom(20); | |
| droptype = global.myself.object.subtype)+1; | |
| playerID = ds_list_find_index(global.players,global.myself); | |
| dropPlayer = ds_list_find_value(global.players, playerID); | |
| global.qcWepBuffer = buffer_create(); | |
| write_ubyte(global.qcWepBuffer, QCWEP_DROPSV); | |
| write_ubyte(global.qcWepBuffer, playerID); | |
| write_ubyte(global.qcWepBuffer, (droptype+1)); | |
| write_ubyte(global.qcWepBuffer, rangle); | |
| write_ushort(global.qcWepBuffer, round(xx * 5)); | |
| write_ushort(global.qcWepBuffer, round(yy * 5)); | |
| PluginPacketSend(zsQC, global.qcWepBuffer, false); | |
| buffer_destroy(global.qcWepBuffer); | |
| doEventChangeQCWep(dropPlayer, -1); | |
| doEventCreateQCWep(droptype, rangle, xx, yy); | |
| } | |
| } | |
| } | |
| } | |
| '); | |
| //Changes to Character | |
| object_event_add(Character,ev_create,0," | |
| subtype = -1; | |
| "); | |
| object_event_clear(Character,ev_step,ev_step_end); | |
| object_event_add(Character,ev_step,ev_step_end," | |
| charSetSolids(); | |
| // Handle dropdown platforms | |
| dropdownrectify = false; | |
| with(DropdownPlatform) | |
| { | |
| if(place_meeting(x, y, other) and !(other.keyState & $02) | |
| and (other.bbox_bottom - (other.y - other.yprevious) - 1) | |
| < (bbox_top - (y - yprevious))) | |
| { | |
| while(place_meeting(x, y, other)) | |
| other.y -= 0.1; | |
| other.vspeed = 0; | |
| dropdownrectify = true; | |
| } | |
| } | |
| // PICKUP PICKING UP | |
| with(global.QCWep) | |
| { | |
| if ((global.isHost) and (place_meeting(x, y, other)) and (other.player.class == CLASS_QUOTE) and (other.keyState & $02)) { | |
| var pickupID, type, wepPlayer; | |
| pickupID = self.wepID; | |
| type = self.subtype; | |
| wepPlayer = ds_list_find_index(global.players,other.ownerPlayer); | |
| global.qcWepBuffer = buffer_create(); | |
| write_ubyte(global.qcWepBuffer, QCWEP_GETWEP); | |
| write_ubyte(global.qcWepBuffer, pickupID); //the pickup's ID | |
| write_ubyte(global.qcWepBuffer, type+1); //the pickup's subtype | |
| write_ubyte(global.qcWepBuffer, wepPlayer); // the player ID | |
| PluginPacketSend(zsQC, global.qcWepBuffer, true); | |
| buffer_destroy(global.qcWepBuffer); | |
| doEventDeleteQCWep(pickupID); | |
| doEventChangeQCWep(wepPlayer,type); | |
| } | |
| } | |
| // Climbing down stairs | |
| // if we aren't falling this frame, and we're not on a dropdown platform | |
| if(vspeed == 0 and (!place_meeting(x, y+1, DropdownPlatform) or place_meeting(x, y, DropdownPlatform))) | |
| { | |
| if(place_free(x,y+6)) | |
| if(!place_free(x,y+7)) | |
| y += 6; | |
| else if(speed > 6) if(place_free(x,y+12)) if(!place_free(x,y+13)) | |
| y += 12; | |
| } | |
| xprevious = x; | |
| yprevious = y; | |
| if(!place_free(x,y+1) and vspeed >= 0) | |
| moveStatus = 0; | |
| charUnsetSolids(); | |
| //add QC wep creation to the ev_step_end of Character upon death. I want this only to occur on certain damage sources | |
| //also I'll add a pickup script if the keyState & $02 while in contact with the pickup. That's for later tho | |
| if(global.isHost && hp<=0) { | |
| var assistant; | |
| assistant = secondToLastDamageDealer; | |
| with(lastDamageDealer) | |
| if (object) | |
| if (object.healer) | |
| assistant = object.healer; | |
| if (lastDamageSource == WEAPON_BLADE || WEAPON_BUBBLE) { | |
| var rangle, xx, yy; | |
| rangle = irandom(20); | |
| xx = player.x; | |
| yy = player.y; | |
| sendEventCreateQCWep(player,player.class,rangle,xx,yy); | |
| doEventCreateQCWep(player,player.class,rangle,xx,yy); | |
| } | |
| sendEventPlayerDeath(player, lastDamageDealer, assistant, lastDamageSource); | |
| doEventPlayerDeath(player, lastDamageDealer, assistant, lastDamageSource); | |
| with(GameServer) { | |
| ServerBalanceTeams(); | |
| } | |
| exit; | |
| } | |
| if(hp>maxHp) { | |
| hp=maxHp; | |
| } | |
| if(((aimDirection+270) mod 360)>180) { | |
| image_xscale=1; | |
| currentWeapon.image_xscale=1; | |
| currentWeapon.image_angle = aimDirection; | |
| } else { | |
| image_xscale=-1; | |
| currentWeapon.image_xscale=-1; | |
| currentWeapon.image_angle = aimDirection+180; | |
| } | |
| currentWeapon.x=round(x); | |
| currentWeapon.y=round(y); | |
| // Limit people to the area of the room to prevent the | |
| // 'Falling through the floors' issue. | |
| if(x<0) { | |
| x=0; | |
| } | |
| if(x>map_width()){ | |
| x = map_width(); | |
| } | |
| if(y<0) { | |
| y = 0; | |
| } | |
| if(y>map_height()){ | |
| y = map_height(); | |
| } | |
| // Cloak | |
| if (cloak and cloakAlpha > 0 and !cloakFlicker) | |
| cloakAlpha = max(cloakAlpha - 0.05, 0); | |
| else if (!cloak and cloakAlpha < 1) | |
| cloakAlpha = min(cloakAlpha + 0.05, 1); | |
| // Taunts | |
| if (taunting) | |
| { | |
| tauntindex += tauntspeed*0.1 * global.delta_factor; | |
| if (tauntindex >= tauntend) | |
| taunting = false; | |
| } | |
| //sandvich | |
| if (omnomnomnom) | |
| { | |
| omnomnomnomindex += 0.25 * global.delta_factor; | |
| image_xscale=xscale; | |
| if(hp < maxHp) // This should prevent the 'ate and got hit but didn't refresh cooldown' bug | |
| { // Also, cooldown is now reset continually until fully healed or finished eating. | |
| canEat = false; | |
| alarm[6] = eatCooldown / global.delta_factor; | |
| } | |
| if (hp <= maxHp) | |
| hp += 1.6 * global.delta_factor; | |
| if (omnomnomnomindex >= omnomnomnomend) | |
| omnomnomnom=false; | |
| } | |
| //for things polling whether the character is on a medcabinet | |
| onCabinet = place_meeting(x, y, HealingCabinet); | |
| // Last x/y position for death cam if player is dead | |
| player.lastKnownx=x; | |
| player.lastKnowny=y; | |
| // Here the view is set | |
| if (player == global.myself) | |
| { | |
| if (object_is_ancestor(object_index, Sniper) and zoomed) | |
| { | |
| var relxmouse, relymouse; | |
| relxmouse = min(max(window_views_mouse_get_x()-view_xview[0], 0), view_wview); | |
| relymouse = min(max(window_views_mouse_get_y()-view_yview[0], 0), view_hview); | |
| view_xview[0] = x+relxmouse-view_wview[0]; | |
| view_yview[0] = y+relymouse-view_hview[0]; | |
| } | |
| else | |
| { | |
| view_xview[0] = x-view_wview[0]/2; | |
| view_yview[0] = y-view_hview[0]/2; | |
| } | |
| } | |
| realnumflames = numFlames * burnDuration / maxDuration; | |
| "); | |
| object_event_clear(Character,ev_other,ev_user12); | |
| object_event_add(Character,ev_other,ev_user12," | |
| { | |
| var temp; | |
| write_ubyte(global.serializeBuffer, keyState); | |
| write_ushort(global.serializeBuffer, netAimDirection); | |
| write_ubyte(global.serializeBuffer, aimDistance/2); | |
| if(global.updateType == QUICK_UPDATE or global.updateType == FULL_UPDATE) { | |
| write_ushort(global.serializeBuffer, x*5); | |
| write_ushort(global.serializeBuffer, y*5); | |
| write_byte(global.serializeBuffer, hspeed*8.5); | |
| write_byte(global.serializeBuffer, vspeed*8.5); | |
| write_ubyte(global.serializeBuffer, ceil(hp)); | |
| write_ubyte(global.serializeBuffer, currentWeapon.ammoCount); | |
| temp = 0; | |
| if(cloak) temp |= $01; | |
| //allocate the next three bits of the byte for movestatus sync | |
| temp |= (moveStatus & $07) << 1; | |
| write_ubyte(global.serializeBuffer, temp); | |
| write_ubyte(global.serializeBuffer, (subtype+1)); | |
| } | |
| if(global.updateType == FULL_UPDATE){ | |
| write_ubyte(global.serializeBuffer, animationOffset); | |
| //class specific syncs | |
| switch(player.class) | |
| { | |
| case CLASS_SPY: | |
| write_ubyte(global.serializeBuffer, cloakAlpha*255); | |
| break; | |
| case CLASS_MEDIC: | |
| write_ubyte(global.serializeBuffer, currentWeapon.uberCharge*255/2000); | |
| break; | |
| case CLASS_ENGINEER: | |
| write_ubyte(global.serializeBuffer, nutsNBolts); | |
| break; | |
| case CLASS_SNIPER: | |
| write_ubyte(global.serializeBuffer, currentWeapon.t); | |
| break; | |
| default: | |
| write_ubyte(global.serializeBuffer, 0); | |
| } | |
| write_short(global.serializeBuffer, alarm[1]*global.delta_factor); | |
| write_ubyte(global.serializeBuffer, intel); | |
| write_short(global.serializeBuffer, intelRecharge); | |
| with(currentWeapon) { | |
| event_user(12); | |
| } | |
| } | |
| } | |
| "); | |
| object_event_clear(Character,ev_other,ev_user13); | |
| object_event_add(Character,ev_other,ev_user13," | |
| { | |
| receiveCompleteMessage(global.serverSocket,4,global.deserializeBuffer); | |
| keyState = read_ubyte(global.deserializeBuffer); | |
| aimDirection = read_ushort(global.deserializeBuffer)*360/65536; | |
| aimDistance = read_ubyte(global.deserializeBuffer)*2; | |
| var temp, newIntel; | |
| if(global.updateType == QUICK_UPDATE) or (global.updateType == FULL_UPDATE) { | |
| receiveCompleteMessage(global.serverSocket,10,global.deserializeBuffer); | |
| x = read_ushort(global.deserializeBuffer)/5; | |
| y = read_ushort(global.deserializeBuffer)/5; | |
| hspeed = read_byte(global.deserializeBuffer)/8.5; | |
| vspeed = read_byte(global.deserializeBuffer)/8.5; | |
| xprevious = x; | |
| yprevious = y; | |
| hp = read_ubyte(global.deserializeBuffer); | |
| currentWeapon.ammoCount = read_ubyte(global.deserializeBuffer); | |
| temp = read_ubyte(global.deserializeBuffer); | |
| cloak = (temp & $01 != 0); | |
| moveStatus = (temp >> 1) & $07; | |
| subtype = read_ubyte(global.deserializeBuffer) - 1; | |
| } | |
| if(global.updateType == FULL_UPDATE){ | |
| receiveCompleteMessage(global.serverSocket,7,global.deserializeBuffer); | |
| animationOffset = read_ubyte(global.deserializeBuffer); | |
| //class specific syncs | |
| switch(player.class) | |
| { | |
| case CLASS_SPY: | |
| cloakAlpha = read_ubyte(global.deserializeBuffer)/255; | |
| break; | |
| case CLASS_MEDIC: | |
| currentWeapon.uberCharge = read_ubyte(global.deserializeBuffer)*2000/255; | |
| break; | |
| case CLASS_ENGINEER: | |
| nutsNBolts = read_ubyte(global.deserializeBuffer); | |
| break; | |
| case CLASS_SNIPER: | |
| currentWeapon.t = read_ubyte(global.deserializeBuffer); | |
| break; | |
| default: | |
| read_ubyte(global.deserializeBuffer) | |
| } | |
| alarm[1]=read_short(global.deserializeBuffer)/global.delta_factor; | |
| if alarm[1] != 0 canGrabIntel = false; | |
| intel = read_ubyte(global.deserializeBuffer); | |
| intelRecharge = read_short(global.deserializeBuffer); | |
| with(currentWeapon) { | |
| event_user(13); | |
| } | |
| } | |
| event_user(1); | |
| } | |
| "); | |
| //define QCWep Pickup object | |
| global.QCWep = object_create; | |
| object_event_add(global.QCWep,ev_create,0," | |
| subtype = -1; | |
| image_speed = 0; | |
| alarm[0] = 450/global.delta_factor; | |
| alarm[1] = 300/global,delta_factor; | |
| "); | |
| object_event_add(global.QCWep,ev_alarm,0," | |
| //destroy weapon pickup | |
| if (global.isHost) { | |
| sendEventDeleteQCWep(wepID); | |
| doEventDeleteQCWep(wepID); | |
| } | |
| "); | |
| object_event_add(global.QCWep,ev_alarm,1," | |
| //set image alpha blink warning for final 5sec | |
| if image_alpha = 0.2 | |
| image_alpha = 1; | |
| else if image_alpha = 1 | |
| image_alpha = 0.2; | |
| alarm[1] = 30/global.delta_factor; | |
| "); | |
| object_event_add(global.QCWep,ev_step,ev_step_normal," | |
| vspeed += 0.4 * global.delta_factor; | |
| vspeed = min(vspeed,8); | |
| x += hspeed * global.delta_factor; | |
| y += vspeed * global.delta_factor; | |
| gunSetSolids(); | |
| if (place_meeting(x, y, ControlPointSetupGate) and ControlPointSetupGate.solid) | |
| move_bounce_solid(false); | |
| if (place_meeting(x, y, TeamGate) and TeamGate.solid) | |
| move_bounce_solid(false); | |
| if (place_meeting(x, y, Obstacle) and Obstacle.solid) | |
| move_bounce_solid(false); | |
| gunUnsetSolids(); | |
| x -= hspeed; | |
| y -= vspeed; | |
| "); | |
| object_event_add(global.QCWep,ev_other,ev_user12," | |
| write_ushort(global.qcWepBuffer, round(x*5)); | |
| write_ushort(global.qcWepBuffer, round(y*5)); | |
| write_byte(global.qcWepBuffer, round(hspeed*8.5/global.delta_factor)); | |
| write_byte(global.qcWepBuffer, round(vspeed*8.5/global.delta_factor)); | |
| write_ubyte(global.qcWepBuffer, subtype+1); | |
| write_ushort(global.qcWepBuffer, round(alarm[0]*5*global.delta_factor); | |
| write_ushort(global.qcWepBuffer, round(alarm[1]*5*global.delta_factor); | |
| "); | |
| object_event_add(global.QCWep,ev_other,ev_user13," | |
| x = read_ushort(global.qcRecBuffer)/5; | |
| y = read_ushort(global.qcRecBuffer)/5; | |
| hspeed = read_byte(global.qcRecBuffer)*global.delta_factor/8.5; | |
| vspeed = read_byte(global.qcRecBuffer)*global.delta_factor/8.5; | |
| subtype = read_ubyte(global.qcRecBuffer)-1; | |
| alarm[0] = read_ushort(global.qcRecBuffer)*global.delta_factor; | |
| alarm[1] = read_ushort(global.qcRecBuffer)*global.delta_factor; | |
| "); | |
| object_event_add(global.QCWep,ev_draw,0," | |
| if (0 <= subtype and subtype <= 9) | |
| draw_sprite_ext(sprite_index,subtype,x,y,1,1,0,c_white,1); | |
| else | |
| draw_sprite_ext(sprite_index,11,x,y,1,1,0,c_white,1); | |
| "); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment