void CLightDlg::OnBtnColor() { int r, g, b; float ob; r = color[0]; g = color[1]; b = color[2]; if ( DoNewColor( &r, &g, &b, &ob, UpdateLightDialog ) ) { color[0] = ob * r; color[1] = ob * g; color[2] = ob * b; ColorButtons(); } }
void CDialogParticleEditor::OnBnClickedButtonBrowsefadecolor() { int r, g, b; float ob; idParticleStage *ps = GetCurStage(); if ( ps == NULL ) { return; } r = ps->fadeColor.x * 255.0f; g = ps->fadeColor.y * 255.0f; b = ps->fadeColor.z * 255.0f; ob = 1.0f; if ( DoNewColor( &r, &g, &b, &ob ) ) { fadeColor.Format( "%f %f %f %f", (float)r / 255.0f, (float)g / 255.0f, (float)b / 255.0f, 1.0f ); DlgVarsToCurStage(); CurStageToDlgVars(); } }
void CDialogParticleEditor::OnBnClickedButtonBrowseEntitycolor() { int r, g, b; float ob; idList<idEntity*> list; idDict dict2; idStr str; list.SetNum( 128 ); int count = gameEdit->GetSelectedEntities( list.Ptr(), list.Num() ); list.SetNum( count ); if ( count ) { const idDict *dict = gameEdit->EntityGetSpawnArgs( list[0] ); if ( dict ) { idVec3 clr = dict->GetVector( "_color", "1 1 1" ); r = clr.x * 255.0f; g = clr.y * 255.0f; b = clr.z * 255.0f; ob = 1.0f; if ( DoNewColor( &r, &g, &b, &ob ) ) { for ( int i = 0; i < count; i++ ) { dict = gameEdit->EntityGetSpawnArgs( list[i] ); const char *name = dict->GetString( "name" ); idEntity *ent = gameEdit->FindEntity( name ); if ( ent ) { gameEdit->EntitySetColor( ent, idVec3( (float)r / 255.0f, (float)g / 255.0f, (float)b / 255.0f ) ); str = va( "%f %f %f", (float)r / 255.0f, (float)g / 255.0f, (float)b / 255.0f ); dict2.Clear(); dict2.Set( "_color", str ); gameEdit->EntityChangeSpawnArgs( ent, &dict2 ); gameEdit->MapSetEntityKeyVal( name, "_color", str ); } } } } CWnd *wnd = GetDlgItem( IDC_BUTTON_SAVE_PARTICLEENTITIES ); if ( wnd ) { wnd->EnableWindow( TRUE ); } } }