Core.Object | +--Engine.Actor | +--Engine.Info | +--XIII.MultiViewport
Texture
BlackTex
int
CDX[4],CDY[4],CDW[4],CDH[4]
Actor
CWndSfxTrigger
CX[4],CY[4],CW[4],CH[4]
CamAppearFX[4]
CamAppearSpeed[4]
color
CamBorderColor[4]
float
CamDuration[4]
CamFOV[4]
CamInit[4]
CamPosX[4]
CamPosY[4]
CamPosition[4]
CamRemoveFX[4]
CamRemoveSpeed[4]
CamRemoved[4]
CamRemoving[4]
CamSfxTrigger
CamSizeX[4]
CamSizeY[4]
CamStartDelay[4]
vector
CamTargetOffset[4]
CamTarget[4]
XIIIBaseHud
MyHudForFX
OnoDelay[4]
OnoDuration[4]
OnoPosX[4]
OnoPosY[4]
OnoSizeX[4]
OnoSizeY[4]
OnoTexture[4]
WhiteTex
bool
bEnded
fStartTime
firstRenderThisFrame
iPhase
mainBorderColor
mainViewportDestinationW,
mainViewportDestinationH
mainViewportDestinationTime
mainViewportDestinationX,
mainViewportDestinationY
mainViewportDurationTime
mainViewportLeadOutTime
void
DrawBorderWnd(Canvas C, int W, int H, int X, int Y, int BorderX, int BorderY, color BorderWndColor)
//_____________________________________________________________________________
ExecuteCam(int q)
InitCam(int q)
RemoveCam(int q)
00001 //----------------------------------------------------------- 00002 // 00003 //----------------------------------------------------------- 00004 class MultiViewport extends Info; 00005 00006 // Main viewport will scale and move to become 00007 var int mainViewportDestinationX, mainViewportDestinationY; 00008 var int mainViewportDestinationW, mainViewportDestinationH; 00009 var float mainViewportDestinationTime; 00010 var float mainViewportDurationTime; 00011 var float mainViewportLeadOutTime; 00012 var color mainBorderColor; 00013 00014 var bool firstRenderThisFrame; 00015 var texture WhiteTex; 00016 var texture BlackTex; 00017 var float fStartTime; 00018 00019 var actor CWndSfxTrigger; 00020 00021 var int iPhase; 00022 var XIIIBaseHUD MyHudForFX; 00023 00024 var actor CamPosition[4]; 00025 var actor CamTarget[4]; 00026 var vector CamTargetOffset[4]; 00027 var actor CamSfxTrigger; 00028 var float CamFOV[4]; 00029 var float CamDuration[4]; 00030 var float CamStartDelay[4]; 00031 var int CamPosX[4]; 00032 var int CamPosY[4]; 00033 var int CamSizeX[4]; 00034 var int CamSizeY[4]; 00035 var color CamBorderColor[4]; 00036 var Texture OnoTexture[4]; 00037 var int OnoPosX[4]; 00038 var int OnoPosY[4]; 00039 var int OnoSizeX[4]; 00040 var int OnoSizeY[4]; 00041 var float OnoDelay[4]; 00042 var float OnoDuration[4]; 00043 var int CamAppearFX[4]; 00044 var int CamRemoveFX[4]; 00045 var int CamAppearSpeed[4]; 00046 var int CamRemoveSpeed[4]; 00047 00048 var int CamInit[4]; 00049 var int CX[4],CY[4],CW[4],CH[4]; 00050 var int CDX[4],CDY[4],CDW[4],CDH[4]; 00051 var int CamRemoving[4]; 00052 var int CamRemoved[4]; 00053 00054 var bool bEnded; 00055 00056 00057 //_____________________________________________________________________________ 00058 event PostBeginPlay() 00059 { 00060 fStartTime = Level.TimeSeconds; 00061 /*if (CWndSfxTrigger != none && CWndSfxTrigger(CWndSfxTrigger) != none) 00062 { 00063 CWndSfxTrigger(CWndSfxTrigger).Trigger(self, Instigator); 00064 }*/ 00065 } 00066 00067 //_____________________________________________________________________________ 00068 function DrawBorderWnd( Canvas C , int W , int H , int X, int Y, int BorderX, int BorderY, color BorderWndColor) 00069 { 00070 local int Height, Width; 00071 00072 C.Style = ERenderStyle.STY_Alpha; 00073 C.bUseBorder = false; 00074 C.DrawColor = BorderWndColor; 00075 C.BorderColor = class'Canvas'.Static.MakeColor(0,0,0); 00076 00077 C.SetPos(X-BorderX-1 , Y-BorderY-1); 00078 C.DrawTile(BlackTex, W+BorderX*2+2,2,0,0,BlackTex.USize, BlackTex.VSize); 00079 C.SetPos(X-BorderX-1 , Y-BorderY-1); 00080 C.DrawTile(BlackTex, 2,H+BorderY*2+2,0,0,BlackTex.USize, BlackTex.VSize); 00081 C.SetPos(X+W+BorderX-1 , Y-BorderY-1); 00082 C.DrawTile(BlackTex, 2,H+BorderY*2+2,0,0,BlackTex.USize, BlackTex.VSize); 00083 C.SetPos(X-BorderX-1 , Y+H+BorderY-1); 00084 C.DrawTile(BlackTex, W+BorderX*2+2,2,0,0,BlackTex.USize, BlackTex.VSize); 00085 00086 Height = H + 2*BorderY; 00087 Width = BorderX; 00088 00089 C.SetPos(X - BorderX, Y - BorderY); 00090 C.DrawTile(WhiteTex, Width,Height, 0, 0, WhiteTex.USize, WhiteTex.VSize); 00091 00092 C.SetPos(X + W, Y - BorderY); 00093 C.DrawTile(WhiteTex, Width,Height, 0, 0, WhiteTex.USize, WhiteTex.VSize); 00094 00095 Height = BorderY; 00096 Width = W + 2*BorderX; 00097 00098 C.SetPos(X - BorderX, Y - BorderY); 00099 C.DrawTile(WhiteTex, Width,Height, 0, 0, WhiteTex.USize, WhiteTex.VSize); 00100 00101 C.SetPos(X - BorderX, Y + H); 00102 C.DrawTile(WhiteTex, Width,Height, 0, 0, WhiteTex.USize, WhiteTex.VSize); 00103 /* 00104 C.bUseBorder = True; 00105 C.DrawColor.A = 0; 00106 Height = H; 00107 Width = W; 00108 00109 C.SetPos(X , Y); 00110 C.DrawTile(WhiteTex, Width,Height, 0, 0, WhiteTex.USize, WhiteTex.VSize); 00111 */ 00112 00113 C.bUseBorder = false; 00114 C.DrawColor = class'Canvas'.Static.MakeColor(0,0,0); 00115 } 00116 00117 //_____________________________________________________________________________ 00118 function InitCam(int q) 00119 { 00120 CamInit[q] = 1; 00121 CX[q] = CamPosX[q]; 00122 CY[q] = CamPosY[q]; 00123 CW[q] = CamSizeX[q]; 00124 CH[q] = CamSizeY[q]; 00125 00126 switch(CamAppearFX[q]) 00127 { 00128 case 1://MultiViewTrigger.CAMFX_Zoom: 00129 CW[q] = 1; 00130 CH[q] = 1; 00131 CX[q] = CamPosX[q] + (CamSizeX[q]>>1); 00132 CY[q] = CamPosY[q] + (CamSizeY[q]>>1); 00133 break; 00134 case 2://MultiViewTrigger.CAMFX_ComeFromLeft: 00135 CX[q] = 0; 00136 CW[q] = 1; 00137 break; 00138 case 3://MultiViewTrigger.CAMFX_ComeFromAbove: 00139 CY[q] = 0; 00140 CH[q] = 1; 00141 break; 00142 case 4://MultiViewTrigger.CAMFX_ComeFromRight: 00143 CX[q] = 639; 00144 CW[q] = 1; 00145 break; 00146 case 5://MultiViewTrigger.CAMFX_ComeFromUnder: 00147 CY[q] = 479; 00148 CH[q] = 1; 00149 break; 00150 case 6://MultiViewTrigger.CAMFX_ComeFromTopLeft: 00151 CX[q] = 0; 00152 CW[q] = 1; 00153 CY[q] = 0; 00154 CH[q] = 1; 00155 break; 00156 case 7://MultiViewTrigger.CAMFX_ComeFromTopRight: 00157 CX[q] = 639; 00158 CW[q] = 1; 00159 CY[q] = 0; 00160 CH[q] = 1; 00161 break; 00162 case 8://MultiViewTrigger.CAMFX_ComeFromDownLeft: 00163 CX[q] = 0; 00164 CW[q] = 1; 00165 CY[q] = 479; 00166 CH[q] = 1; 00167 break; 00168 case 9://MultiViewTrigger.CAMFX_ComeFromDownright: 00169 CX[q] = 639; 00170 CW[q] = 1; 00171 CY[q] = 479; 00172 CH[q] = 1; 00173 break; 00174 case 10://MultiViewTrigger.CAMFX_None: 00175 default: 00176 break; 00177 } 00178 } 00179 00180 //_____________________________________________________________________________ 00181 function RemoveCam(int q) 00182 { 00183 CamRemoving[q] = 1; 00184 CDX[q] = CamPosX[q]; 00185 CDY[q] = CamPosY[q]; 00186 CDW[q] = CamSizeX[q]; 00187 CDH[q] = CamSizeY[q]; 00188 00189 switch(CamRemoveFX[q]) 00190 { 00191 case 1://MultiViewTrigger.CAMOUTFX_Zoom: 00192 CDW[q] = 1; 00193 CDH[q] = 1; 00194 CDX[q] = CamPosX[q] + (CamSizeX[q]>>1); 00195 CDY[q] = CamPosY[q] + (CamSizeY[q]>>1); 00196 break; 00197 case 2://MultiViewTrigger.CAMOUTFX_GoToLeft: 00198 CDX[q] = 0; 00199 CDW[q] = 1; 00200 break; 00201 case 3://MultiViewTrigger.CAMOUTFX_GoToAbove: 00202 CDY[q] = 0; 00203 CDH[q] = 1; 00204 break; 00205 case 4://MultiViewTrigger.CAMOUTFX_GoToRight: 00206 CDX[q] = 639; 00207 CDW[q] = 1; 00208 break; 00209 case 5://MultiViewTrigger.CAMOUTFX_GoToUnder: 00210 CDY[q] = 479; 00211 CDH[q] = 1; 00212 break; 00213 case 6://MultiViewTrigger.CAMOUTFX_GoToTopLeft: 00214 CDX[q] = 0; 00215 CDW[q] = 1; 00216 CDY[q] = 0; 00217 CDH[q] = 1; 00218 break; 00219 case 7://MultiViewTrigger.CAMOUTFX_GoToTopRight: 00220 CDX[q] = 639; 00221 CDW[q] = 1; 00222 CDY[q] = 0; 00223 CDH[q] = 1; 00224 break; 00225 case 8://MultiViewTrigger.CAMOUTFX_GoToDownLeft: 00226 CDX[q] = 0; 00227 CDW[q] = 1; 00228 CDY[q] = 479; 00229 CDH[q] = 1; 00230 break; 00231 case 9://MultiViewTrigger.CAMOUTFX_GoToDownright: 00232 CDX[q] = 639; 00233 CDW[q] = 1; 00234 CDY[q] = 479; 00235 CDH[q] = 1; 00236 break; 00237 case 10://MultiViewTrigger.CAMOUTFX_None: 00238 default: 00239 CamRemoved[q] = 1; 00240 CamRemoving[q] = 0; 00241 break; 00242 } 00243 } 00244 00245 //_____________________________________________________________________________ 00246 function ExecuteCam(int q) 00247 { 00248 if (CamRemoving[q]==0) 00249 { 00250 if (CW[q] < CamSizeX[q]) 00251 { 00252 CW[q] += CamAppearSpeed[q]*2; 00253 if (CW[q] > CamSizeX[q]) 00254 CW[q] = CamSizeX[q]; 00255 } 00256 if (CH[q] < CamSizeY[q]) 00257 { 00258 CH[q] += CamAppearSpeed[q]*2; 00259 if (CH[q] > CamSizeY[q]) 00260 CH[q] = CamSizeY[q]; 00261 } 00262 if (CX[q] < CamPosX[q]) 00263 { 00264 CX[q] += CamAppearSpeed[q]; 00265 if (CX[q] > CamPosX[q]) 00266 CX[q] = CamPosX[q]; 00267 } 00268 if (CY[q] < CamPosY[q]) 00269 { 00270 CY[q] += CamAppearSpeed[q]; 00271 if (CY[q] > CamPosY[q]) 00272 CY[q] = CamPosY[q]; 00273 } 00274 if (CX[q] > CamPosX[q]) 00275 { 00276 CX[q] -= CamAppearSpeed[q]; 00277 if (CX[q] < CamPosX[q]) 00278 CX[q] = CamPosX[q]; 00279 } 00280 if (CY[q] > CamPosY[q]) 00281 { 00282 CY[q] -= CamAppearSpeed[q]; 00283 if (CY[q] < CamPosY[q]) 00284 CY[q] = CamPosY[q]; 00285 } 00286 } 00287 else 00288 { 00289 if (CamRemoveFX[q] == 1) // Zoom 00290 { 00291 if (CW[q] > CDW[q]) 00292 { 00293 CW[q] -= CamRemoveSpeed[q]; 00294 if (CW[q] < CDW[q]) 00295 CW[q] = CDW[q]; 00296 } 00297 if (CH[q] > CDH[q]) 00298 { 00299 CH[q] -= CamRemoveSpeed[q]; 00300 if (CH[q] < CDH[q]) 00301 CH[q] = CDH[q]; 00302 } 00303 } 00304 else 00305 { 00306 if (CX[q] == CDX[q]) 00307 { 00308 if (CW[q] > CDW[q]) 00309 { 00310 CW[q] -= CamRemoveSpeed[q]; 00311 if (CW[q] < CDW[q]) 00312 CW[q] = CDW[q]; 00313 } 00314 } 00315 else if (CX[q] >= 640-CW[q]) 00316 { 00317 if (CW[q] > CDW[q]) 00318 { 00319 CW[q] -= CamRemoveSpeed[q]; 00320 if (CW[q] < CDW[q]) 00321 CW[q] = CDW[q]; 00322 } 00323 } 00324 00325 if (CY[q] == CDY[q]) 00326 { 00327 if (CH[q] > CDH[q]) 00328 { 00329 CH[q] -= CamRemoveSpeed[q]; 00330 if (CH[q] < CDH[q]) 00331 CH[q] = CDH[q]; 00332 } 00333 } 00334 else if (CY[q] >= 480-CH[q]) 00335 { 00336 if (CH[q] > CDH[q]) 00337 { 00338 CH[q] -= CamRemoveSpeed[q]; 00339 if (CH[q] < CDH[q]) 00340 CH[q] = CDH[q]; 00341 } 00342 } 00343 } 00344 00345 if (CX[q] < CDX[q]) 00346 { 00347 CX[q] += CamRemoveSpeed[q]; 00348 if (CX[q] > CDX[q]) 00349 CX[q] = CDX[q]; 00350 } 00351 if (CY[q] < CDY[q]) 00352 { 00353 CY[q] += CamRemoveSpeed[q]; 00354 if (CY[q] > CDY[q]) 00355 CY[q] = CDY[q]; 00356 } 00357 if (CX[q] > CDX[q]) 00358 { 00359 CX[q] -= CamRemoveSpeed[q]; 00360 if (CX[q] < CDX[q]) 00361 CX[q] = CDX[q]; 00362 } 00363 if (CY[q] > CDY[q]) 00364 { 00365 CY[q] -= CamRemoveSpeed[q]; 00366 if (CY[q] < CDY[q]) 00367 CY[q] = CDY[q]; 00368 } 00369 00370 if (CX[q]==CDX[q] && CY[q]==CDY[q] && CW[q]==CDW[q] && CH[q]==CDH[q]) 00371 { 00372 CamRemoved[q] = 1; 00373 CamRemoving[q] = 0; 00374 } 00375 } 00376 } 00377 00378 //_____________________________________________________________________________ 00379 simulated event RenderOverlays( canvas C ) 00380 { 00381 local float deltaTime; 00382 local eDrawType DT_mem; 00383 local float mainViewportScale; 00384 local int mwx,mwy,mww,mwh; 00385 local int q; 00386 00387 deltaTime = Level.TimeSeconds-fStartTime; 00388 00389 if (Level.TimeSeconds < fStartTime+mainViewportDestinationTime) 00390 mainViewportScale = 1.0-((fStartTime+mainViewportDestinationTime)-Level.TimeSeconds)/mainViewportDestinationTime; 00391 else if (Level.TimeSeconds > fStartTime+mainViewportDestinationTime+mainViewportDurationTime) 00392 mainViewportScale = ((fStartTime+mainViewportDestinationTime+mainViewportDurationTime+mainViewportLeadOutTime)-Level.TimeSeconds)/mainViewportLeadOutTime; 00393 else 00394 mainViewportScale = 1.0; 00395 00396 if (Level.TimeSeconds > fStartTime+mainViewportDestinationTime+mainViewportDurationTime+mainViewportLeadOutTime) 00397 { 00398 bEnded = true; 00399 //return; 00400 } 00401 00402 if (mainViewportScale<0.0) 00403 mainViewportScale = 0.0; 00404 if (mainViewportScale>1.0) 00405 mainViewportScale = 1.0; 00406 00407 mwx = (mainViewportDestinationX)*mainViewportScale; 00408 mwy = (mainViewportDestinationY)*mainViewportScale; 00409 mww = 640+(mainViewportDestinationW-640)*mainViewportScale; 00410 mwh = 480+(mainViewportDestinationH-480)*mainViewportScale; 00411 00412 Level.SetOnlyPostRender(true); 00413 00414 if (firstRenderThisFrame) 00415 { 00416 firstRenderThisFrame = false; 00417 DT_mem = DrawType; 00418 XIIIPlayerController(owner).bRenderPortal = true; 00419 00420 //Log("Drawing MultiViewport"); 00421 DrawBorderWnd( c , mww , mwh , mwx, mwy, 5, 5, mainBorderColor); 00422 C.DrawPortal(mwx, mwy, mww, mwh, XIIIPlayerController(owner), XIIIPlayerController(owner).location, XIIIPlayerController(owner).rotation); 00423 /* 00424 C.SetPos(0.0, 0.0); 00425 C.DrawTile(texture'XIIIMenu.Blanc',320*scale+8,240*scale+8,0,0,1,1); 00426 00427 XIIIPlayerController(Instigator.controller).bRenderPortal = true; 00428 DT_mem = DrawType; 00429 SetDrawType(DT_none); 00430 XIIIPlayerController(Instigator.controller).bBehindView = true; 00431 C.DrawPortal(4,4,320*scale,240*scale,self,location,rotation); 00432 XIIIPlayerController(Instigator.controller).bBehindView = false; 00433 SetDrawType(DT_mem); 00434 XIIIPlayerController(Instigator.controller).bRenderPortal = false; 00435 */ 00436 00437 MyHudForFX.PlayerOwner.Pawn.bOwnerNoSee = false; 00438 if ( XIIIPlayerController(MyHudForFX.PlayerOwner).bWeaponMode ) 00439 MyHudForFX.PlayerOwner.Pawn.weapon.bOwnerNoSee = true; 00440 else 00441 MyHudForFX.PlayerOwner.Pawn.SelectedItem.bOwnerNoSee = true; 00442 for (q=0; q<4; q++) 00443 { 00444 if (CamRemoved[q]==0 && CamPosition[q] != none && CamTarget[q] != none && deltaTime > CamStartDelay[q]) 00445 { 00446 if (deltaTime < CamStartDelay[q] + CamDuration[q] || CamRemoving[q]==1) 00447 { 00448 if (CamInit[q]==0) 00449 { 00450 InitCam(q); 00451 } 00452 } 00453 else if (CamRemoving[q]==0) 00454 { 00455 RemoveCam(q); 00456 } 00457 ExecuteCam(q); 00458 DrawBorderWnd( c , CW[q], CH[q], CX[q], CY[q], 5, 5, CamBorderColor[q]); 00459 C.DrawPortal(CX[q], CY[q], CW[q], CH[q], CamPosition[q], CamPosition[q].location, rotator(CamTarget[q].location + CamTargetOffset[q] - CamPosition[q].location), CamFOV[q]); 00460 00461 if (OnoTexture[q] != none && deltaTime > CamStartDelay[q]+OnoDelay[q] && deltaTime < CamStartDelay[q] + OnoDelay[q] + OnoDuration[q]) 00462 { 00463 C.Style = ERenderStyle.STY_Alpha; 00464 C.bUseBorder = false; 00465 C.SetPos(OnoPosX[q] , OnoPosY[q]); 00466 C.DrawTile(OnoTexture[q], OnoSizeX[q], OnoSizeY[q],0,0,OnoTexture[q].USize,OnoTexture[q].VSize); 00467 } 00468 } 00469 } 00470 MyHudForFX.PlayerOwner.Pawn.bOwnerNoSee = true; 00471 if ( XIIIPlayerController(MyHudForFX.PlayerOwner).bWeaponMode ) 00472 MyHudForFX.PlayerOwner.Pawn.weapon.bOwnerNoSee = false; 00473 else 00474 MyHudForFX.PlayerOwner.Pawn.SelectedItem.bOwnerNoSee = false; 00475 00476 SetDrawType(DT_mem); 00477 XIIIPlayerController(owner).bRenderPortal = false; 00478 firstRenderThisFrame = true; 00479 } 00480 } 00481 00482 00483 00484 defaultproperties 00485 { 00486 mainViewportDestinationX=200 00487 mainViewportDestinationY=200 00488 mainViewportDestinationW=200 00489 mainViewportDestinationH=200 00490 mainViewportDestinationTime=5.000000 00491 mainViewportDurationTime=5.000000 00492 mainViewportLeadOutTime=5.000000 00493 mainBorderColor=(B=255,G=255,R=255,A=255) 00494 firstRenderThisFrame=True 00495 WhiteTex=Texture'XIIIMenu.HUD.blanc' 00496 BlackTex=Texture'XIIIMenu.HUD.noir' 00497 CamFOV(0)=45.000000 00498 CamFOV(1)=45.000000 00499 CamFOV(2)=45.000000 00500 CamFOV(3)=45.000000 00501 CamDuration(0)=4.000000 00502 CamDuration(1)=4.000000 00503 CamDuration(2)=4.000000 00504 CamDuration(3)=4.000000 00505 CamStartDelay(0)=0.500000 00506 CamStartDelay(1)=0.500000 00507 CamStartDelay(2)=0.500000 00508 CamStartDelay(3)=0.500000 00509 CamPosX(0)=100 00510 CamPosX(1)=100 00511 CamPosX(2)=250 00512 CamPosX(3)=250 00513 CamPosY(0)=100 00514 CamPosY(1)=250 00515 CamPosY(2)=250 00516 CamPosY(3)=100 00517 CamSizeX(0)=100 00518 CamSizeX(1)=100 00519 CamSizeX(2)=100 00520 CamSizeX(3)=100 00521 CamSizeY(0)=100 00522 CamSizeY(1)=100 00523 CamSizeY(2)=100 00524 CamSizeY(3)=100 00525 CamBorderColor(0)=(B=255,G=255,R=255,A=255) 00526 CamBorderColor(1)=(B=255,G=255,R=255,A=255) 00527 CamBorderColor(2)=(B=255,G=255,R=255,A=255) 00528 CamBorderColor(3)=(B=255,G=255,R=255,A=255) 00529 CamAppearSpeed(0)=5 00530 CamAppearSpeed(1)=5 00531 CamAppearSpeed(2)=5 00532 CamAppearSpeed(3)=5 00533 CamRemoveSpeed(0)=20 00534 CamRemoveSpeed(1)=20 00535 CamRemoveSpeed(2)=20 00536 CamRemoveSpeed(3)=20 00537 }