Changeset 486 for Daodan


Ignore:
Timestamp:
Dec 13, 2009, 12:01:21 PM (15 years ago)
Author:
gumby
Message:

Fixed(?) Code.

Location:
Daodan/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Daodan/src/Flatline.c

    r484 r486  
    289289                        uint16_t i = data->PlayerNum;
    290290                        //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                       
    293295                        PlayerList[i]->Chr->Health = data->Health;
    294296                        PlayerList[i]->Chr->MaxHealth = data->MaxHealth;
     
    302304                        PlayerList[i]->Actions2 = data->Inputs.Actions2;
    303305                        ActiveCharacter * Active = ((ActiveCharacter*)(ONrGetActiveCharacter(PlayerList[i]->Chr)));
    304                        
    305                         //needs special case for jumping\possibly falling characters
     306                        if(!Active) break;
     307                       
    306308                        Active->PhyContext_->Position = data->Position;
    307309                       
    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                               
    311323                        break;
    312324                default:
     
    378390        }
    379391#endif
    380         if(!server_started) return ONgGameState;
     392        if(!(server_started || client_connected)) return ONgGameState;
    381393        uint16_t i;
    382394        for(i = 0; i < max_connections; i++) {
    383                 if(!PlayerList[i]) continue;
     395                if(PlayerList[i] == 0) continue;
    384396                char * Active_Player = (void*)ONrGetActiveCharacter(PlayerList[i]->Chr);
    385                 if(!Active_Player) return ONgGameState;
     397               
     398                if(Active_Player == 0) continue;
    386399                GameInput * Active_Input = (void*)( Active_Player + 0x2158);
    387                        
     400                if(server_started) {
    388401                        flatline_packet data_out = {0};
    389402                        data_out.id = PLAYER_DATA;
     
    399412                        data->CosmeticFacing = PlayerList[i]->Chr->CosmeticFacing;
    400413                        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)) {
    405432                        Active_Input->Stop.Actions1 = ~PlayerList[i]->Actions1 & Active_Input->Current.Actions1;
    406433                        Active_Input->Stop.Actions2 = ~PlayerList[i]->Actions2 & Active_Input->Current.Actions2;
     
    413440                        Active_Input->MouseDeltaX = PlayerList[i]->MouseDeltaX;
    414441                        Active_Input->MouseDeltaY = PlayerList[i]->MouseDeltaY;
    415                         UDPServer_SendToAll(&data_out, sizeof(player_data) + FLATLINE_HEADER);
    416                         }
     442                }
    417443        }
    418444        return ONgGameState;
  • Daodan/src/Flatline.h

    r484 r486  
    115115        input_struct Inputs;
    116116        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;
    117123} player_data;
    118124
Note: See TracChangeset for help on using the changeset viewer.