INDEX SrvrSetTexture( uint32_t client_id, INDEX iWorld, INDEX iSector, INDEX iTexture ) { PWORLD world = GetSetMember( WORLD, &g.worlds, iWorld ); PSECTOR sector; if( !world || iSector == INVALID_INDEX ) return INVALID_INDEX; sector= GetSetMember( SECTOR, &world->sectors, iSector ); sector->iTexture = iTexture; #if defined( WORLD_SCAPE_SERVER_EXPORTS ) || defined( WORLDSCAPE_SERVICE ) MarkSectorUpdated( client_id, iWorld, iSector ); #endif return iSector; }
INDEX SrvrCreateSquareSector( uint32_t client_id, INDEX iWorld, PC_POINT pOrigin, RCOORD size ) { PWORLD world = GetSetMember( WORLD, &g.worlds, iWorld ); PSECTOR pSector; INDEX iSector; _POINT o, n; pSector = GetFromSet( SECTOR, &world->sectors ); #ifdef OUTPUT_TO_VIRTUALITY pSector->facet = AddNormalPlane( world->object, VectorConst_0, VectorConst_Z, 0 ); #endif iSector = GetMemberIndex( SECTOR, &world->sectors, pSector ); /* { char name[20]; sprintf( name, "%d", SectorIDs++ ); pSector->name = GetName( &world->names, name ); } */ pSector->iName = INVALID_INDEX; pSector->iWorld = iWorld; /* east */ addscaled( o, pOrigin, VectorConst_X, size/2 ); scale( n, VectorConst_Y, 20 ); // creates an open line.... pSector->iWall = SrvrCreateWall( client_id, iWorld, iSector, INVALID_INDEX, FALSE, INVALID_INDEX, FALSE, o, n ); /* south */ addscaled( o, pOrigin, VectorConst_Y, size/2 ); scale( n, VectorConst_X, -20 ); // creates a wall whos start is at the start of the wall... SrvrCreateWall( client_id, iWorld, iSector, pSector->iWall, TRUE, INVALID_INDEX, FALSE, o, n ); /* west */ addscaled( o, pOrigin, VectorConst_Y, -size/2 ); scale( n, VectorConst_X, -20 ); SrvrCreateWall( client_id, iWorld, iSector, pSector->iWall, FALSE, INVALID_INDEX, FALSE, o, n ); /* north */ addscaled( o, pOrigin, VectorConst_X, -size/2 ); scale( n, VectorConst_Y, 20 ); { PWALL pWall = GetSetMember( WALL, &world->walls, pSector->iWall ); SrvrCreateWall( client_id, iWorld, iSector , pWall->iWallStart, TRUE , pWall->iWallEnd, TRUE, o, n ); } //ComputeSectorPointList( iWorld, iSector, NULL ); //ComputeSectorOrigin( iWorld, iSector ); #ifdef OUTPUT_TO_VIRTUALITY OrderObjectLines( world->object ); #endif SetPoint( pSector->r.n, VectorConst_Y ); //DumpWall( pSector->wall ); //DumpWall( pSector->wall->wall_at_start ); //DumpWall( pSector->wall->wall_at_end ); //DumpWall( pSector->wall->wall_at_start->wall_at_end ); { INDEX texture = SrvrMakeTexture( client_id, iWorld, SrvrMakeName( client_id, iWorld, WIDE( "Default" ) ) ); PFLATLAND_TEXTURE pTexture = GetSetMember( FLATLAND_TEXTURE, &world->textures, texture ); if( !pTexture->flags.bColor ) SrvrSetSolidColor( client_id, iWorld, texture, AColor( 170, 170, 170, 0x80 ) ); SrvrSetTexture( client_id, iWorld, iSector, texture ); } #ifdef WORLDSCAPE_SERVER /* this doesn't exist in direct library */ MarkSectorUpdated( client_id, iWorld, iSector ); #endif return iSector; }