Changeset 486 for Daodan/src
- Timestamp:
- Dec 13, 2009, 12:01:21 PM (15 years ago)
- Location:
- Daodan/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Daodan/src/Flatline.c
r484 r486 289 289 uint16_t i = data->PlayerNum; 290 290 //DDrConsole_PrintF("Got data for Player %i, %x", i, PlayerList[i]); 291 if (!PlayerList[i] || i > max_connections) break; 292 PlayerList[i]->Chr = ((GameState *)ONgGameState)->CharacterStorage; 291 if (i > max_connections || PlayerList[i] == 0) break; 292 293 //PlayerList[i]->Chr = ((GameState *)ONgGameState)->CharacterStorage; 294 293 295 PlayerList[i]->Chr->Health = data->Health; 294 296 PlayerList[i]->Chr->MaxHealth = data->MaxHealth; … … 302 304 PlayerList[i]->Actions2 = data->Inputs.Actions2; 303 305 ActiveCharacter * Active = ((ActiveCharacter*)(ONrGetActiveCharacter(PlayerList[i]->Chr))); 304 305 //needs special case for jumping\possibly falling characters306 if(!Active) break; 307 306 308 Active->PhyContext_->Position = data->Position; 307 309 308 //antilag, lol. 309 if((int)*((char*)(Active + 0x1AF8) + 0x166) > data->Frame) 310 *(uint16_t *)((char*)Active + 0x1C88) = data->Frame; 310 /* 311 int ptr = 0; 312 (TMrInstance_GetDataPtr('TRAM',data->Animation,&ptr)); *(void**)((char*)Active + 0x1AF8) = ptr; 313 314 *(uint16_t *)((char*)Active + 0x1AFC) = data->AnimationToState; 315 *(uint16_t *)((char*)Active + 0x1AFE) = data->AnimationFromState; 316 *(uint16_t *)((char*)Active + 0x1B00) = data->AnimationType; 317 *(uint16_t *)((char*)Active + 0x1B02) = data->NextAnimationType; 318 *(uint16_t *)((char*)Active + 0x1B04) = data->AnimationType2; 319 */ 320 if((int)*((char*)(Active + 0x1AF8) + 0x166) > data->Frame + 1) 321 *(uint16_t *)((char*)Active + 0x1C88) = data->Frame + 1; 322 311 323 break; 312 324 default: … … 378 390 } 379 391 #endif 380 if(! server_started) return ONgGameState;392 if(!(server_started || client_connected)) return ONgGameState; 381 393 uint16_t i; 382 394 for(i = 0; i < max_connections; i++) { 383 if( !PlayerList[i]) continue;395 if(PlayerList[i] == 0) continue; 384 396 char * Active_Player = (void*)ONrGetActiveCharacter(PlayerList[i]->Chr); 385 if(!Active_Player) return ONgGameState; 397 398 if(Active_Player == 0) continue; 386 399 GameInput * Active_Input = (void*)( Active_Player + 0x2158); 387 400 if(server_started) { 388 401 flatline_packet data_out = {0}; 389 402 data_out.id = PLAYER_DATA; … … 399 412 data->CosmeticFacing = PlayerList[i]->Chr->CosmeticFacing; 400 413 data->Frame = *(Active_Player + 0x1C88); 401 data->Inputs.Actions1 = PlayerList[i]->Actions1; 402 data->Inputs.Actions2 = PlayerList[i]->Actions2; 403 404 if(!server_started || i != 0 ) { 414 memcpy(data->Animation, TMrInstance_GetInstanceName(*(void **)(Active_Player + 0x1AF8)), 32); 415 data->AnimationToState = *(uint16_t *)(Active_Player + 0x1AFC); 416 data->AnimationFromState = *(uint16_t *)(Active_Player + 0x1AFE); 417 data->AnimationType = *(uint16_t *)(Active_Player + 0x1B00); 418 data->NextAnimationType = *(uint16_t *)(Active_Player + 0x1B02); 419 data->AnimationType2= *(uint16_t *)(Active_Player + 0x1B04); 420 if(i == 0) { 421 data->Inputs.Actions1 = ((GameState*)(ONgGameState))->Input.Current.Actions1; 422 data->Inputs.Actions2 = ((GameState*)(ONgGameState))->Input.Current.Actions2; 423 } 424 else{ 425 data->Inputs.Actions1 = PlayerList[i]->Actions1; 426 data->Inputs.Actions2 = PlayerList[i]->Actions2; 427 } 428 UDPServer_SendToAll(&data_out, sizeof(player_data) + FLATLINE_HEADER); 429 } 430 431 if( (server_started && i !=0) || (!server_started && i != client_slot)) { 405 432 Active_Input->Stop.Actions1 = ~PlayerList[i]->Actions1 & Active_Input->Current.Actions1; 406 433 Active_Input->Stop.Actions2 = ~PlayerList[i]->Actions2 & Active_Input->Current.Actions2; … … 413 440 Active_Input->MouseDeltaX = PlayerList[i]->MouseDeltaX; 414 441 Active_Input->MouseDeltaY = PlayerList[i]->MouseDeltaY; 415 UDPServer_SendToAll(&data_out, sizeof(player_data) + FLATLINE_HEADER); 416 } 442 } 417 443 } 418 444 return ONgGameState; -
Daodan/src/Flatline.h
r484 r486 115 115 input_struct Inputs; 116 116 uint16_t Frame; 117 char Animation[32]; 118 uint16_t AnimationToState; 119 uint16_t AnimationFromState; 120 uint16_t AnimationType; 121 uint16_t NextAnimationType; 122 uint16_t AnimationType2; 117 123 } player_data; 118 124
Note:
See TracChangeset
for help on using the changeset viewer.